create-qwik 0.12.0-dev20221021220048 → 0.12.0-dev20221024094026
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 +5 -3
- package/package.json +1 -1
- package/starters/apps/base/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* create-qwik 0.12.0-
|
|
3
|
+
* create-qwik 0.12.0-dev20221024094026
|
|
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
|
|
@@ -108,9 +108,11 @@ Filtered results for: ${this.inputValue?this.inputValue:we.gray("Enter something
|
|
|
108
108
|
`))w(this,Ue,c(this,Ue)+Math.max(1,Math.ceil((0,ha.default)(i)/e)))}get isEnabled(){return c(this,te)&&!c(this,re)}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");w(this,te,e)}get isSilent(){return c(this,re)}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");w(this,re,e)}frame(){let{frames:e}=c(this,ee),r=e[c(this,de)];this.color&&(r=g[this.color](r)),w(this,de,++bt(this,de)._%e.length);let i=typeof c(this,J)=="string"&&c(this,J)!==""?c(this,J)+" ":"",s=typeof this.text=="string"?" "+this.text:"";return i+r+s}clear(){if(!c(this,te)||!c(this,L).isTTY)return this;c(this,L).cursorTo(0);for(let e=0;e<c(this,Ce);e++)e>0&&c(this,L).moveCursor(0,-1),c(this,L).clearLine(1);return(c(this,ie)||this.lastIndent!==c(this,ie))&&c(this,L).cursorTo(c(this,ie)),this.lastIndent=c(this,ie),w(this,Ce,0),this}render(){return c(this,re)?this:(this.clear(),c(this,L).write(this.frame()),w(this,Ce,c(this,Ue)),this)}start(e){return e&&(this.text=e),c(this,re)?this:c(this,te)?this.isSpinning?this:(c(this,$).hideCursor&&Zr.hide(c(this,L)),c(this,$).discardStdin&&It.default.stdin.isTTY&&(w(this,it,!0),Sr.start()),this.render(),w(this,He,setInterval(this.render.bind(this),this.interval)),this):(this.text&&c(this,L).write(`- ${this.text}
|
|
109
109
|
`),this)}stop(){return c(this,te)?(clearInterval(c(this,He)),w(this,He,void 0),w(this,de,0),this.clear(),c(this,$).hideCursor&&Zr.show(c(this,L)),c(this,$).discardStdin&&It.default.stdin.isTTY&&c(this,it)&&(Sr.stop(),w(this,it,!1)),this):this}succeed(e){return this.stopAndPersist({symbol:wt.success,text:e})}fail(e){return this.stopAndPersist({symbol:wt.error,text:e})}warn(e){return this.stopAndPersist({symbol:wt.warning,text:e})}info(e){return this.stopAndPersist({symbol:wt.info,text:e})}stopAndPersist(e={}){if(c(this,re))return this;let r=e.prefixText||c(this,J),i=e.text||this.text,s=typeof i=="string"?" "+i:"";return this.stop(),c(this,L).write(`${this.getFullPrefixText(r," ")}${e.symbol||" "}${s}
|
|
110
110
|
`),this}};Ce=new WeakMap,it=new WeakMap,Ue=new WeakMap,de=new WeakMap,$=new WeakMap,ee=new WeakMap,L=new WeakMap,He=new WeakMap,st=new WeakMap,te=new WeakMap,re=new WeakMap,ie=new WeakMap,nt=new WeakMap,J=new WeakMap;function Pi(t){return new Ii(t)}var Qa=M(require("os"),1),se=M(require("path"),1),el=M(Xa(),1);function Wi(t,e){let r,i=`
|
|
111
|
+
|
|
111
112
|
${g.bgRed(` ${t} install failed `)}
|
|
112
113
|
|
|
113
|
-
You might need to run "${g.green(`${t} install`)}" manually inside the root of your project to install the dependencies
|
|
114
|
+
You might need to run "${g.green(`${t} install`)}" manually inside the root of your project to install the dependencies.
|
|
115
|
+
`,s=new Promise(o=>{try{r=(0,el.default)(t,["install"],{cwd:e,stdio:"ignore"}),r.on("error",()=>{console.error(i),o()}),r.on("close",a=>{a===0||console.error(i),o()})}catch{console.error(i),o()}});return{abort:async()=>{r&&r.kill("SIGINT")},install:s}}function Gi(t){return Pi(t).start()}function tl(t,e){let{tmpInstallDir:r}=qp(e),{install:i,abort:s}=Wi(t,r);return{abort:s,complete:async(o,a)=>{let l=!1;if(o){let u=Gi(`Installing ${t} dependencies...`);try{await i;let p=se.default.join(r,"node_modules"),f=se.default.join(a,"node_modules");await lt.default.promises.rename(p,f);try{await lt.default.promises.rename(se.default.join(r,"package-lock.json"),se.default.join(a,"package-lock.json"))}catch{}try{await lt.default.promises.rename(se.default.join(r,"yarn.lock"),se.default.join(a,"yarn.lock"))}catch{}u.succeed(),l=!0}catch{u.fail()}}else await s();return l}}}function qp(t){let e="create-qwik-"+Math.round(Math.random()*Number.MAX_SAFE_INTEGER).toString(36).toLowerCase(),r=se.default.join(Qa.default.tmpdir(),e);try{lt.default.mkdirSync(r)}catch(n){console.error(`
|
|
114
116
|
\u274C ${g.red(String(n))}
|
|
115
117
|
`)}let i=se.default.join(t.dir,"package.json"),s=se.default.join(r,"package.json");return lt.default.copyFileSync(i,s),{tmpInstallDir:r}}var Y=M(require("fs"),1),Yi=require("path");async function Vi(t,e,r,i){let s=await Y.default.promises.readdir(r);await Promise.all(s.map(async n=>{let o=n==="gitignore"?".gitignore":n,a=(0,Yi.join)(r,n),l=(0,Yi.join)(i,o),u=await Y.default.promises.stat(a);u.isDirectory()?await Vi(t,e,a,l):u.isFile()&&(o==="package.json"?await Ip(t,a,l):o==="README.md"?await kp(t,a,l):o===".gitignore"?await $p(t,a,l):Y.default.existsSync(l)?t.files.push({path:l,content:await Y.default.promises.readFile(a,"utf-8"),type:"overwrite"}):t.files.push({path:l,content:await Y.default.promises.readFile(a),type:"create"}))}))}async function Ip(t,e,r){var o;let i=await Y.default.promises.readFile(e,"utf-8"),s=JSON.parse(i),n=["scripts","dependencies","devDependencies"];try{let a=JSON.parse(await Y.default.promises.readFile(r,"utf-8"));if(n.forEach(l=>{Pp(s,a,l)}),(o=a.scripts)!=null&&o.qwik){let l=a.scripts.qwik;delete a.scripts.qwik,a.scripts.qwik=l}t.files.push({path:r,content:JSON.stringify(a,null,2)+`
|
|
116
118
|
`,type:"modify"})}catch{t.files.push({path:r,content:i,type:"create"})}}function Pp(t,e,r){if(t[r]){e[r]?Object.assign(e[r],{...t[r]}):e[r]={...t[r]};let i={},s=Object.keys(e[r]).sort();for(let n of s)i[n]=e[r][n];e[r]=i}}async function kp(t,e,r){let i=await Y.default.promises.readFile(e,"utf-8"),s,n="";try{n=await Y.default.promises.readFile(r,"utf-8"),n=n.trim()+`
|
|
@@ -118,7 +120,7 @@ You might need to run "${g.green(`${t} install`)}" manually inside the root of y
|
|
|
118
120
|
`+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
121
|
`,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
122
|
`).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-
|
|
123
|
+
`,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-dev20221024094026")}`),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
124
|
`),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
125
|
`),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
126
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/package.json
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"qwik": "qwik"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@builder.io/qwik": "0.12.0-
|
|
19
|
+
"@builder.io/qwik": "0.12.0-dev20221024094026",
|
|
20
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-
|
|
25
|
+
"eslint-plugin-qwik": "0.12.0-dev20221024094026",
|
|
26
26
|
"eslint": "8.25.0",
|
|
27
27
|
"node-fetch": "3.2.10",
|
|
28
28
|
"prettier": "2.7.1",
|