create-crust 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Scaffold a new [Crust](https://crustjs.com) CLI project in seconds.
8
8
  bun create crust my-cli
9
9
  ```
10
10
 
11
- This will prompt for your project directory, template style, whether to install dependencies, and optionally initialize a git repository. The package name is inferred from the directory name.
11
+ This will prompt for your project directory, template style, distribution mode (standalone binaries recommended, or Bun runtime package), whether to install dependencies, and optionally initialize a git repository. The package name is inferred from the directory name.
12
12
 
13
13
  `create-crust` includes two templates:
14
14
 
@@ -18,11 +18,13 @@ This will prompt for your project directory, template style, whether to install
18
18
  Every generated project includes:
19
19
 
20
20
  - `src/cli.ts` — entry point with a sample command
21
- - `package.json` — configured with `crust build` and `bun run` dev scripts
21
+ - `package.json` — configured for the selected distribution mode
22
22
  - `tsconfig.json` — strict TypeScript config
23
23
  - `README.md` — getting started instructions
24
24
  - `.gitignore` — sensible defaults for Node/Bun projects
25
25
 
26
+ Generated templates can be configured for either standalone binary distribution (`bin` -> `dist/cli`, `files: ["dist"]`) or Bun runtime package distribution (`bin` -> `dist/cli.js`, runtime deps) during scaffolding. Standalone binaries are the recommended default.
27
+
26
28
  ## Documentation
27
29
 
28
30
  See the full docs at [crustjs.com](https://crustjs.com).
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{existsSync as O}from"fs";import{basename as $,resolve as Q}from"path";import{Crust as b}from"@crustjs/core";import{detectPackageManager as E,isInGitRepo as H,runSteps as T,scaffold as L}from"@crustjs/create";import{confirm as F,input as V,select as x,spinner as y}from"@crustjs/prompts";var G=/[<>:"|?*\\]/;function M(z){if(!z)return"Project name cannot be empty";if(G.test(z))return`Project name contains invalid characters: ${z}`;return!0}var R=new b("create-crust").meta({description:"Scaffold a new Crust CLI project"}).args([{name:"directory",type:"string",description:"Project directory to scaffold into"}]).run(async({args:z})=>{let w=z.directory??await V({message:"Project directory",default:"my-cli",validate:M}),q=Q(process.cwd(),w),J=$(q);if(w!=="."&&O(q)){if(!await F({message:`Directory "${J}" already exists. Overwrite?`,default:!1})){console.log("Aborted.");return}}let U=await F({message:"Install dependencies?",default:!0}),W=await x({message:"Template style",choices:[{label:"Minimal",value:"minimal",hint:"single-file starter"},{label:"Modular",value:"modular",hint:"file split with .sub()"}],default:"minimal"})==="minimal"?"templates/base":"templates/modular",X=O(q)?q:Q(q,".."),Y=H(X)?!1:await F({message:"Initialize a git repository?",default:!0}),K=J;if(await L({template:W,dest:q,context:{name:K},conflict:"overwrite"}),U){let B=E(q),Z=B==="npm"?"npm install":`${B} install`;await T([{type:"command",cmd:Z}],q)}if(Y)await y({message:"Initializing git repository...",task:()=>T([{type:"git-init",commit:"chore: initial commit"}],q)});if(console.log(`
4
- Created ${K}!
5
- `),console.log("Next steps:"),w!=="."){let B=w.startsWith("/")?w:`./${w}`;console.log(` cd ${B}`)}console.log(" bun run dev"),console.log(" bun run build")});await R.execute();
3
+ import{existsSync as Q}from"fs";import{basename as V,resolve as U}from"path";import{Crust as b}from"@crustjs/core";import{detectPackageManager as x,isInGitRepo as G,runSteps as W,scaffold as J}from"@crustjs/create";import{confirm as K,input as M,select as X,spinner as R}from"@crustjs/prompts";var T=/[<>:"|?*\\]/;function _(z){if(!z)return"Project name cannot be empty";if(T.test(z))return`Project name contains invalid characters: ${z}`;return!0}var k=new b("create-crust").meta({description:"Scaffold a new Crust CLI project"}).args([{name:"directory",type:"string",description:"Project directory to scaffold into"}]).run(async({args:z})=>{let w=z.directory??await M({message:"Project directory",default:"my-cli",validate:_}),q=U(process.cwd(),w),O=V(q);if(w!=="."&&Q(q)){if(!await K({message:`Directory "${O}" already exists. Overwrite?`,default:!1})){console.log("Aborted.");return}}let Y=await X({message:"Template style",choices:[{label:"Minimal",value:"minimal",hint:"single-file starter"},{label:"Modular",value:"modular",hint:"file split with .sub()"}],default:"minimal"})==="minimal"?"templates/minimal":"templates/modular",Z=await X({message:"Distribution mode",choices:[{label:"Standalone binaries (recommended)",value:"binary",hint:"compile with crust build, publish self-contained executables"},{label:"Bun runtime package",value:"runtime",hint:"ship JS build that runs with Bun"}],default:"binary"})==="binary"?"templates/distribution/binary":"templates/distribution/runtime",$=await K({message:"Install dependencies?",default:!0}),E=Q(q)?q:U(q,".."),H=G(E)?!1:await K({message:"Initialize a git repository?",default:!0}),F=O;if(await J({template:"templates/base",dest:q,context:{name:F},conflict:"overwrite"}),await J({template:Y,dest:q,context:{name:F},conflict:"overwrite"}),await J({template:Z,dest:q,context:{name:F},conflict:"overwrite"}),$){let B=x(q),L=B==="npm"?"npm install":`${B} install`;await W([{type:"command",cmd:L}],q)}if(H)await R({message:"Initializing git repository...",task:()=>W([{type:"git-init",commit:"chore: initial commit"}],q)});if(console.log(`
4
+ Created ${F}!
5
+ `),console.log("Next steps:"),w!=="."){let B=w.startsWith("/")?w:`./${w}`;console.log(` cd ${B}`)}console.log(" bun run dev"),console.log(" bun run build")});await k.execute();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-crust",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Scaffold a new Crust CLI project.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "test": "bun test"
41
41
  },
42
42
  "dependencies": {
43
- "@crustjs/core": "0.0.11",
43
+ "@crustjs/core": "0.0.12",
44
44
  "@crustjs/create": "0.0.4",
45
45
  "@crustjs/prompts": "0.0.8"
46
46
  },
@@ -12,8 +12,8 @@ coverage
12
12
 
13
13
  # logs
14
14
  logs
15
- _.log
16
- report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
15
+ *.log
16
+ report.*.*.*.*.json
17
17
 
18
18
  # dotenv environment variable files
19
19
  .env
@@ -12,15 +12,14 @@
12
12
  "scripts": {
13
13
  "dev": "bun run src/cli.ts",
14
14
  "build": "crust build",
15
+ "prepack": "bun run build",
15
16
  "start": "./dist/cli",
16
17
  "check:types": "tsc --noEmit"
17
18
  },
18
- "dependencies": {
19
- "@crustjs/core": "latest",
20
- "@crustjs/plugins": "latest"
21
- },
22
19
  "devDependencies": {
20
+ "@crustjs/core": "latest",
23
21
  "@crustjs/crust": "latest",
22
+ "@crustjs/plugins": "latest",
24
23
  "@types/bun": "latest",
25
24
  "typescript": "^5"
26
25
  }
@@ -7,12 +7,13 @@
7
7
  "dist"
8
8
  ],
9
9
  "bin": {
10
- "{{name}}": "dist/cli"
10
+ "{{name}}": "dist/cli.js"
11
11
  },
12
12
  "scripts": {
13
13
  "dev": "bun run src/cli.ts",
14
- "build": "crust build",
15
- "start": "./dist/cli",
14
+ "build": "bun build src/cli.ts --target bun --outfile dist/cli.js",
15
+ "prepack": "bun run build",
16
+ "start": "bun run dist/cli.js",
16
17
  "check:types": "tsc --noEmit"
17
18
  },
18
19
  "dependencies": {
@@ -0,0 +1,34 @@
1
+ # {{name}}
2
+
3
+ A CLI built with [Crust](https://crustjs.com).
4
+
5
+ ## Development
6
+
7
+ ```sh
8
+ # Run in dev mode
9
+ bun run dev
10
+
11
+ # Type-check
12
+ bun run check:types
13
+
14
+ # Build distribution output
15
+ bun run build
16
+ ```
17
+
18
+ This template supports two distribution modes:
19
+
20
+ - **Standalone binaries (recommended)**: compile with `crust build` and publish `dist/` only.
21
+ - **Bun runtime package**: distribute with runtime dependencies (`@crustjs/core` and `@crustjs/plugins` in `dependencies`).
22
+
23
+ ## Publishing
24
+
25
+ - **Standalone binaries**: keep `files: ["dist"]`, `bin` -> `dist/cli`, and use `prepack` (`bun run build`).
26
+ - **Bun runtime package**: keep `bin` -> `dist/cli.js`, build with Bun (`bun build ... --outfile dist/cli.js`), and keep runtime deps in `dependencies`.
27
+
28
+ ## Usage
29
+
30
+ ```sh
31
+ # Run the CLI
32
+ {{name}} world
33
+ {{name}} --greet Hey world
34
+ ```
@@ -13,10 +13,20 @@ bun run dev
13
13
  # Type-check
14
14
  bun run check:types
15
15
 
16
- # Build standalone executable
16
+ # Build distribution output
17
17
  bun run build
18
18
  ```
19
19
 
20
+ This template supports two distribution modes:
21
+
22
+ - **Standalone binaries (recommended)**: compile with `crust build` and publish `dist/` only.
23
+ - **Bun runtime package**: distribute with runtime dependencies (`@crustjs/core` and `@crustjs/plugins` in `dependencies`).
24
+
25
+ ## Publishing
26
+
27
+ - **Standalone binaries**: keep `files: ["dist"]`, `bin` -> `dist/cli`, and use `prepack` (`bun run build`).
28
+ - **Bun runtime package**: keep `bin` -> `dist/cli.js`, build with Bun (`bun build ... --outfile dist/cli.js`), and keep runtime deps in `dependencies`.
29
+
20
30
  ## Usage
21
31
 
22
32
  ```sh
@@ -1,24 +0,0 @@
1
- # {{name}}
2
-
3
- A CLI built with [Crust](https://crustjs.com).
4
-
5
- ## Development
6
-
7
- ```sh
8
- # Run in dev mode
9
- bun run dev
10
-
11
- # Type-check
12
- bun run check:types
13
-
14
- # Build standalone executable
15
- bun run build
16
- ```
17
-
18
- ## Usage
19
-
20
- ```sh
21
- # Run the CLI
22
- {{name}} world
23
- {{name}} --greet Hey world
24
- ```
@@ -1,34 +0,0 @@
1
- # dependencies (bun install)
2
- node_modules
3
-
4
- # output
5
- out
6
- dist
7
- *.tgz
8
-
9
- # code coverage
10
- coverage
11
- *.lcov
12
-
13
- # logs
14
- logs
15
- *.log
16
- report.*.*.*.*.json
17
-
18
- # dotenv environment variable files
19
- .env
20
- .env.development.local
21
- .env.test.local
22
- .env.production.local
23
- .env.local
24
-
25
- # caches
26
- .eslintcache
27
- .cache
28
- *.tsbuildinfo
29
-
30
- # IntelliJ based IDEs
31
- .idea
32
-
33
- # Finder (MacOS) folder config
34
- .DS_Store
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": ["ESNext"],
4
- "target": "ESNext",
5
- "module": "Preserve",
6
- "moduleDetection": "force",
7
- "moduleResolution": "bundler",
8
- "allowImportingTsExtensions": true,
9
- "verbatimModuleSyntax": true,
10
- "noEmit": true,
11
- "strict": true,
12
- "skipLibCheck": true,
13
- "noFallthroughCasesInSwitch": true,
14
- "noUncheckedIndexedAccess": true
15
- },
16
- "include": ["src"]
17
- }
File without changes