create-qwik 1.1.5-dev20230625184243 → 1.2.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 1.1.5-dev20230625184243
3
+ * create-qwik 1.2.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
@@ -100,4 +100,4 @@ ${T("\u251C"+"\u2500".repeat(s+2)+"\u256F")}
100
100
  `+r.trim()+`
101
101
  `;e.files.push({path:D,content:i,type:"modify"})}catch{e.files.push({path:D,content:s,type:"create"})}}async function De(e,t){let s=(await K()).find(n=>n.id===t.integration);if(!s)throw new Error(`Unable to find integration "${t.integration}"`);let r={files:[],installedDeps:{},installedScripts:Object.keys(s.pkgJson.scripts||{})};t.installDeps&&(r.installedDeps={...s.pkgJson.dependencies,...s.pkgJson.devDependencies}),await ee(r,t,s.dir,t.rootDir);let i=async n=>{let a=Object.keys(r.installedDeps).length>0,c=hu();n&&c.start(`Updating app${a?" and installing dependencies":""}...`);let p=!0;try{let l=new Set(r.files.map(C=>(0,qt.dirname)(C.path)));for(let C of Array.from(l))try{te.default.mkdirSync(C,{recursive:!0})}catch{}let F=Promise.all(r.files.map(async C=>{await te.default.promises.writeFile(C.path,C.content)}));if(t.installDeps&&Object.keys(r.installedDeps).length>0){let{install:C}=eu(e,t.rootDir);p=await C}if(await F,n&&c.stop("App updated"),!p){let C=`${ou(` ${e} install failed `)}
102
102
  You might need to run "${S(`${e} install`)}" manually inside the root of the project.`;B.error(C)}}catch(l){n&&c.stop("App updated"),U(String(l))}};return{rootDir:t.rootDir,integration:s,updates:r,commit:i}}var Lt=y(require("os"));async function se(e,t){as()?t=process.cwd():(t=ie(t),Du.default.existsSync(t)&&U(`Directory "${t}" already exists. Please either remove this directory, or choose another location.`));let D=M(),r=await su({starterId:e,outDir:t});return re(D,r,!1),r}function re(e,t,D){let s=process.cwd()===t.outDir,r=(0,_.relative)(process.cwd(),t.outDir),i=[];s?i.push(`\u{1F984} ${$u(" Success! ")}`):i.push(`\u{1F984} ${$u(" Success! ")} ${S("Project created in")} ${Ce(k(r))} ${S("directory")}`),i.push(""),i.push(`\u{1F430} ${S("Next steps:")}`),s||i.push(` cd ${r}`),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} ${S("Integrations? Add Netlify, Cloudflare, Tailwind...")}`),i.push(` ${u}`),i.push(""),i.push(Rt(t.docs)),i.push(`\u{1F440} ${S("Presentations, Podcasts and Videos:")}`),i.push(" https://qwik.builder.io/media/"),i.push(""),i.join(`
103
- `)}async function su(e){let t=M();if(!Jt(e.starterId))throw new Error("Missing starter id");if(!Jt(e.outDir))throw new Error("Missing outDir");if(!(0,_.isAbsolute)(e.outDir))throw new Error("outDir must be an absolute path");Du.default.existsSync(e.outDir)||Du.default.mkdirSync(decodeURIComponent(e.outDir),{recursive:!0});let D={starterId:e.starterId,outDir:e.outDir,docs:[]},s=(await K()).filter(i=>i.type==="app");if(e.starterId==="library"){let i=s.find(u=>u.id==="library");if(!i)throw new Error("Unable to find base app");await Wt(t,D,i)}else{let i=s.find(n=>n.id==="base");if(!i)throw new Error("Unable to find base app");let u=s.find(n=>n.id===e.starterId);if(!u)throw new Error(`Invalid starter id "${e.starterId}". It can only be one of${s.map(n=>` "${n.id}"`)}.`);await Wt(t,D,i,u)}return D}async function Wt(e,t,D,s){t.docs.push(...D.docs);let r=s??D,i=Ot({...D.pkgJson,name:`my-${r.pkgJson.name}`,description:r.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await jt(t.outDir,i);let u=(0,_.join)(t.outDir,"README.md");await Du.default.promises.writeFile(u,""),await(await De(e,{rootDir:t.outDir,integration:D.id,installDeps:!1})).commit(!1),s&&(t.docs.push(...s.docs),await(await De(e,{rootDir:t.outDir,integration:s.id,installDeps:!1})).commit(!1))}function Jt(e){return typeof e=="string"&&e.trim().length>0}function ie(e){return e.startsWith("~/")?(0,_.resolve)(Lt.default.homedir(),e):(0,_.resolve)(process.cwd(),e)}function as(){return cs()}function cs(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Y=y(require("fs")),ru=require("path");async function ne(){Pe(`Let's create a ${fu(" Qwik App ")} \u2728 (v1.1.5-dev20230625184243)`),await It(500);let e="./qwik-app",t=await Te({message:`Where would you like to create your new project? ${T("(Use '.' or './' for current directory)")}`,placeholder:e})||e;N(t)&&(uu("Operation cancelled."),process.exit(0));let D=M(),r=(await K()).filter($=>$.type==="app"),i=r.find($=>$.id==="base"),u=r.filter($=>$.id!==i.id),n=Mt(D,i),a=ie(t.trim());B.info(`Creating new project in ${fu(" "+a+" ")} ... \u{1F407}`);let c=null;if(Y.default.existsSync(a)&&Y.default.readdirSync(a).length>0){let $=await qu({message:`Directory "./${(0,ru.relative)(process.cwd(),a)}" already exists and is not empty. What would you like to do?`,options:[{value:"exit",label:"Do not overwrite this directory and exit"},{value:"replace",label:"Remove contents of this directory"}]});(N($)||$==="exit")&&(uu("Operation cancelled."),process.exit(0)),$==="replace"&&(c=Y.default.promises.readdir(a).then(W=>Promise.all(W.map(Vt=>Y.default.promises.rm((0,ru.join)(a,Vt),{recursive:!0})))))}let p=await qu({message:"Select a starter",options:u.map($=>{var W;return{label:$.name,value:$.id,hint:(W=$.pkgJson)==null?void 0:W.description}})});N(p)&&(uu("Operation cancelled."),process.exit(0));let l=p,F=await Mu({message:`Would you like to install ${D} dependencies?`,initialValue:!0});N(F)&&(uu("Operation cancelled."),process.exit(0));let C=await Mu({message:"Initialize a new git repository?",initialValue:!0});c&&await c;let w=F;w||n.abort();let R={starterId:l,outDir:a},O=hu();O.start("Creating App...");let iu=await su(R);if(O.stop("App Created \u{1F430}"),C)if(Y.default.existsSync((0,ru.join)(a,".git")))B.info("Git has already been initialized before. Skipping...");else{O.start("Git initializing...");try{let $=[];if($.push(await G("git",["init"],a).install),$.push(await G("git",["add","-A"],a).install),$.push(await G("git",["commit","-m","Initial commit \u26A1\uFE0F"],a).install),$.some(W=>W===!1))throw"";O.stop("Git initialized \u{1F3B2}")}catch{O.stop("Git failed to initialize"),B.error(x("Git failed to initialize. You can do this manually by running: git init"))}}let H=!1;return w&&(O.start(`Installing ${D} dependencies...`),H=await n.complete(iu.outDir),H&&(H=await eu(D,iu.outDir).install),O.stop(`${H?"Installed":"Failed to install"} ${D} dependencies \u{1F4CB}`)),Pt(re(D,iu,H),"Result"),Wu("Happy coding! \u{1F407}"),iu}async function ls(){console.clear(),Tt(),ps();try{let e=process.argv.slice(2);e.length>=2?await se(e[0],e[1]):await ne()}catch(e){U(e.message||e)}}function ps(){let e=process.version,[t,D]=e.replace("v","").split(".");Number(t)<16?(console.error(x(`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(me(`Node.js 16.8 or higher is recommended. You are currently running Node.js ${e}.`)):Number(t)===18&&Number(D)<11&&console.error(x(`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});
103
+ `)}async function su(e){let t=M();if(!Jt(e.starterId))throw new Error("Missing starter id");if(!Jt(e.outDir))throw new Error("Missing outDir");if(!(0,_.isAbsolute)(e.outDir))throw new Error("outDir must be an absolute path");Du.default.existsSync(e.outDir)||Du.default.mkdirSync(decodeURIComponent(e.outDir),{recursive:!0});let D={starterId:e.starterId,outDir:e.outDir,docs:[]},s=(await K()).filter(i=>i.type==="app");if(e.starterId==="library"){let i=s.find(u=>u.id==="library");if(!i)throw new Error("Unable to find base app");await Wt(t,D,i)}else{let i=s.find(n=>n.id==="base");if(!i)throw new Error("Unable to find base app");let u=s.find(n=>n.id===e.starterId);if(!u)throw new Error(`Invalid starter id "${e.starterId}". It can only be one of${s.map(n=>` "${n.id}"`)}.`);await Wt(t,D,i,u)}return D}async function Wt(e,t,D,s){t.docs.push(...D.docs);let r=s??D,i=Ot({...D.pkgJson,name:`my-${r.pkgJson.name}`,description:r.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await jt(t.outDir,i);let u=(0,_.join)(t.outDir,"README.md");await Du.default.promises.writeFile(u,""),await(await De(e,{rootDir:t.outDir,integration:D.id,installDeps:!1})).commit(!1),s&&(t.docs.push(...s.docs),await(await De(e,{rootDir:t.outDir,integration:s.id,installDeps:!1})).commit(!1))}function Jt(e){return typeof e=="string"&&e.trim().length>0}function ie(e){return e.startsWith("~/")?(0,_.resolve)(Lt.default.homedir(),e):(0,_.resolve)(process.cwd(),e)}function as(){return cs()}function cs(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}var Y=y(require("fs")),ru=require("path");async function ne(){Pe(`Let's create a ${fu(" Qwik App ")} \u2728 (v1.2.0)`),await It(500);let e="./qwik-app",t=await Te({message:`Where would you like to create your new project? ${T("(Use '.' or './' for current directory)")}`,placeholder:e})||e;N(t)&&(uu("Operation cancelled."),process.exit(0));let D=M(),r=(await K()).filter($=>$.type==="app"),i=r.find($=>$.id==="base"),u=r.filter($=>$.id!==i.id),n=Mt(D,i),a=ie(t.trim());B.info(`Creating new project in ${fu(" "+a+" ")} ... \u{1F407}`);let c=null;if(Y.default.existsSync(a)&&Y.default.readdirSync(a).length>0){let $=await qu({message:`Directory "./${(0,ru.relative)(process.cwd(),a)}" already exists and is not empty. What would you like to do?`,options:[{value:"exit",label:"Do not overwrite this directory and exit"},{value:"replace",label:"Remove contents of this directory"}]});(N($)||$==="exit")&&(uu("Operation cancelled."),process.exit(0)),$==="replace"&&(c=Y.default.promises.readdir(a).then(W=>Promise.all(W.map(Vt=>Y.default.promises.rm((0,ru.join)(a,Vt),{recursive:!0})))))}let p=await qu({message:"Select a starter",options:u.map($=>{var W;return{label:$.name,value:$.id,hint:(W=$.pkgJson)==null?void 0:W.description}})});N(p)&&(uu("Operation cancelled."),process.exit(0));let l=p,F=await Mu({message:`Would you like to install ${D} dependencies?`,initialValue:!0});N(F)&&(uu("Operation cancelled."),process.exit(0));let C=await Mu({message:"Initialize a new git repository?",initialValue:!0});c&&await c;let w=F;w||n.abort();let R={starterId:l,outDir:a},O=hu();O.start("Creating App...");let iu=await su(R);if(O.stop("App Created \u{1F430}"),C)if(Y.default.existsSync((0,ru.join)(a,".git")))B.info("Git has already been initialized before. Skipping...");else{O.start("Git initializing...");try{let $=[];if($.push(await G("git",["init"],a).install),$.push(await G("git",["add","-A"],a).install),$.push(await G("git",["commit","-m","Initial commit \u26A1\uFE0F"],a).install),$.some(W=>W===!1))throw"";O.stop("Git initialized \u{1F3B2}")}catch{O.stop("Git failed to initialize"),B.error(x("Git failed to initialize. You can do this manually by running: git init"))}}let H=!1;return w&&(O.start(`Installing ${D} dependencies...`),H=await n.complete(iu.outDir),H&&(H=await eu(D,iu.outDir).install),O.stop(`${H?"Installed":"Failed to install"} ${D} dependencies \u{1F4CB}`)),Pt(re(D,iu,H),"Result"),Wu("Happy coding! \u{1F407}"),iu}async function ls(){console.clear(),Tt(),ps();try{let e=process.argv.slice(2);e.length>=2?await se(e[0],e[1]):await ne()}catch(e){U(e.message||e)}}function ps(){let e=process.version,[t,D]=e.replace("v","").split(".");Number(t)<16?(console.error(x(`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(me(`Node.js 16.8 or higher is recommended. You are currently running Node.js ${e}.`)):Number(t)===18&&Number(D)<11&&console.error(x(`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": "1.1.5-dev20230625184243",
3
+ "version": "1.2.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": "1.1.5-dev20230625184243",
20
- "@builder.io/qwik-city": "1.1.5-dev20230625184243",
19
+ "@builder.io/qwik": "^1.2.0",
20
+ "@builder.io/qwik-city": "^1.2.0",
21
21
  "@types/eslint": "8.40.2",
22
22
  "@types/node": "^20.3.1",
23
23
  "@typescript-eslint/eslint-plugin": "5.60.0",
24
24
  "@typescript-eslint/parser": "5.60.0",
25
- "eslint-plugin-qwik": "1.1.5-dev20230625184243",
25
+ "eslint-plugin-qwik": "^1.2.0",
26
26
  "eslint": "8.43.0",
27
27
  "undici": "5.22.1",
28
28
  "prettier": "2.8.8",
@@ -32,7 +32,7 @@
32
32
  "release": "np"
33
33
  },
34
34
  "devDependencies": {
35
- "@builder.io/qwik": "1.1.5",
35
+ "@builder.io/qwik": "1.2.0",
36
36
  "@types/eslint": "8.40.2",
37
37
  "@types/node": "^20.3.1",
38
38
  "@typescript-eslint/eslint-plugin": "5.60.0",
@@ -0,0 +1,15 @@
1
+ ## Builder.io + Qwik
2
+
3
+ An example of using [Builder.io's](https://www.builder.io/) visual editor with Qwik.
4
+
5
+ See the catchall route at [src/routes/[...index]/index.tsx](src/routes/[...index]/index.tsx) for the integration code.
6
+
7
+ Registered components can be found in [src/components/builder-registry.ts](src/components/builder-registry.ts)
8
+
9
+ ### Docs
10
+
11
+ See our full integration guides [here](https://www.builder.io/c/docs/developers)
12
+
13
+ Also, when you push your integration to production, go back and update your preview URL to your production URL so now anyone on your team can visuall create content in your Qwik app!
14
+
15
+ Also, to integrate structured data, see [this guide](https://www.builder.io/c/docs/integrate-cms-data)
@@ -2,8 +2,8 @@
2
2
  "name": "qwik-site-with-visual-cms",
3
3
  "description": "Site integrated with Builder.io for visual editing",
4
4
  "devDependencies": {
5
- "@builder.io/dev-tools": "^0.0.6",
6
- "@builder.io/sdk-qwik": "^0.3.0"
5
+ "@builder.io/dev-tools": "^0.0.7",
6
+ "@builder.io/sdk-qwik": "^0.4.1"
7
7
  },
8
8
  "type": "module",
9
9
  "__qwik__": {
@@ -1,6 +1,16 @@
1
1
  import type { RegisteredComponent } from "@builder.io/sdk-qwik";
2
2
  import Counter from "./counter/counter";
3
3
 
4
+ /**
5
+ * This array is used to integrate custom components within Builder.
6
+ * https://www.builder.io/c/docs/custom-components-intro
7
+ *
8
+ * These components will be found the "Custom Components"
9
+ * section of Builder's visual editor.
10
+ * You can also turn on "components only mode" to limit
11
+ * editing to only these components.
12
+ * https://www.builder.io/c/docs/guides/components-only-mode
13
+ */
4
14
  export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
5
15
  {
6
16
  component: Counter,
@@ -5,7 +5,6 @@
5
5
  gap: 20px;
6
6
  }
7
7
 
8
- /* BUTTONS -------------------------------------- */
9
8
  .button {
10
9
  background: var(--qwik-dirty-black);
11
10
  border: none;