@floegence/floe-webapp-init 0.81.2 → 0.81.3
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.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import l from"node:fs";import r from"node:path";import{fileURLToPath as h}from"node:url";import S from"prompts";import{red as p,bold as f,cyan as y,green as v}from"kolorist";const w={"_package.json":"package.json",_gitignore:".gitignore","_env.example":".env.example"};function x(n,o,t){l.mkdirSync(o,{recursive:!0});for(const s of l.readdirSync(n,{withFileTypes:!0})){const a=s.name,i=r.join(n,a),c=w[a]||a,e=r.join(o,c);if(s.isDirectory())x(i,e);else{const m=l.openSync(i,l.constants.O_RDONLY|l.constants.O_NOFOLLOW);try{if(!l.fstatSync(m).isFile())throw new Error(`Template entry is not a regular file: ${i}`);const g=l.readFileSync(m);let u=g;if(t&&c==="package.json"){const d=JSON.parse(g.toString("utf-8"));d.name=t,u=JSON.stringify(d,null,2)+`
|
|
3
|
+
`}l.writeFileSync(e,u,{flag:"wx"})}finally{l.closeSync(m)}}}}const j=[{name:"minimal",value:"minimal",description:"Basic setup with FloeApp"},{name:"full",value:"full",description:"Full setup with sample pages"}];async function b(){console.log(`
|
|
3
4
|
${f(y("Floe Webapp"))}
|
|
4
|
-
`);const
|
|
5
|
+
`);const n=process.argv.slice(2);let o=n[0],t;(n.includes("--help")||n.includes("-h"))&&(console.log(`Usage: npx @floegence/floe-webapp-init [project-name] [options]
|
|
5
6
|
|
|
6
7
|
Options:
|
|
7
8
|
--template <name> Use a specific template (minimal, full)
|
|
@@ -11,14 +12,13 @@ Examples:
|
|
|
11
12
|
npx @floegence/floe-webapp-init
|
|
12
13
|
npx @floegence/floe-webapp-init my-app
|
|
13
14
|
npx @floegence/floe-webapp-init my-app --template full
|
|
14
|
-
`),process.exit(0));const
|
|
15
|
-
Operation cancelled`)),process.exit(1)}});o=o||
|
|
15
|
+
`),process.exit(0));const s=n.indexOf("--template");if(s!==-1&&n[s+1]){const e=n[s+1];e==="minimal"||e==="full"?t=e:(console.log(p(`Invalid template: ${e}`)),console.log("Available templates: minimal, full"),process.exit(1)),o==="--template"&&(o=n[s+2])}const a=await S([{type:o?null:"text",name:"projectName",message:"Project name:",initial:"floe-app",validate:e=>e?/^[a-z0-9-_]+$/i.test(e)?!0:"Project name can only contain letters, numbers, hyphens, and underscores":"Project name is required"},{type:t?null:"select",name:"template",message:"Select a template:",choices:j.map(e=>({title:e.name,value:e.value,description:e.description}))}],{onCancel:()=>{console.log(p(`
|
|
16
|
+
Operation cancelled`)),process.exit(1)}});o=o||a.projectName,t=t||a.template,(!o||!t)&&(console.log(p("Missing required information")),process.exit(1));const i=r.resolve(o);l.existsSync(i)&&l.readdirSync(i).length>0&&(console.log(p(`
|
|
16
17
|
Directory ${o} is not empty.`)),process.exit(1)),console.log(`
|
|
17
|
-
Scaffolding project in ${y(
|
|
18
|
-
`);const r
|
|
19
|
-
`)}console.log(v(`Done!
|
|
18
|
+
Scaffolding project in ${y(i)}...
|
|
19
|
+
`);const c=r.resolve(h(import.meta.url),"../../templates",t);l.existsSync(c)||(console.log(p(`Template directory not found: ${c}`)),process.exit(1)),x(c,i,r.basename(o)),console.log(v(`Done!
|
|
20
20
|
`)),console.log(`Next steps:
|
|
21
21
|
`),console.log(` cd ${f(o)}`),console.log(" pnpm install"),console.log(` pnpm dev
|
|
22
22
|
`),console.log(`Skill package:
|
|
23
23
|
`),console.log(` ${f("skills/floe-webapp/SKILL.md")}
|
|
24
|
-
`)}
|
|
24
|
+
`)}b().catch(n=>{console.error(p("Error:"),n),process.exit(1)});
|
package/package.json
CHANGED