@fugood/bricks-cli 2.24.0-beta.4 → 2.24.0-beta.7
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/lib/153.index.js +1 -1
- package/lib/832.index.js +1 -0
- package/lib/index.js +4 -4
- package/package.json +2 -2
- package/lib/616.index.js +0 -1
package/lib/153.index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __webpack_esm_id__=153;export const __webpack_esm_ids__=[153];export const __webpack_esm_modules__={7153:(e,i,t)=>{t.r(i),t.d(i,{initProject:()=>
|
|
1
|
+
export const __webpack_esm_id__=153;export const __webpack_esm_ids__=[153];export const __webpack_esm_modules__={7153:(e,i,t)=>{t.r(i),t.d(i,{initProject:()=>k});var n,l,o,s=t(9436),r=t(147),c=t(6928),a=t(9896),u=t(5317),d=t(8568),g=t(9790),p=t(750),y=t(6005),f=t(637),m=t(8765),h=t(7742),b=function(e){try{return(0,u.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch(e){return!1}},v=function(e,i,t){return new Promise(function(n,l){var o=[e].concat(r(i)).join(" "),s=(0,u.spawn)(o,[],{cwd:t,stdio:"pipe",shell:!0});s.on("close",function(e){0===e?n():l(new Error(`Command failed with code ${e}`))}),s.on("error",l)})},j=(n=s(function*(e,i){try{var n=yield Promise.resolve().then(t.bind(t,2785)),l=c.extname(i);if([".ts",".tsx",".js",".jsx"].includes(l))return yield n.format(e,{parser:"typescript",trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100});if(".json"===l)return yield n.format(e,{parser:"json"})}catch(e){}return e}),function(e,i){return n.apply(this,arguments)}),A=(l=s(function*(e,i){console.log(d.Ay.bold.cyan(`\nInitialize BRICKS Project: ${i}\n`));var t=yield(0,f.kv)({message:"Select files to include:",choices:[{name:"GitHub Actions workflow (.github/workflows/ci.yml)",value:"githubActions",checked:!1!==e.githubActions},{name:"AGENTS.md",value:"agents",checked:!1!==e.agents},{name:"CLAUDE.md",value:"claude",checked:!1!==e.claude},{name:"GEMINI.md",value:"gemini",checked:!0===e.gemini}]}),n=yield(0,f.kv)({message:"Select post-generation steps:",choices:[{name:"Run bun install",value:"install",checked:!1!==e.install},{name:"Initialize git repository",value:"git",checked:!1!==e.git}]}),l=yield(0,f.hF)({message:"Output directory:",default:e.output||process.cwd()});return{githubActions:t.includes("githubActions"),agents:t.includes("agents"),claude:t.includes("claude"),gemini:t.includes("gemini"),install:n.includes("install"),git:n.includes("git"),output:l}}),function(e,i){return l.apply(this,arguments)}),k=(o=s(function*(e,i,t){var n,l,o=(n=(0,m.getCurrentProfile)(),(l=(0,m.getToken)(n))||(console.error(d.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,h.createClient)((0,m.getBaseUrl)(),l)),r=t.json,u=t.yes||r,f="application"===e,k=f?"UNSTABLE_applicationProject":"UNSTABLE_moduleProject",w=f?o.queries.applicationProject:o.queries.moduleProject,S=r?null:(0,g.default)(`Fetching ${e} info...`).start(),_="bricks-project";try{var x=(yield o.query(w,{id:i,buildApplicationOnly:!0}))[k];if(null!=x&&x.files){var $=x.files.find(function(e){return"application.json"===e.name});if($)try{var P=JSON.parse($.input);_=p(P.name||"bricks-project")}catch(e){}}S&&S.stop()}catch(e){S&&S.stop()}var C,I=Object.assign({},t);if(!u)try{var N=yield A(t,_);I=Object.assign({},t,N)}catch(e){console.log(d.Ay.yellow("\nCancelled")),process.exit(0)}S=r?null:(0,g.default)(`Fetching ${e} project...`).start();try{var O=(yield o.query(w,{id:i,buildApplicationOnly:!1,setupGitHubActions:!1!==I.githubActions,setupAgents:!1!==I.agents,setupClaudeCode:!1!==I.claude,setupGeminiCLI:!0===I.gemini}))[k];null!=O&&O.files||(S?S.fail(`${y(e)} project not found`):console.error(JSON.stringify({error:`${y(e)} project not found`})),process.exit(1));var z=O.files.find(function(e){return"application.json"===e.name});if(z)try{var E=JSON.parse(z.input);_=p(E.name||"bricks-project")}catch(e){}var F=I.output||process.cwd(),B=c.resolve(F,_);a.existsSync(B)&&(S?S.fail(`Directory already exists: ${B}`):console.error(JSON.stringify({error:`Directory already exists: ${B}`})),process.exit(1)),S&&(S.text="Creating project directory..."),a.mkdirSync(B,{recursive:!0}),S&&(S.text="Writing project files...");var G=yield Promise.all(O.files.map((C=s(function*(e){var i=c.join(B,e.name),t=e.input;return e.formatable&&(t=yield j(t,i)),Object.assign({},e,{filePath:i,content:t})}),function(e){return C.apply(this,arguments)})));G.forEach(function(e){var i=c.dirname(e.filePath);a.existsSync(i)||a.mkdirSync(i,{recursive:!0}),a.writeFileSync(e.filePath,e.content)}),S&&S.succeed(`Project created: ${d.Ay.green(B)} (${O.files.length} files)`);var J=b("bun"),D=b("git"),L=!1,U=!1;if(!1!==I.install&&J){var q=r?null:(0,g.default)("Installing dependencies...").start();try{yield v("bun",["install"],B),L=!0,q&&q.succeed("Dependencies installed")}catch(e){q&&q.fail(`Failed to install dependencies: ${e.message}`)}}else J||!1===I.install||r||(console.log(d.Ay.yellow("\nBun is not installed. Please install Bun and run `bun install` manually.")),console.log(d.Ay.gray(" Install Bun: https://bun.sh/docs/installation")));if(!1!==I.git&&D){var R=r?null:(0,g.default)("Initializing git repository...").start();try{yield v("git",["init"],B),yield v("git",["add","."],B),yield v("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],B),U=!0,R&&R.succeed("Git repository initialized")}catch(e){R&&R.fail(`Failed to initialize git: ${e.message}`)}}else D||!1===I.git||r||console.log(d.Ay.yellow("\nGit is not installed. Skipping git initialization."));r?console.log(JSON.stringify({success:!0,path:B,files:O.files.length,bunInstalled:L,gitInitialized:U})):(console.log(""),console.log(d.Ay.bold.green("Project initialized successfully!")),console.log(""),console.log(d.Ay.bold("Next steps:")),console.log(d.Ay.gray(` cd ${_}`)),J||console.log(d.Ay.gray(" bun install")),console.log(d.Ay.gray(" bun preview")),console.log(""),console.log(d.Ay.gray(`For more information, see ${_}/README.md`)))}catch(e){r?console.error(JSON.stringify({error:e.message})):S?S.fail(`Failed to initialize project: ${e.message}`):console.error(d.Ay.red(`Failed to initialize project: ${e.message}`)),process.exit(1)}}),function(e,i,t){return o.apply(this,arguments)})}};
|