create-qwik 0.25.0 → 0.100.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 +2 -2
- package/package.json +1 -1
- package/starters/apps/base/.vscode/qwik-city.code-snippets +2 -2
- package/starters/apps/base/package.json +3 -3
- package/starters/apps/base/src/entry.preview.tsx +1 -1
- package/starters/apps/basic/src/routes/demo/flower/index.tsx +1 -1
- package/starters/apps/library/README.md +3 -3
- package/starters/apps/library/package.json +1 -1
- package/starters/apps/library/src/components/counter/counter.tsx +4 -4
- package/starters/apps/library/src/components/logo/logo.tsx +2 -2
package/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* create-qwik 0.
|
|
3
|
+
* create-qwik 0.100.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 te(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 ue(s,t,r.dir,t.rootDir);let i=async n=>{let c=Object.keys(s.installedDeps).length>0,a=lu();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{ee.default.mkdirSync(C,{recursive:!0})}catch{}let F=Promise.all(s.files.map(async C=>{await ee.default.promises.writeFile(C.path,C.content)}));if(t.installDeps&&Object.keys(s.installedDeps).length>0){let{install:C}=Xu(e,t.rootDir);p=await C}if(await F,n&&a.stop("App updated"),!p){let C=`${Du(` ${e} install failed `)}
|
|
93
93
|
You might need to run "${k(`${e} install`)}" manually inside the root of the project.`;A.error(C)}}catch(l){n&&a.stop("App updated"),G(String(l))}};return{rootDir:t.rootDir,integration:r,updates:s,commit:i}}async function De(e,t){ir()?t=process.cwd():(t=se(t),X.default.existsSync(t)&&G(`Directory "${t}" already exists. Please either remove this directory, or choose another location.`));let D=M(),s=await uu({starterId:e,outDir:t});return re(D,s,!1),s}function re(e,t,D){let r=process.cwd()===t.outDir,s=(0,T.relative)(process.cwd(),t.outDir),i=[];r?i.push(`\u{1F984} ${ru(" Success! ")}`):i.push(`\u{1F984} ${ru(" Success! ")} ${k("Project created in")} ${Fe(x(s))} ${k("directory")}`),i.push(""),i.push(`\u{1F430} ${k("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} ${k("Integrations? Add Netlify, Cloudflare, Tailwind...")}`),i.push(` ${u}`),i.push(""),i.push(Rt(t.docs)),i.push(`\u{1F440} ${k("Presentations, Podcasts and Videos:")}`),i.push(" https://qwik.builder.io/media/"),i.push(""),i.join(`
|
|
94
|
-
`)}async function uu(e){let t=M();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(decodeURIComponent(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 te(e,{rootDir:t.outDir,integration:D.id,installDeps:!1})).commit(!1),r&&(t.docs.push(...r.docs),await(await te(e,{rootDir:t.outDir,integration:r.id,installDeps:!1})).commit(!1))}function Lt(e){return typeof e=="string"&&e.trim().length>0}function se(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 hu=B(require("fs")),mu=require("path");async function ie(){Pe(`Let's create a ${de(" Qwik App ")} \u2728 (v0.
|
|
94
|
+
`)}async function uu(e){let t=M();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(decodeURIComponent(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 te(e,{rootDir:t.outDir,integration:D.id,installDeps:!1})).commit(!1),r&&(t.docs.push(...r.docs),await(await te(e,{rootDir:t.outDir,integration:r.id,installDeps:!1})).commit(!1))}function Lt(e){return typeof e=="string"&&e.trim().length>0}function se(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 hu=B(require("fs")),mu=require("path");async function ie(){Pe(`Let's create a ${de(" Qwik App ")} \u2728 (v0.100.0)`),await It(500);let e="./qwik-app",t=await Te({message:"Where would you like to create your new project?",placeholder:e,validate(f){if(f.trim()==="."||f.trim()==="./")return"Please don't use '.' or './' and let qwik create the directory for you."}})||e;R(t)&&(Z("Operation cancelled."),process.exit(0));let D=M(),s=(await U()).filter(f=>f.type==="app"),i=s.find(f=>f.id==="base"),u=s.filter(f=>f.id!==i.id),n=Nt(D,i),c=se(t.trim()),a=null;if(hu.default.existsSync(c)){let f=await Mu({message:`Directory "./${(0,mu.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"}]});(R(f)||f==="exit")&&(Z("Operation cancelled."),process.exit(0)),f==="replace"&&(a=hu.default.promises.rm(c,{recursive:!0}))}let p=await Mu({message:"Select a starter",options:u.map(f=>{var eu;return{label:f.name,value:f.id,hint:(eu=f.pkgJson)==null?void 0:eu.description}})});R(p)&&(Z("Operation cancelled."),process.exit(0));let l=p,F=await Ru({message:`Would you like to install ${D} dependencies?`,initialValue:!0});R(F)&&(Z("Operation cancelled."),process.exit(0));let C=await Ru({message:"Initialize a new git repository?",initialValue:!0});a&&await a;let y=F,P={starterId:l,outDir:c},I=lu();I.start("Creating App...");let Eu=await uu(P);if(I.stop("Created App \u{1F430}"),C)if(hu.default.existsSync((0,mu.join)(c,".git")))A.info("Git has already been initialized before. Skipping...");else{I.start("Git initializing...");try{let f=[];if(f.push(await z("git",["init"],c).install),f.push(await z("git",["add","-A"],c).install),f.push(await z("git",["commit","-m","Initial commit \u26A1\uFE0F"],c).install),f.some(eu=>eu===!1))throw"";I.stop("Git initialized \u{1F3B2}")}catch{I.stop("Git failed to initialize"),A.error(O("Git failed to initialize. You can do this manually by running: git init"))}}let du=!1;return y&&(I.start("Installing dependencies"),du=await n.complete(y,Eu.outDir),I.stop(`${du?"Installed":"Failed to install"} dependencies \u{1F4CB}`)),Pt(re(D,Eu,du),"Result"),Nu("Happy coding! \u{1F407}"),Eu}async function or(){console.clear(),Tt(),ar();try{let e=process.argv.slice(2);e.length>=2?await De(e[0],e[1]):await ie()}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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"prefix": "qloader$",
|
|
15
15
|
"description": "loader$()",
|
|
16
16
|
"body": [
|
|
17
|
-
"export const $1 =
|
|
17
|
+
"export const $1 = routeLoader$(() => {",
|
|
18
18
|
" $0",
|
|
19
19
|
"});"
|
|
20
20
|
]
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"prefix": "qaction$",
|
|
25
25
|
"description": "action$()",
|
|
26
26
|
"body": [
|
|
27
|
-
"export const $1 =
|
|
27
|
+
"export const $1 = routeAction$((data) => {",
|
|
28
28
|
" $0",
|
|
29
29
|
"});"
|
|
30
30
|
]
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"qwik": "qwik"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@builder.io/qwik": "0.
|
|
20
|
-
"@builder.io/qwik-city": "~0.
|
|
19
|
+
"@builder.io/qwik": "0.100.0",
|
|
20
|
+
"@builder.io/qwik-city": "~0.100.0",
|
|
21
21
|
"@types/eslint": "8.21.3",
|
|
22
22
|
"@types/node": "^18.15.9",
|
|
23
23
|
"@typescript-eslint/eslint-plugin": "5.56.0",
|
|
24
24
|
"@typescript-eslint/parser": "5.56.0",
|
|
25
|
-
"eslint-plugin-qwik": "0.
|
|
25
|
+
"eslint-plugin-qwik": "0.100.0",
|
|
26
26
|
"eslint": "8.36.0",
|
|
27
27
|
"undici": "5.21.0",
|
|
28
28
|
"prettier": "2.8.7",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
import { createQwikCity } from '@builder.io/qwik-city/middleware/node';
|
|
14
|
-
import render from './entry.ssr';
|
|
15
14
|
import qwikCityPlan from '@qwik-city-plan';
|
|
15
|
+
import render from './entry.ssr';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* The default export is the QwikCity adapter used by Vite preview.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
## Project Structure
|
|
15
15
|
|
|
16
|
-
Inside
|
|
16
|
+
Inside your project, you'll see the following directories and files:
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
├── public/
|
|
@@ -26,11 +26,11 @@ Inside of you project, you'll see the following directories and files:
|
|
|
26
26
|
|
|
27
27
|
- `src/components`: Recommended directory for components.
|
|
28
28
|
|
|
29
|
-
- `index.ts`:
|
|
29
|
+
- `index.ts`: The entry point of your component library, make sure all the public components are exported from this file.
|
|
30
30
|
|
|
31
31
|
## Development
|
|
32
32
|
|
|
33
|
-
Development mode uses [Vite's development server](https://vitejs.dev/). For Qwik during development, the `dev` command will also server-side render (SSR) the output. The client-side development modules loaded by the browser.
|
|
33
|
+
Development mode uses [Vite's development server](https://vitejs.dev/). For Qwik during development, the `dev` command will also server-side render (SSR) the output. The client-side development modules are loaded by the browser.
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
npm run dev
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { component$,
|
|
1
|
+
import { component$, useSignal } from '@builder.io/qwik';
|
|
2
2
|
|
|
3
3
|
export const Counter = component$(() => {
|
|
4
|
-
const
|
|
4
|
+
const count = useSignal(0);
|
|
5
5
|
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
|
-
<p>Count: {
|
|
8
|
+
<p>Count: {count.value}</p>
|
|
9
9
|
<p>
|
|
10
|
-
<button onClick$={() =>
|
|
10
|
+
<button onClick$={() => count.value++}>Increment</button>
|
|
11
11
|
</p>
|
|
12
12
|
</div>
|
|
13
13
|
);
|
|
@@ -2,7 +2,7 @@ import { component$ } from '@builder.io/qwik';
|
|
|
2
2
|
|
|
3
3
|
export const Logo = component$(() => {
|
|
4
4
|
return (
|
|
5
|
-
<
|
|
5
|
+
<div>
|
|
6
6
|
<a href="https://qwik.builder.io/">
|
|
7
7
|
<img
|
|
8
8
|
alt="Qwik Logo"
|
|
@@ -11,6 +11,6 @@ export const Logo = component$(() => {
|
|
|
11
11
|
src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F667ab6c2283d4c4d878fb9083aacc10f"
|
|
12
12
|
/>
|
|
13
13
|
</a>
|
|
14
|
-
</
|
|
14
|
+
</div>
|
|
15
15
|
);
|
|
16
16
|
});
|