create-crust 0.2.0 → 0.2.1
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 +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{existsSync as e,readdirSync as t}from"node:fs";import{basename as n,resolve as r}from"node:path";import{Crust as i}from"@crustjs/core";import{isInGitRepo as a,runSteps as o,scaffold as s}from"@crustjs/create";import{spinner as c}from"@crustjs/progress";import{confirm as l,input as u,select as d}from"@crustjs/prompts";const f={crustCoreVersion:`0.2.
|
|
2
|
+
import{existsSync as e,readdirSync as t}from"node:fs";import{basename as n,resolve as r}from"node:path";import{Crust as i}from"@crustjs/core";import{isInGitRepo as a,runSteps as o,scaffold as s}from"@crustjs/create";import{spinner as c}from"@crustjs/progress";import{confirm as l,input as u,select as d}from"@crustjs/prompts";const f={crustCoreVersion:`0.2.1`,crustExtensionsVersion:`0.2.1`,crustCliVersion:`0.2.1`},p=/[<>:"|?*\\]/;function m(e){if(!e)throw Error(`Project name cannot be empty`);if(p.test(e))throw Error(`Project name contains invalid characters: ${e}`)}await new i(`create-crust`,{description:`Scaffold a new Crust CLI project`}).flags({name:`distribution`,type:`string`,choices:[`binary`,`runtime`],description:`Distribution mode ("binary" or "runtime")`},{name:`install`,type:`boolean`,description:`Install dependencies after scaffolding`},{name:`git`,type:`boolean`,description:`Initialize a git repository after scaffolding`},{name:`overwrite`,type:`boolean`,description:`Overwrite the destination directory if it already exists`}).args({name:`directory`,type:`string`,description:`Project directory to scaffold into`}).action(async({args:i,flags:p})=>{let h=i.directory??await u({message:`Project directory`,default:`my-cli`,validate:m}),g=r(process.cwd(),h),_=n(g),v=p.distribution,y=h===`.`?t(g).length>0:e(g),b=!1;if(y&&(b=await l({message:h===`.`?`Current directory is not empty. Overwrite conflicting files?`:`Directory "${_}" already exists. Overwrite?`,default:!1,...p.overwrite===void 0?{}:{initial:p.overwrite}}),!b)){console.log(`Aborted.`);return}let x=await d({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`,...v===void 0?{}:{initial:v}}),S=await l({message:`Install dependencies?`,default:!0,...p.install===void 0?{}:{initial:p.install}}),C=e(g)?g:r(g,`..`),w=!a(C)&&await l({message:`Initialize a git repository?`,default:!0,...p.git===void 0?{}:{initial:p.git}}),T=_,E=e=>new URL(`../templates/${e}`,import.meta.url),D={name:T,...f};if(await c({message:`Scaffolding project...`,task:async()=>{await s({template:E(`base`),dest:g,context:D,...b?{conflict:`overwrite`}:{}}),await s({template:E(`minimal`),dest:g,context:D,conflict:`overwrite`}),await s({template:E(`distribution/${x}`),dest:g,context:D,conflict:`overwrite`})}}),S&&await o([{type:`install`}],g),w&&await c({message:`Initializing git repository...`,task:()=>o([{type:`git-init`,commit:`chore: initial commit`}],g)}),console.log(`\nCreated ${T}!\n`),console.log(`Next steps:`),h!==`.`){let e=h.startsWith(`/`)?h:`./${h}`;console.log(` cd ${e}`)}console.log(` bun run dev`),console.log(` bun run build`)}).execute();export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-crust",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Scaffold a new Crust CLI project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"postpack": "rm -f LICENSE"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@crustjs/core": "^0.2.
|
|
48
|
-
"@crustjs/create": "^0.1.
|
|
49
|
-
"@crustjs/progress": "^0.1.
|
|
50
|
-
"@crustjs/prompts": "^0.2.
|
|
47
|
+
"@crustjs/core": "^0.2.1",
|
|
48
|
+
"@crustjs/create": "^0.1.1",
|
|
49
|
+
"@crustjs/progress": "^0.1.1",
|
|
50
|
+
"@crustjs/prompts": "^0.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@crustjs/config": "0.0.0",
|
|
54
|
-
"@crustjs/extensions": "0.2.
|
|
54
|
+
"@crustjs/extensions": "0.2.1",
|
|
55
55
|
"tsdown": "^0.23.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
|
-
"bun": ">=1.
|
|
58
|
+
"bun": ">=1.4.0",
|
|
59
59
|
"node": ">=22",
|
|
60
60
|
"deno": ">=2.8"
|
|
61
61
|
}
|