create-pixi-vn 0.1.2 → 0.1.4
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 +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ Options:
|
|
|
54
54
|
-t, --template NAME use a specific template
|
|
55
55
|
|
|
56
56
|
Available templates:
|
|
57
|
-
${se("basic-visual-novel react")}`,Nt=[{name:"react",display:"Basic Visual Novel",color:Es,variants:[{name:"
|
|
57
|
+
${se("basic-visual-novel react")}`,Nt=[{name:"react",display:"Basic Visual Novel",color:Es,variants:[{name:"react-vite-muijoy",display:"Web page (Vite + React + MUI joy)",color:se}]}],Ae=Nt.map(e=>e.variants&&e.variants.map(t=>t.name)||[e.name]).reduce((e,t)=>e.concat(t),[]),Wr={_gitignore:".gitignore",_eslintrc:".eslintrc"},Ft="pixi-vn-project";async function Ur(){const e=je(et._[0]),t=et.template||et.t;if(et.help){console.log(kr);return}let s=e||Ft;const i=()=>s==="."?P.basename(P.resolve()):s;let n;Re.override({overwrite:et.overwrite});try{n=await Re([{type:e?null:"text",name:"projectName",message:q("Project name:"),initial:Ft,onState:u=>{s=je(u.value)||Ft}},{type:()=>!E.existsSync(s)||Kr(s)?null:"select",name:"overwrite",message:()=>(s==="."?"Current directory":`Target directory "${s}"`)+" is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(u,{overwrite:p})=>{if(p==="no")throw new Error(ee("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>Fe(i())?null:"text",name:"packageName",message:q("Package name:"),initial:()=>zr(i()),validate:u=>Fe(u)||"Invalid package.json name"},{type:t&&Ae.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Ae.includes(t)?q(`"${t}" isn't a valid template. Please choose from below: `):q("Select a framework:"),initial:0,choices:Nt.map(u=>{const p=u.color;return{title:p(u.display||u.name),value:u}})},{type:u=>u&&u.variants?"select":null,name:"variant",message:q("Select a variant:"),choices:u=>u.variants.map(p=>{const S=p.color;return{title:S(p.display||p.name),value:p.name}})}],{onCancel:()=>{throw new Error(ee("\u2716")+" Operation cancelled")}})}catch(u){console.log(u.message);return}const{framework:o,overwrite:r,packageName:l,variant:d}=n,h=P.join(jt,s);r==="yes"?Jr(h):E.existsSync(h)||E.mkdirSync(h,{recursive:!0});let $=d||o?.name||t;const f=qr(process.env.npm_config_user_agent),a=f?f.name:"npm",c=a==="yarn"&&f?.version.startsWith("1."),{customCommand:g}=Nt.flatMap(u=>u.variants).find(u=>u.name===$)??{};if(g){const u=g.replace(/^npm create /,()=>a==="bun"?"bun x create-":`${a} create `).replace("@latest",()=>c?"":"@latest").replace(/^npm exec/,()=>a==="pnpm"?"pnpm dlx":a==="yarn"&&!c?"yarn dlx":a==="bun"?"bun x":"npm exec"),[p,...S]=u.split(" "),m=S.map(C=>C.replace("TARGET_DIR",()=>s)),{status:V}=Ss.sync(p,m,{stdio:"inherit"});process.exit(V??0)}console.log(`
|
|
58
58
|
Scaffolding project in ${h}...`);const y=P.resolve(Ye(import.meta.url),"../..",`template-${$}`),I=(u,p)=>{const S=P.join(h,Wr[u]??u);p?E.writeFileSync(S,p):Ne(P.join(y,u),S)},O=E.readdirSync(y);for(const u of O.filter(p=>p!=="package.json"))I(u);const H=JSON.parse(E.readFileSync(P.join(y,"package.json"),"utf-8"));H.name=l||i(),I("package.json",JSON.stringify(H,null,2)+`
|
|
59
59
|
`);const x=P.relative(jt,h);switch(console.log(`
|
|
60
60
|
Done. Now run:
|