create-crust 0.0.24 → 0.0.26
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/dist/index.js +3 -3
- package/package.json +8 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{existsSync as
|
|
4
|
-
Created ${
|
|
5
|
-
`),console.log("Next steps:"),
|
|
3
|
+
import{existsSync as Z}from"fs";import{basename as _,resolve as $}from"path";import{Crust as A}from"@crustjs/core";import{isInGitRepo as G,runSteps as E}from"@crustjs/create";import{spinner as F}from"@crustjs/progress";import{confirm as U,input as T,select as H}from"@crustjs/prompts";import{runSteps as I,scaffold as Q}from"@crustjs/create";async function Y(q){let{resolvedDir:w,name:z,template:B,distributionMode:J}=q,K=B==="minimal"?"templates/minimal":"templates/modular",O=J==="binary"?"templates/distribution/binary":"templates/distribution/runtime";await Q({template:"templates/base",dest:w,context:{name:z},conflict:"overwrite"}),await Q({template:K,dest:w,context:{name:z},conflict:"overwrite"}),await Q({template:O,dest:w,context:{name:z},conflict:"overwrite"})}var h=/[<>:"|?*\\]/;function M(q){if(!q)return"Project name cannot be empty";if(h.test(q))return`Project name contains invalid characters: ${q}`;return!0}function C(q){if(q===void 0)return;if(q==="minimal"||q==="modular")return q;throw Error(`Invalid template "${q}". Expected "minimal" or "modular".`)}function y(q){if(q===void 0)return;if(q==="binary"||q==="runtime")return q;throw Error(`Invalid distribution "${q}". Expected "binary" or "runtime".`)}var N=new A("create-crust").meta({description:"Scaffold a new Crust CLI project"}).flags({template:{type:"string",description:'Template style ("minimal" or "modular")'},distribution:{type:"string",description:'Distribution mode ("binary" or "runtime")'},install:{type:"boolean",description:"Install dependencies after scaffolding"},git:{type:"boolean",description:"Initialize a git repository after scaffolding"},overwrite:{type:"boolean",description:"Overwrite the destination directory if it already exists"}}).args([{name:"directory",type:"string",description:"Project directory to scaffold into"}]).run(async({args:q,flags:w})=>{let z=q.directory??await T({message:"Project directory",default:"my-cli",validate:M}),B=$(process.cwd(),z),J=_(B),K=C(w.template),O=y(w.distribution);if(z!=="."&&Z(B)){if(w.overwrite===!0)console.log(`Directory "${J}" already exists; overwriting (--overwrite).`);if(!await U({message:`Directory "${J}" already exists. Overwrite?`,default:!1,...w.overwrite!==void 0?{initial:w.overwrite}:{}})){console.log("Aborted.");return}}let L=await H({message:"Template style",choices:[{label:"Minimal",value:"minimal",hint:"single-file starter"},{label:"Modular",value:"modular",hint:"file split with .sub()"}],default:"minimal",...K!==void 0?{initial:K}:{}}),V=await H({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",...O!==void 0?{initial:O}:{}}),k=await U({message:"Install dependencies?",default:!0,...w.install!==void 0?{initial:w.install}:{}}),x=Z(B)?B:$(B,".."),R=G(x)?!1:await U({message:"Initialize a git repository?",default:!0,...w.git!==void 0?{initial:w.git}:{}}),W=J;if(await F({message:"Scaffolding project...",task:()=>Y({resolvedDir:B,name:W,template:L,distributionMode:V})}),k)await E([{type:"install"}],B);if(R)await F({message:"Initializing git repository...",task:()=>E([{type:"git-init",commit:"chore: initial commit"}],B)});if(console.log(`
|
|
4
|
+
Created ${W}!
|
|
5
|
+
`),console.log("Next steps:"),z!=="."){let X=z.startsWith("/")?z:`./${z}`;console.log(` cd ${X}`)}console.log(" bun run dev"),console.log(" bun run build")});await N.execute();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-crust",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Scaffold a new Crust CLI project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,18 +38,20 @@
|
|
|
38
38
|
"dev": "bunup --watch",
|
|
39
39
|
"check:types": "tsc --noEmit",
|
|
40
40
|
"test": "bun test",
|
|
41
|
+
"test:smoke": "bun test tests/cli.smoke.test.ts",
|
|
41
42
|
"publish": "bun publish --no-git-checks || true"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@crustjs/core": "0.0.
|
|
45
|
-
"@crustjs/create": "0.0.
|
|
46
|
-
"@crustjs/
|
|
45
|
+
"@crustjs/core": "0.0.16",
|
|
46
|
+
"@crustjs/create": "0.0.5",
|
|
47
|
+
"@crustjs/progress": "0.0.2",
|
|
48
|
+
"@crustjs/prompts": "0.0.11"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@crustjs/config": "0.0.0",
|
|
50
|
-
"bunup": "^0.16.
|
|
52
|
+
"bunup": "^0.16.31"
|
|
51
53
|
},
|
|
52
54
|
"peerDependencies": {
|
|
53
|
-
"typescript": "^
|
|
55
|
+
"typescript": "^6.0.2"
|
|
54
56
|
}
|
|
55
57
|
}
|