Skip to content

Commit

Permalink
fix: windows fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adamberecz committed May 7, 2024
1 parent 4e17375 commit 7405063
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## v1.0.7 - v1.0.10
## v1.0.7 - v1.0.11

> `2024-05-07`
Expand Down
2 changes: 1 addition & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ Installing Vue...`),await z("npm",["install","@vitejs/plugin-vue"],"install Vue
Installing Vueform${n?" Builder":""}...`),await z("npm",["install",...f.split(" ")],`install ${f}`),await Pl(c,u),n&&await El(process.cwd(),s),console.log(dl(`
\u2714 Installation finished`)),console.log(Te(`
cd ${e}`)),console.log(Te(`${Tt} run dev
`)),pl&&(a?(await z("npm",["run","build"]),await z("php",["artisan","serve"])):await z("npm",["run","dev"]))}catch(e){console.log(Ot(e.message));return}}function vl(e){return cr.find(t=>t.value===e)}function bl(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}function z(e,t,i=""){return e==="npm"&&(e=["npm","yarn","pnpm","bun"].indexOf(Tt)!==-1?Tt:"npm",t[0]==="install"&&t.length>1&&["yarn","pnpm"].indexOf(Tt)!==-1&&(t=[...t],t[0]="add")),/^win/.test(process.platform)&&(e==="rm"?(e="rmdir",t=["/s","/q",...t.slice(1)]):e+=".cmd"),new Promise((r,s)=>{const n=$r(e,t,{stdio:"inherit",shell:!0});n.on("close",o=>{o!==0?s(new Error(`${e} exited with code ${o}`)):r()}),n.on("error",o=>{s(new Error(`Failed to ${i||"start process"}: ${o.message}`))})})}function Qt(e){return console.log(Te(e))}async function ur(e){try{return(await mr.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Sl(e,t,i){switch(t){case"nuxt":return!0;case"astro":const r=A.join(e,"tsconfig.json");try{return(await ot.readJson(r)).extends!=="astro/tsconfigs/base"}catch(s){throw new Error(`Error reading tsconfig.json: ${s.message}`)}break;case"laravel":return!1;default:return i}}async function $l(e){const t=A.join(e,"tsconfig.json");try{const i=await ot.readJson(t);i.compilerOptions={jsx:"preserve"},await ot.writeJson(t,i,{spaces:2})}catch(i){throw new Error(`Error updating tsconfig.json: ${i.message}`)}}async function El(e,t){const i=A.join(e,"vueform.config.js"),r=A.join(e,"vueform.config.ts");let s;try{if(await ot.pathExists(i))s=i;else if(await ot.pathExists(r))s=r;else throw new Error(`No vueform.config.js or vueform.config.ts file found: ${err.message}`)}catch(n){throw new Error(`Error checking for config files: ${n.message}`)}try{let n=await ot.readFile(s,"utf8");n=n.replace(/YOUR_PUBLIC_KEY/g,t),await ot.writeFile(s,n,"utf8")}catch(n){throw new Error(`Error inserting Public Key to ${A.basename(s)}: ${n.message}`)}}async function Pl(e,t){try{await ot.copy(e,t,{overwrite:!0})}catch(i){throw new Error(`Error copying files: ${i.message}`)}}async function xl(){const e=["/usr/local/bin/composer","/usr/local/bin/composer.phar","/usr/bin/composer","/usr/bin/composer.phar","C:\\ProgramData\\ComposerSetup\\bin\\composer","C:\\ProgramData\\ComposerSetup\\bin\\composer.phar","C:\\Program Files\\Composer\\composer.phar","C:\\Program Files\\Composer\\composer"];let t="composer";try{return await fl("composer --version"),t}catch{t=""}if(e.forEach(i=>{ot.existsSync(i)&&(t=i)}),t.endsWith(".phar")&&(t=`php ${t}`),!t)throw console.error(Ot(`
`)),pl&&(a?(await z("npm",["run","build"]),await z("php",["artisan","serve"])):await z("npm",["run","dev"]))}catch(e){console.log(Ot(e.message));return}}function vl(e){return cr.find(t=>t.value===e)}function bl(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}function z(e,t,i=""){return e==="npm"&&(e=["npm","yarn","pnpm","bun"].indexOf(Tt)!==-1?Tt:"npm",t[0]==="install"&&t.length>1&&["yarn","pnpm"].indexOf(Tt)!==-1&&(t=[...t],t[0]="add")),/^win/.test(process.platform)&&e==="rm"&&(e="rmdir",t=["/s","/q",...t.slice(1)]),new Promise((r,s)=>{const n=$r(e,t,{stdio:"inherit",shell:!0});n.on("close",o=>{o!==0?s(new Error(`${e} exited with code ${o}`)):r()}),n.on("error",o=>{s(new Error(`Failed to ${i||"start process"}: ${o.message}`))})})}function Qt(e){return console.log(Te(e))}async function ur(e){try{return(await mr.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Sl(e,t,i){switch(t){case"nuxt":return!0;case"astro":const r=A.join(e,"tsconfig.json");try{return(await ot.readJson(r)).extends!=="astro/tsconfigs/base"}catch(s){throw new Error(`Error reading tsconfig.json: ${s.message}`)}break;case"laravel":return!1;default:return i}}async function $l(e){const t=A.join(e,"tsconfig.json");try{const i=await ot.readJson(t);i.compilerOptions={jsx:"preserve"},await ot.writeJson(t,i,{spaces:2})}catch(i){throw new Error(`Error updating tsconfig.json: ${i.message}`)}}async function El(e,t){const i=A.join(e,"vueform.config.js"),r=A.join(e,"vueform.config.ts");let s;try{if(await ot.pathExists(i))s=i;else if(await ot.pathExists(r))s=r;else throw new Error(`No vueform.config.js or vueform.config.ts file found: ${err.message}`)}catch(n){throw new Error(`Error checking for config files: ${n.message}`)}try{let n=await ot.readFile(s,"utf8");n=n.replace(/YOUR_PUBLIC_KEY/g,t),await ot.writeFile(s,n,"utf8")}catch(n){throw new Error(`Error inserting Public Key to ${A.basename(s)}: ${n.message}`)}}async function Pl(e,t){try{await ot.copy(e,t,{overwrite:!0})}catch(i){throw new Error(`Error copying files: ${i.message}`)}}async function xl(){const e=["/usr/local/bin/composer","/usr/local/bin/composer.phar","/usr/bin/composer","/usr/bin/composer.phar","C:\\ProgramData\\ComposerSetup\\bin\\composer","C:\\ProgramData\\ComposerSetup\\bin\\composer.phar","C:\\Program Files\\Composer\\composer.phar","C:\\Program Files\\Composer\\composer"];let t="composer";try{return await fl("composer --version"),t}catch{t=""}if(e.forEach(i=>{ot.existsSync(i)&&(t=i)}),t.endsWith(".phar")&&(t=`php ${t}`),!t)throw console.error(Ot(`
Composer not found. Please ensure Composer is installed and added to your PATH.`)),console.error(Ot(`Visit https://getcomposer.org/download/ for installation instructions.
`)),new Error(Ot("\u2716")+" Operation cancelled");return t}function Ol(){const e=process.version.replace("v",""),t=Sr("npm -v").toString().trim();hr(e,sr)<0&&(console.error(`Error: Minimum Node.js version required is ${sr}. Your current version is ${e}. Please upgrade Node.js.`),process.exit(1)),hr(t,nr)<0&&(console.error(`Error: Minimum npm version required is ${nr}. Your current version is ${t}. Please upgrade npm.`),process.exit(1))}function hr(e,t){const i=e.split(".").map(Number),r=t.split(".").map(Number);for(let s=0;s<3;s++)if(i[s]!==r[s])return i[s]-r[s];return 0}gl();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-vueform",
"version": "1.0.10",
"version": "1.0.11",
"type": "module",
"license": "MIT",
"author": "Adam Berecz",
Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,6 @@ function runCommand(command, args, name = '') {
'/q',
...args.slice(1)
]
} else {
command += '.cmd'
}
}

Expand Down

0 comments on commit 7405063

Please sign in to comment.