create-qwik 0.12.0-dev20221021194131 → 0.12.0-dev20221021220048

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.12.0-dev20221021194131
3
+ * create-qwik 0.12.0-dev20221021220048
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
@@ -118,7 +118,7 @@ You might need to run "${g.green(`${t} install`)}" manually inside the root of y
118
118
  `+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()+`
119
119
  `,type:s})}async function $p(t,e,r){let i=await Y.default.promises.readFile(e,"utf-8");try{let s=await Y.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(`
120
120
  `).trim()+`
121
- `,type:"modify"})}catch{t.files.push({path:r,content:i,type:"create"})}}async function Ki(t){let r=(await Ve()).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 Vi(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(),Ye(String(u))}};return{rootDir:t.rootDir,integration:r,updates:i,commit:s}}async function zi(t,e){jp()?e=process.cwd():(e=Xi(e),kt.default.existsSync(e)&&Ye(`Directory "${e}" already exists. Please either remove this directory, or choose another location.`));let i=await $t({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} ${g.bgMagenta(" Success! ")}`:`\u{1F984} ${g.bgMagenta(" Success! ")} ${g.cyan("Project created in")} ${g.bold(g.magenta(i))} ${g.cyan("directory")}`),console.log(""),console.log(`\u{1F430} ${g.cyan("Next steps:")}`),r||console.log(` cd ${i}`);let s=_e();e||console.log(` ${s} install`),console.log(` ${s} start`),console.log("");let n=s==="yarn"?"yarn qwik add":`${s} run qwik add`;console.log(`\u{1F50C} ${g.cyan("Integrations? Add Netlify, Cloudflare, Tailwind...")}`),console.log(` ${n}`),console.log(""),On(t.docs),console.log(`\u{1F4FA} ${g.cyan("Presentations, Podcasts and Videos:")}`),console.log(" https://qwik.builder.io/media/"),console.log("")}async function $t(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,docs:[]},r=(await Ve()).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){t.docs.push(...e.docs);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&&(t.docs.push(...r.docs),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 jp(){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} ${g.cyan("Let's create a")} ${g.bold(g.magenta("Qwik"))} ${g.cyan("app")} \u{1F407} ${g.dim("v0.12.0-dev20221021194131")}`),console.log("");let t=_e(),r=(await Ve()).filter(S=>S.type==="app"),i=r.find(S=>S.id==="base"),s=r.filter(S=>S.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 S=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(g.dim(` - Exited without modifying "${a}"`)+`
121
+ `,type:"modify"})}catch{t.files.push({path:r,content:i,type:"create"})}}async function Ki(t){let r=(await Ve()).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 Vi(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(),Ye(String(u))}};return{rootDir:t.rootDir,integration:r,updates:i,commit:s}}async function zi(t,e){jp()?e=process.cwd():(e=Xi(e),kt.default.existsSync(e)&&Ye(`Directory "${e}" already exists. Please either remove this directory, or choose another location.`));let i=await $t({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} ${g.bgMagenta(" Success! ")}`:`\u{1F984} ${g.bgMagenta(" Success! ")} ${g.cyan("Project created in")} ${g.bold(g.magenta(i))} ${g.cyan("directory")}`),console.log(""),console.log(`\u{1F430} ${g.cyan("Next steps:")}`),r||console.log(` cd ${i}`);let s=_e();e||console.log(` ${s} install`),console.log(` ${s} start`),console.log("");let n=s==="yarn"?"yarn qwik add":`${s} run qwik add`;console.log(`\u{1F50C} ${g.cyan("Integrations? Add Netlify, Cloudflare, Tailwind...")}`),console.log(` ${n}`),console.log(""),On(t.docs),console.log(`\u{1F4FA} ${g.cyan("Presentations, Podcasts and Videos:")}`),console.log(" https://qwik.builder.io/media/"),console.log("")}async function $t(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,docs:[]},r=(await Ve()).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){t.docs.push(...e.docs);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&&(t.docs.push(...r.docs),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 jp(){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} ${g.cyan("Let's create a")} ${g.bold(g.magenta("Qwik"))} ${g.cyan("app")} \u{1F407} ${g.dim("v0.12.0-dev20221021220048")}`),console.log("");let t=_e(),r=(await Ve()).filter(S=>S.type==="app"),i=r.find(S=>S.id==="base"),s=r.filter(S=>S.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 S=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(g.dim(` - Exited without modifying "${a}"`)+`
122
122
  `),await n.abort(),process.exit(1)}});console.log(""),S.outDirChoice==="replace"?l=un.default.promises.rm(a,{recursive:!0}):(console.log(g.dim(` - Exited without modifying "${a}"`)+`
123
123
  `),await n.abort(),process.exit(1))}let u=await(0,Jt.default)({type:"select",name:"starterId",message:"Select a starter",choices:s.map(S=>{var v;return{title:S.name,value:S.id,description:"\u2514\u2500"+((v=S.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,y=await $t({starterId:p,outDir:a}),m=await n.complete(d,y.outDir);return Zi(y,m),y}function H0(){let t=process.version;Number(t.replace("v","").split(".")[0])<16&&(console.error(g.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){Ye(t.message||t)}}0&&(module.exports={createApp,runCli,runCreateCli,runCreateInteractiveCli});
124
124
  /*! 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.12.0-dev20221021194131",
3
+ "version": "0.12.0-dev20221021220048",
4
4
  "description": "Interactive CLI for create Qwik projects and adding features.",
5
5
  "bin": "./create-qwik.cjs",
6
6
  "main": "./index.cjs",
@@ -16,13 +16,13 @@
16
16
  "qwik": "qwik"
17
17
  },
18
18
  "devDependencies": {
19
- "@builder.io/qwik": "0.12.0-dev20221021194131",
20
- "@builder.io/qwik-city": "0.0.116",
19
+ "@builder.io/qwik": "0.12.0-dev20221021220048",
20
+ "@builder.io/qwik-city": "0.0.117",
21
21
  "@types/eslint": "8.4.6",
22
22
  "@types/node": "latest",
23
23
  "@typescript-eslint/eslint-plugin": "5.40.1",
24
24
  "@typescript-eslint/parser": "5.40.1",
25
- "eslint-plugin-qwik": "0.12.0-dev20221021194131",
25
+ "eslint-plugin-qwik": "0.12.0-dev20221021220048",
26
26
  "eslint": "8.25.0",
27
27
  "node-fetch": "3.2.10",
28
28
  "prettier": "2.7.1",