Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Build @cartable/core
run: pnpm run build --filter @cartable/core

- name: Build @cartable/create
run: pnpm run build --filter @cartable/create

- name: Build examples
run: pnpm run build --filter "cartable-example-*"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"prettier": "prettier --write \"**/*.{js,ts,tsx,css,scss,json,md,mdx,yml}\"",
"build": "pnpm run build --filter @cartable/core",
"build": "pnpm run build --filter @cartable/*",
"version": "pnpx changeset version && pnpm install --lockfile-only",
"release": "pnpm run build && pnpx changeset publish",
"prepare": "husky install"
Expand Down
3 changes: 3 additions & 0 deletions packages/cartable-create/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @cartable/create

This package is used to create local cartable projects.
3 changes: 3 additions & 0 deletions packages/cartable-create/bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require("../dist/index.js");
39 changes: 39 additions & 0 deletions packages/cartable-create/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@cartable/create",
"version": "0.0.0",
"license": "MIT",
"bin": {
"cartable-create": "./bin/index.js"
},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=14"
},
"files": [
"bin",
"dist"
],
"scripts": {
"build": "cartable build",
"prepare": "pnpm run build"
},
"keywords": [
"node",
"zero-config",
"typescript",
"bundler"
],
"repository": "git+https://github.com/pradel/cartable.git",
"funding": "https://github.com/sponsors/pradel",
"author": "Léo Pradel",
"dependencies": {
"commander": "8.3.0"
},
"devDependencies": {
"@cartable/core": "^0.2.0",
"@types/node": "16.11.11",
"typescript": "4.5.2"
}
}
31 changes: 31 additions & 0 deletions packages/cartable-create/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { program, Option } from "commander";

const packageJson = require("../package.json");
program.version(packageJson.version);

const templates = ["typescript", "javascript"];

interface ProgramOption {
template: "typescript" | "javascript";
}

program
.argument("<project-directory>", "project directory")
.usage("<project-directory> [options]")
.addOption(
new Option("-t, --template <type>", "specify a template")
.choices(templates)
.default("typescript")
)
.parse();

const run = async () => {
const options = program.opts<ProgramOption>();
const projectDirectory = program.args[0];

// 1. Copy template files
// 2. Install deps
// 3. Print success message
};

run();
17 changes: 17 additions & 0 deletions packages/cartable-create/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"outDir": "dist",
"strict": true,
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"esModuleInterop": true,
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}
14 changes: 13 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.