create-qwik 0.23.0-dev20230318180211 → 0.23.0

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.23.0-dev20230318180211
3
+ * create-qwik 0.23.0
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
@@ -91,4 +91,4 @@ ${q("\u251C"+"\u2500".repeat(r+2)+"\u256F")}
91
91
  `+s.trim()+`
92
92
  `;e.files.push({path:D,content:i,type:"modify"})}catch{e.files.push({path:D,content:r,type:"create"})}}async function ee(e,t){let r=(await U()).find(n=>n.id===t.integration);if(!r)throw new Error(`Unable to find integration "${t.integration}"`);let s={files:[],installedDeps:{}};t.installDeps&&(s.installedDeps={...r.pkgJson.dependencies,...r.pkgJson.devDependencies}),await Xu(s,t,r.dir,t.rootDir);let i=async n=>{let c=Object.keys(s.installedDeps).length>0,a=cu();n&&a.start(`Updating app${c?" and installing dependencies":""}...`);let p=!0;try{let l=new Set(s.files.map(C=>(0,qt.dirname)(C.path)));for(let C of Array.from(l))try{ue.default.mkdirSync(C,{recursive:!0})}catch{}let F=Promise.all(s.files.map(async C=>{await ue.default.promises.writeFile(C.path,C.content)}));if(t.installDeps&&Object.keys(s.installedDeps).length>0){let{install:C}=Qu(e,t.rootDir);p=await C}if(await F,n&&a.stop("App updated"),!p){let C=`${tu(` ${e} install failed `)}
93
93
  You might need to run "${x(`${e} install`)}" manually inside the root of the project.`;j.error(C)}}catch(l){n&&a.stop("App updated"),G(String(l))}};return{rootDir:t.rootDir,integration:r,updates:s,commit:i}}async function te(e,t){ir()?t=process.cwd():(t=re(t),X.default.existsSync(t)&&G(`Directory "${t}" already exists. Please either remove this directory, or choose another location.`));let D=R(),s=await uu({starterId:e,outDir:t});return De(D,s,!1),s}function De(e,t,D){let r=process.cwd()===t.outDir,s=(0,T.relative)(process.cwd(),t.outDir),i=[];r?i.push(`\u{1F984} ${Du(" Success! ")}`):i.push(`\u{1F984} ${Du(" Success! ")} ${x("Project created in")} ${Fe(b(s))} ${x("directory")}`),i.push(""),i.push(`\u{1F430} ${x("Next steps:")}`),r||i.push(` cd ${s}`),D||i.push(` ${e} install`),i.push(` ${e} start`),i.push("");let u=e!=="npm"?`${e} qwik add`:"npm run qwik add";return i.push(`\u{1F90D} ${x("Integrations? Add Netlify, Cloudflare, Tailwind...")}`),i.push(` ${u}`),i.push(""),i.push(Mt(t.docs)),i.push(`\u{1F440} ${x("Presentations, Podcasts and Videos:")}`),i.push(" https://qwik.builder.io/media/"),i.push(""),i.join(`
94
- `)}async function uu(e){let t=R();if(!Lt(e.starterId))throw new Error("Missing starter id");if(!Lt(e.outDir))throw new Error("Missing outDir");if(!(0,T.isAbsolute)(e.outDir))throw new Error("outDir must be an absolute path");X.default.existsSync(e.outDir)||X.default.mkdirSync(e.outDir,{recursive:!0});let D={starterId:e.starterId,outDir:e.outDir,docs:[]},r=(await U()).filter(i=>i.type==="app");if(e.starterId==="library"){let i=r.find(u=>u.id==="library");if(!i)throw new Error("Unable to find base app");await Wt(t,D,i)}else{let i=r.find(n=>n.id==="base");if(!i)throw new Error("Unable to find base app");let u=r.find(n=>n.id===e.starterId);if(!u)throw new Error(`Invalid starter id "${e.starterId}". It can only be one of${r.map(n=>` "${n.id}"`)}.`);await Wt(t,D,i,u)}return D}async function Wt(e,t,D,r){t.docs.push(...D.docs);let s=r??D,i=Ot({...D.pkgJson,name:`my-${s.pkgJson.name}`,description:s.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await jt(t.outDir,i);let u=(0,T.join)(t.outDir,"README.md");await X.default.promises.writeFile(u,""),await(await ee(e,{rootDir:t.outDir,integration:D.id,installDeps:!1})).commit(!1),r&&(t.docs.push(...r.docs),await(await ee(e,{rootDir:t.outDir,integration:r.id,installDeps:!1})).commit(!1))}function Lt(e){return typeof e=="string"&&e.trim().length>0}function re(e){return(0,T.resolve)(process.cwd(),e)}function ir(){return nr()}function nr(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Cu=$(require("fs")),hu=require("path");async function se(){Pe(`Let's create a ${de(" Qwik App ")} \u2728 (v0.23.0-dev20230318180211)`),await It(500);let e="./qwik-app",t=await Te({message:"Where would you like to create your new project?",placeholder:e,validate(y){if(y.trim()==="."||y.trim()==="./")return"Please don't use '.' or './' and let qwik create the directory for you."}})||e;M(t)&&(Z("Operation cancelled."),process.exit(0));let D=R(),s=(await U()).filter(y=>y.type==="app"),i=s.find(y=>y.id==="base"),u=s.filter(y=>y.id!==i.id),n=Nt(D,i),c=re(t.trim()),a=null;if(Cu.default.existsSync(c)){let y=await Mu({message:`Directory "./${(0,hu.relative)(process.cwd(),c)}" already exists. What would you like to do?`,options:[{value:"exit",label:"Do not overwrite this directory and exit"},{value:"replace",label:"Overwrite and replace this directory"}]});(M(y)||y==="exit")&&(Z("Operation cancelled."),process.exit(0)),y==="replace"&&(a=Cu.default.promises.rm(c,{recursive:!0}))}let p=await Mu({message:"Select a starter",options:u.map(y=>{var ie;return{label:y.name,value:y.id,hint:(ie=y.pkgJson)==null?void 0:ie.description}})});M(p)&&(Z("Operation cancelled."),process.exit(0));let l=p,F=await Pu({message:`Would you like to install ${D} dependencies?`,initialValue:!0});M(F)&&(Z("Operation cancelled."),process.exit(0));let C=await Pu({message:"Initialize a new git repository?",initialValue:!0});a&&await a;let B=F,P={starterId:l,outDir:c},I=cu();I.start("Creating App...");let mu=await uu(P);if(I.stop("Created App \u{1F430}"),C){if(Cu.default.existsSync((0,hu.join)(c,".git"))){console.log("Git has already been initialized"),console.log("");return}I.start("Git initializing...");try{await z("git",["init"],c).install,await z("git",["add","-A"],c).install,await z("git",["commit","-m","Initial commit \u26A1\uFE0F"],c).install,I.stop("Git initialized \u{1F3B2}")}catch{I.stop("Git failed to initialize"),console.log(""),console.log(O("Git failed to initialize. You can do this manually by running: git init")),console.log("")}}let Eu=!1;return B&&(I.start("Installing dependencies"),Eu=await n.complete(B,mu.outDir),I.stop(`${Eu?"Installed":"Failed to install"} dependencies \u{1F4CB}`)),Pt(De(D,mu,Eu),"Result"),Ru("Happy coding! \u{1F407}"),mu}async function or(){console.clear(),Tt(),ar();try{let e=process.argv.slice(2);e.length>=2?await te(e[0],e[1]):await se()}catch(e){G(e.message||e)}}function ar(){let e=process.version,[t,D]=e.replace("v","").split(".");Number(t)<16?(console.error(O(`Qwik requires Node.js 16.8 or higher. You are currently running Node.js ${e}.`)),process.exit(1)):Number(t)===16?Number(D)<8&&console.warn(he(`Node.js 16.8 or higher is recommended. You are currently running Node.js ${e}.`)):Number(t)===18&&Number(D)<11&&console.error(O(`Node.js 18.11 or higher is REQUIRED. From Node 18.0.0 to 18.11.0, there is a bug preventing correct behaviour of Qwik. You are currently running Node.js ${e}. https://github.com/BuilderIO/qwik/issues/3035`))}0&&(module.exports={createApp,runCli,runCreateCli,runCreateInteractiveCli});
94
+ `)}async function uu(e){let t=R();if(!Lt(e.starterId))throw new Error("Missing starter id");if(!Lt(e.outDir))throw new Error("Missing outDir");if(!(0,T.isAbsolute)(e.outDir))throw new Error("outDir must be an absolute path");X.default.existsSync(e.outDir)||X.default.mkdirSync(e.outDir,{recursive:!0});let D={starterId:e.starterId,outDir:e.outDir,docs:[]},r=(await U()).filter(i=>i.type==="app");if(e.starterId==="library"){let i=r.find(u=>u.id==="library");if(!i)throw new Error("Unable to find base app");await Wt(t,D,i)}else{let i=r.find(n=>n.id==="base");if(!i)throw new Error("Unable to find base app");let u=r.find(n=>n.id===e.starterId);if(!u)throw new Error(`Invalid starter id "${e.starterId}". It can only be one of${r.map(n=>` "${n.id}"`)}.`);await Wt(t,D,i,u)}return D}async function Wt(e,t,D,r){t.docs.push(...D.docs);let s=r??D,i=Ot({...D.pkgJson,name:`my-${s.pkgJson.name}`,description:s.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await jt(t.outDir,i);let u=(0,T.join)(t.outDir,"README.md");await X.default.promises.writeFile(u,""),await(await ee(e,{rootDir:t.outDir,integration:D.id,installDeps:!1})).commit(!1),r&&(t.docs.push(...r.docs),await(await ee(e,{rootDir:t.outDir,integration:r.id,installDeps:!1})).commit(!1))}function Lt(e){return typeof e=="string"&&e.trim().length>0}function re(e){return(0,T.resolve)(process.cwd(),e)}function ir(){return nr()}function nr(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Cu=$(require("fs")),hu=require("path");async function se(){Pe(`Let's create a ${de(" Qwik App ")} \u2728 (v0.23.0)`),await It(500);let e="./qwik-app",t=await Te({message:"Where would you like to create your new project?",placeholder:e,validate(y){if(y.trim()==="."||y.trim()==="./")return"Please don't use '.' or './' and let qwik create the directory for you."}})||e;M(t)&&(Z("Operation cancelled."),process.exit(0));let D=R(),s=(await U()).filter(y=>y.type==="app"),i=s.find(y=>y.id==="base"),u=s.filter(y=>y.id!==i.id),n=Nt(D,i),c=re(t.trim()),a=null;if(Cu.default.existsSync(c)){let y=await Mu({message:`Directory "./${(0,hu.relative)(process.cwd(),c)}" already exists. What would you like to do?`,options:[{value:"exit",label:"Do not overwrite this directory and exit"},{value:"replace",label:"Overwrite and replace this directory"}]});(M(y)||y==="exit")&&(Z("Operation cancelled."),process.exit(0)),y==="replace"&&(a=Cu.default.promises.rm(c,{recursive:!0}))}let p=await Mu({message:"Select a starter",options:u.map(y=>{var ie;return{label:y.name,value:y.id,hint:(ie=y.pkgJson)==null?void 0:ie.description}})});M(p)&&(Z("Operation cancelled."),process.exit(0));let l=p,F=await Pu({message:`Would you like to install ${D} dependencies?`,initialValue:!0});M(F)&&(Z("Operation cancelled."),process.exit(0));let C=await Pu({message:"Initialize a new git repository?",initialValue:!0});a&&await a;let B=F,P={starterId:l,outDir:c},I=cu();I.start("Creating App...");let mu=await uu(P);if(I.stop("Created App \u{1F430}"),C){if(Cu.default.existsSync((0,hu.join)(c,".git"))){console.log("Git has already been initialized"),console.log("");return}I.start("Git initializing...");try{await z("git",["init"],c).install,await z("git",["add","-A"],c).install,await z("git",["commit","-m","Initial commit \u26A1\uFE0F"],c).install,I.stop("Git initialized \u{1F3B2}")}catch{I.stop("Git failed to initialize"),console.log(""),console.log(O("Git failed to initialize. You can do this manually by running: git init")),console.log("")}}let Eu=!1;return B&&(I.start("Installing dependencies"),Eu=await n.complete(B,mu.outDir),I.stop(`${Eu?"Installed":"Failed to install"} dependencies \u{1F4CB}`)),Pt(De(D,mu,Eu),"Result"),Ru("Happy coding! \u{1F407}"),mu}async function or(){console.clear(),Tt(),ar();try{let e=process.argv.slice(2);e.length>=2?await te(e[0],e[1]):await se()}catch(e){G(e.message||e)}}function ar(){let e=process.version,[t,D]=e.replace("v","").split(".");Number(t)<16?(console.error(O(`Qwik requires Node.js 16.8 or higher. You are currently running Node.js ${e}.`)),process.exit(1)):Number(t)===16?Number(D)<8&&console.warn(he(`Node.js 16.8 or higher is recommended. You are currently running Node.js ${e}.`)):Number(t)===18&&Number(D)<11&&console.error(O(`Node.js 18.11 or higher is REQUIRED. From Node 18.0.0 to 18.11.0, there is a bug preventing correct behaviour of Qwik. You are currently running Node.js ${e}. https://github.com/BuilderIO/qwik/issues/3035`))}0&&(module.exports={createApp,runCli,runCreateCli,runCreateInteractiveCli});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-qwik",
3
- "version": "0.23.0-dev20230318180211",
3
+ "version": "0.23.0",
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.23.0-dev20230318180211",
20
- "@builder.io/qwik-city": "0.6.4",
19
+ "@builder.io/qwik": "0.23.0",
20
+ "@builder.io/qwik-city": "0.6.5",
21
21
  "@types/eslint": "8.21.2",
22
22
  "@types/node": "^18.15.3",
23
23
  "@typescript-eslint/eslint-plugin": "5.55.0",
24
24
  "@typescript-eslint/parser": "5.55.0",
25
- "eslint-plugin-qwik": "0.23.0-dev20230318180211",
25
+ "eslint-plugin-qwik": "0.23.0",
26
26
  "eslint": "8.36.0",
27
27
  "undici": "5.21.0",
28
28
  "prettier": "2.8.4",