create-qwik 0.11.0 → 0.11.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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * create-qwik 0.11.0
3
+ * create-qwik 0.11.1
4
4
  * Copyright Builder.io, Inc. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
@@ -115,7 +115,7 @@ Filtered results for: ${this.inputValue?this.inputValue:we.gray("Enter something
115
115
  `+i,s="modify"}catch{n=i,s="create"}_e()==="yarn"&&(n=n.replace(/npm run/g,"yarn")),t.files.push({path:r,content:n.trim()+`
116
116
  `,type:s})}async function jp(t,e,r){let i=await V.default.promises.readFile(e,"utf-8");try{let s=await V.default.promises.readFile(r,"utf-8"),n=i.trim().split(/\r?\n/),o=s.trim().split(/\r?\n/);for(let a of n)o.includes(a)||(a.startsWith("#")&&o.push(""),o.push(a));t.files.push({path:r,content:o.join(`
117
117
  `).trim()+`
118
- `,type:"modify"})}catch{t.files.push({path:r,content:i,type:"create"})}}async function Ki(t){let r=(await Ye()).find(o=>o.id===t.integration);if(!r)throw new Error(`Unable to find integration "${t.integration}"`);let i={files:[],installedDeps:{}};t.installDeps&&(i.installedDeps={...r.pkgJson.dependencies,...r.pkgJson.devDependencies}),await Yi(i,t,r.dir,t.rootDir);let s=async o=>{let a=Object.keys(i.installedDeps).length>0,l=o?Gi(`Updating app${a?" and installing dependencies":""}...`):null;try{let u=new Set(i.files.map(f=>(0,rl.dirname)(f.path)));for(let f of Array.from(u))try{Ji.default.mkdirSync(f,{recursive:!0})}catch{}let p=Promise.all(i.files.map(async f=>{await Ji.default.promises.writeFile(f.path,f.content)}));if(t.installDeps&&Object.keys(i.installedDeps).length>0){let f=_e(),{install:d}=Wi(f,t.rootDir);await d}await p,l&&l.succeed()}catch(u){l&&l.fail(),Ve(String(u))}};return{rootDir:t.rootDir,integration:r,updates:i,commit:s}}async function zi(t,e){$p()?e=process.cwd():(e=Xi(e),kt.default.existsSync(e)&&Ve(`Directory "${e}" already exists. Please either remove this directory, or choose another location.`));let i=await jt({starterId:t,outDir:e});return Zi(i,!1),i}function Zi(t,e){console.log(""),console.clear(),console.log("");let r=process.cwd()===t.outDir,i=(0,De.relative)(process.cwd(),t.outDir);console.log(r?`\u{1F984} ${y.bgMagenta(" Success! ")}`:`\u{1F984} ${y.bgMagenta(" Success! ")} ${y.cyan("Project created in")} ${y.bold(y.magenta(i))} ${y.cyan("directory")}`),console.log(""),console.log(`\u{1F430} ${y.cyan("Next steps:")}`),r||console.log(` cd ${i}`);let s=_e();e||console.log(` ${s} install`),console.log(` ${s} start`),console.log(""),On()}async function jt(t){if(!sl(t.starterId))throw new Error("Missing starter id");if(!sl(t.outDir))throw new Error("Missing outDir");if(!(0,De.isAbsolute)(t.outDir))throw new Error("outDir must be an absolute path");kt.default.existsSync(t.outDir)||kt.default.mkdirSync(t.outDir,{recursive:!0});let e={starterId:t.starterId,outDir:t.outDir},r=(await Ye()).filter(s=>s.type==="app");if(t.starterId==="library"){let s=r.find(n=>n.id==="library");if(!s)throw new Error("Unable to find base app");await il(e,s)}else{let s=r.find(o=>o.id==="base");if(!s)throw new Error("Unable to find base app");let n=r.find(o=>o.id===t.starterId);if(!n)throw new Error(`Invalid starter id "${t.starterId}"`);await il(e,s,n)}return e}async function il(t,e,r){let i=r??e,s=En({...e.pkgJson,name:`my-${i.pkgJson.name}`,description:i.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await Sn(t.outDir,s);let n=(0,De.join)(t.outDir,"README.md");await kt.default.promises.writeFile(n,""),await(await Ki({rootDir:t.outDir,integration:e.id,installDeps:!1})).commit(!1),r&&await(await Ki({rootDir:t.outDir,integration:r.id,installDeps:!1})).commit(!1)}function sl(t){return typeof t=="string"&&t.trim().length>0}function Xi(t){return(0,De.resolve)(process.cwd(),t)}function $p(){return Lp()}function Lp(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var un=M(require("fs")),kc=require("path"),Jt=M(Pc());async function hn(){H0(),console.log(""),console.clear(),console.log(""),console.log(`\u{1F430} ${y.cyan("Let's create a")} ${y.bold(y.magenta("Qwik"))} ${y.cyan("app")} \u{1F407} ${y.dim("v0.11.0")}`),console.log("");let t=_e(),r=(await Ye()).filter(x=>x.type==="app"),i=r.find(x=>x.id==="base"),s=r.filter(x=>x.id!==i.id),n=tl(t,i),o=await(0,Jt.default)({type:"text",name:"outDir",message:"Where would you like to create your new project?",initial:"./qwik-app"},{onCancel:()=>{console.log(""),process.exit(1)}});console.log("");let a=Xi(o.outDir.trim()),l=null;if(un.default.existsSync(a)){let x=await(0,Jt.default)({type:"select",name:"outDirChoice",message:`Directory "./${(0,kc.relative)(process.cwd(),a)}" already exists. What would you like to do?`,choices:[{title:"Do not overwrite this directory and exit",value:"exit"},{title:"Overwrite and replace this directory",value:"replace"}],hint:"(use \u2193\u2191 arrows, hit enter)"},{onCancel:async()=>{console.log(y.dim(` - Exited without modifying "${a}"`)+`
118
+ `,type:"modify"})}catch{t.files.push({path:r,content:i,type:"create"})}}async function Ki(t){let r=(await Ye()).find(o=>o.id===t.integration);if(!r)throw new Error(`Unable to find integration "${t.integration}"`);let i={files:[],installedDeps:{}};t.installDeps&&(i.installedDeps={...r.pkgJson.dependencies,...r.pkgJson.devDependencies}),await Yi(i,t,r.dir,t.rootDir);let s=async o=>{let a=Object.keys(i.installedDeps).length>0,l=o?Gi(`Updating app${a?" and installing dependencies":""}...`):null;try{let u=new Set(i.files.map(f=>(0,rl.dirname)(f.path)));for(let f of Array.from(u))try{Ji.default.mkdirSync(f,{recursive:!0})}catch{}let p=Promise.all(i.files.map(async f=>{await Ji.default.promises.writeFile(f.path,f.content)}));if(t.installDeps&&Object.keys(i.installedDeps).length>0){let f=_e(),{install:d}=Wi(f,t.rootDir);await d}await p,l&&l.succeed()}catch(u){l&&l.fail(),Ve(String(u))}};return{rootDir:t.rootDir,integration:r,updates:i,commit:s}}async function zi(t,e){$p()?e=process.cwd():(e=Xi(e),kt.default.existsSync(e)&&Ve(`Directory "${e}" already exists. Please either remove this directory, or choose another location.`));let i=await jt({starterId:t,outDir:e});return Zi(i,!1),i}function Zi(t,e){console.log(""),console.clear(),console.log("");let r=process.cwd()===t.outDir,i=(0,De.relative)(process.cwd(),t.outDir);console.log(r?`\u{1F984} ${y.bgMagenta(" Success! ")}`:`\u{1F984} ${y.bgMagenta(" Success! ")} ${y.cyan("Project created in")} ${y.bold(y.magenta(i))} ${y.cyan("directory")}`),console.log(""),console.log(`\u{1F430} ${y.cyan("Next steps:")}`),r||console.log(` cd ${i}`);let s=_e();e||console.log(` ${s} install`),console.log(` ${s} start`),console.log(""),On()}async function jt(t){if(!sl(t.starterId))throw new Error("Missing starter id");if(!sl(t.outDir))throw new Error("Missing outDir");if(!(0,De.isAbsolute)(t.outDir))throw new Error("outDir must be an absolute path");kt.default.existsSync(t.outDir)||kt.default.mkdirSync(t.outDir,{recursive:!0});let e={starterId:t.starterId,outDir:t.outDir},r=(await Ye()).filter(s=>s.type==="app");if(t.starterId==="library"){let s=r.find(n=>n.id==="library");if(!s)throw new Error("Unable to find base app");await il(e,s)}else{let s=r.find(o=>o.id==="base");if(!s)throw new Error("Unable to find base app");let n=r.find(o=>o.id===t.starterId);if(!n)throw new Error(`Invalid starter id "${t.starterId}". It can only be one of${r.map(o=>` "${o.id}"`)}.`);await il(e,s,n)}return e}async function il(t,e,r){let i=r??e,s=En({...e.pkgJson,name:`my-${i.pkgJson.name}`,description:i.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await Sn(t.outDir,s);let n=(0,De.join)(t.outDir,"README.md");await kt.default.promises.writeFile(n,""),await(await Ki({rootDir:t.outDir,integration:e.id,installDeps:!1})).commit(!1),r&&await(await Ki({rootDir:t.outDir,integration:r.id,installDeps:!1})).commit(!1)}function sl(t){return typeof t=="string"&&t.trim().length>0}function Xi(t){return(0,De.resolve)(process.cwd(),t)}function $p(){return Lp()}function Lp(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var un=M(require("fs")),kc=require("path"),Jt=M(Pc());async function hn(){H0(),console.log(""),console.clear(),console.log(""),console.log(`\u{1F430} ${y.cyan("Let's create a")} ${y.bold(y.magenta("Qwik"))} ${y.cyan("app")} \u{1F407} ${y.dim("v0.11.1")}`),console.log("");let t=_e(),r=(await Ye()).filter(x=>x.type==="app"),i=r.find(x=>x.id==="base"),s=r.filter(x=>x.id!==i.id),n=tl(t,i),o=await(0,Jt.default)({type:"text",name:"outDir",message:"Where would you like to create your new project?",initial:"./qwik-app"},{onCancel:()=>{console.log(""),process.exit(1)}});console.log("");let a=Xi(o.outDir.trim()),l=null;if(un.default.existsSync(a)){let x=await(0,Jt.default)({type:"select",name:"outDirChoice",message:`Directory "./${(0,kc.relative)(process.cwd(),a)}" already exists. What would you like to do?`,choices:[{title:"Do not overwrite this directory and exit",value:"exit"},{title:"Overwrite and replace this directory",value:"replace"}],hint:"(use \u2193\u2191 arrows, hit enter)"},{onCancel:async()=>{console.log(y.dim(` - Exited without modifying "${a}"`)+`
119
119
  `),await n.abort(),process.exit(1)}});console.log(""),x.outDirChoice==="replace"?l=un.default.promises.rm(a,{recursive:!0}):(console.log(y.dim(` - Exited without modifying "${a}"`)+`
120
120
  `),await n.abort(),process.exit(1))}let u=await(0,Jt.default)({type:"select",name:"starterId",message:"Select a starter",choices:s.map(x=>{var v;return{title:x.name,value:x.id,description:(v=x.pkgJson)==null?void 0:v.description}}),hint:"(use \u2193\u2191 arrows, hit enter)"},{onCancel:async()=>{console.log(""),await n.abort(),process.exit(1)}});console.log("");let p=u.starterId,f=await(0,Jt.default)({type:"confirm",name:"runInstall",message:`Would you like to install ${t} dependencies?`,initial:!0},{onCancel:async()=>{console.log(""),await n.abort(),process.exit(1)}});console.log(""),l&&await l;let d=f.runInstall,S=await jt({starterId:p,outDir:a}),b=await n.complete(d,S.outDir);return Zi(S,b),S}function H0(){let t=process.version;Number(t.replace("v","").split(".")[0])<16&&(console.error(y.red(`Qwik requires Node.js 16 or higher. You are currently running Node.js ${t}.`)),process.exit(1))}async function W0(){try{let t=process.argv.slice(2);t.length>=2?await zi(t[0],t[1]):await hn()}catch(t){Ve(t.message||t)}}0&&(module.exports={createApp,runCli,runCreateCli,runCreateInteractiveCli});
121
121
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-qwik",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Interactive CLI for create Qwik projects and adding features.",
5
5
  "bin": "./create-qwik.cjs",
6
6
  "main": "./index.cjs",
@@ -15,13 +15,13 @@
15
15
  "qwik": "qwik"
16
16
  },
17
17
  "devDependencies": {
18
- "@builder.io/qwik": "0.11.0",
18
+ "@builder.io/qwik": "0.11.1",
19
19
  "@builder.io/qwik-city": "0.0.112",
20
20
  "@types/eslint": "8.4.6",
21
21
  "@types/node": "latest",
22
22
  "@typescript-eslint/eslint-plugin": "5.40.0",
23
23
  "@typescript-eslint/parser": "5.40.0",
24
- "eslint-plugin-qwik": "0.11.0",
24
+ "eslint-plugin-qwik": "0.11.1",
25
25
  "eslint": "8.25.0",
26
26
  "node-fetch": "3.2.10",
27
27
  "prettier": "2.7.1",
@@ -32,7 +32,7 @@
32
32
  "release": "np"
33
33
  },
34
34
  "devDependencies": {
35
- "@builder.io/qwik": "0.11.0",
35
+ "@builder.io/qwik": "0.11.1",
36
36
  "@types/eslint": "8.4.6",
37
37
  "@types/node": "latest",
38
38
  "@typescript-eslint/eslint-plugin": "5.40.0",