create-qwik 0.0.113 → 0.10.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 +50 -50
- package/package.json +2 -2
- package/starters/apps/base/.eslintignore +1 -0
- package/starters/apps/base/.vscode/extensions.json +4 -0
- package/starters/apps/base/.vscode/qwik-city.code-snippets +32 -0
- package/starters/apps/base/.vscode/qwik.code-snippets +29 -30
- package/starters/apps/base/README.md +16 -16
- package/starters/apps/base/gitignore +1 -0
- package/starters/apps/base/package.json +3 -3
- package/starters/apps/base/src/routes/service-worker.ts +2 -2
- package/starters/apps/base/tsconfig.json +1 -1
- package/starters/apps/basic/package.json +1 -1
- package/starters/apps/basic/src/components/header/header.css +0 -3
- package/starters/apps/basic/src/routes/index.tsx +6 -0
- package/starters/apps/documentation-site/src/components/menu/menu.tsx +4 -4
- package/starters/apps/documentation-site/src/routes/about-us/index.md +1 -1
- package/starters/apps/documentation-site/src/routes/docs/index.md +1 -1
- package/starters/apps/documentation-site/src/routes/index.tsx +6 -0
- package/starters/apps/library/.eslintignore +31 -0
- package/starters/apps/library/.eslintrc.cjs +40 -0
- package/starters/apps/library/.prettierignore +6 -0
- package/starters/apps/library/README.md +47 -0
- package/starters/apps/library/gitignore +38 -0
- package/starters/apps/library/package.json +24 -5
- package/starters/apps/library/src/entry.dev.tsx +17 -0
- package/starters/apps/library/src/entry.ssr.tsx +29 -0
- package/starters/apps/library/src/root.tsx +2 -2
- package/starters/apps/library/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-qwik",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Interactive CLI for create Qwik projects and adding features.",
|
|
5
5
|
"bin": "./create-qwik.cjs",
|
|
6
6
|
"main": "./index.cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"prompts": "2.4.2"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">=16",
|
|
38
38
|
"npm": ">=6.0.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"onGet": {
|
|
3
|
+
"scope": "javascriptreact,typescriptreact",
|
|
4
|
+
"prefix": "q:onGet",
|
|
5
|
+
"description": "onGet function for a route index",
|
|
6
|
+
"body": [
|
|
7
|
+
"export const onGet: RequestHandler = (request) => {",
|
|
8
|
+
" $0",
|
|
9
|
+
"};"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"onGet (typed)": {
|
|
13
|
+
"scope": "javascriptreact,typescriptreact",
|
|
14
|
+
"prefix": "q:onGet typed",
|
|
15
|
+
"description": "onGet function for a route index",
|
|
16
|
+
"body": [
|
|
17
|
+
"export interface ${1:PageData} {",
|
|
18
|
+
" $2",
|
|
19
|
+
"};",
|
|
20
|
+
"",
|
|
21
|
+
"export const onGet: RequestHandler<$1> = (request) => {",
|
|
22
|
+
" $4",
|
|
23
|
+
"};"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"useEndpoint": {
|
|
27
|
+
"scope": "javascriptreact,typescriptreact",
|
|
28
|
+
"prefix": "q:useEndpoint",
|
|
29
|
+
"description": "useEndpoint declaration",
|
|
30
|
+
"body": "const $1 = useEndpoint<typeof onGet>();"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,47 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Qwik component": {
|
|
3
3
|
"scope": "typescriptreact",
|
|
4
|
-
"prefix": "component
|
|
5
|
-
"description": "Qwik
|
|
4
|
+
"prefix": "q:component w/props",
|
|
5
|
+
"description": "Qwik component w/ props",
|
|
6
6
|
"body": [
|
|
7
|
-
"export interface ${1
|
|
8
|
-
"
|
|
7
|
+
"export interface ${1:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}}Props {",
|
|
8
|
+
" $2",
|
|
9
9
|
"}",
|
|
10
10
|
"",
|
|
11
|
-
"export const $
|
|
11
|
+
"export const $1 = component$((props: $1Props) => {",
|
|
12
12
|
" const state = useStore({",
|
|
13
|
-
"
|
|
13
|
+
" $3",
|
|
14
14
|
" });",
|
|
15
|
-
"
|
|
16
|
-
" return (",
|
|
17
|
-
" <div>",
|
|
18
|
-
" <button onClick$={() => state.count += props.step}>",
|
|
19
|
-
" {state.count}",
|
|
20
|
-
" </button>",
|
|
21
|
-
" </div>",
|
|
22
|
-
" );",
|
|
15
|
+
" ",
|
|
16
|
+
" return <${4:button} on${5:Click}$={(${6:e}) => {$7}}>$8</${4}>",
|
|
23
17
|
"});"
|
|
24
18
|
]
|
|
25
19
|
},
|
|
26
|
-
"Qwik component (
|
|
20
|
+
"Qwik component (simple)": {
|
|
27
21
|
"scope": "javascriptreact,typescriptreact",
|
|
28
|
-
"prefix": "component
|
|
29
|
-
"description": "
|
|
22
|
+
"prefix": "q:component simple",
|
|
23
|
+
"description": "Simple Qwik component",
|
|
30
24
|
"body": [
|
|
31
|
-
"export const ${1
|
|
32
|
-
" return
|
|
33
|
-
" <div>",
|
|
34
|
-
" <div>",
|
|
35
|
-
" ${1:MyCmp}",
|
|
36
|
-
" </div>",
|
|
37
|
-
" </div>",
|
|
38
|
-
" );",
|
|
25
|
+
"export const ${1:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}} = component$(() => {",
|
|
26
|
+
" return <${2:button}>$4</$2>",
|
|
39
27
|
"});"
|
|
40
28
|
]
|
|
41
29
|
},
|
|
42
30
|
"Qwik state": {
|
|
43
31
|
"scope": "javascriptreact,typescriptreact",
|
|
44
|
-
"prefix": "useStore$",
|
|
32
|
+
"prefix": "q:useStore$",
|
|
45
33
|
"description": "useStore() declaration",
|
|
46
34
|
"body": [
|
|
47
35
|
"const ${1:state} = useStore({",
|
|
@@ -52,7 +40,7 @@
|
|
|
52
40
|
},
|
|
53
41
|
"$ hook": {
|
|
54
42
|
"scope": "javascriptreact,typescriptreact",
|
|
55
|
-
"prefix": "
|
|
43
|
+
"prefix": "q:$",
|
|
56
44
|
"description": "$() function hook",
|
|
57
45
|
"body": [
|
|
58
46
|
"$(() => {",
|
|
@@ -63,7 +51,7 @@
|
|
|
63
51
|
},
|
|
64
52
|
"useClientEffect": {
|
|
65
53
|
"scope": "javascriptreact,typescriptreact",
|
|
66
|
-
"prefix": "useClientEffect",
|
|
54
|
+
"prefix": "q:useClientEffect",
|
|
67
55
|
"description": "useClientEffect$() function hook",
|
|
68
56
|
"body": [
|
|
69
57
|
"useClientEffect$(({ track }) => {",
|
|
@@ -74,7 +62,7 @@
|
|
|
74
62
|
},
|
|
75
63
|
"useWatch": {
|
|
76
64
|
"scope": "javascriptreact,typescriptreact",
|
|
77
|
-
"prefix": "useWatch",
|
|
65
|
+
"prefix": "q:useWatch",
|
|
78
66
|
"description": "useWatch$() function hook",
|
|
79
67
|
"body": [
|
|
80
68
|
"useWatch$(({ track }) => {",
|
|
@@ -84,9 +72,20 @@
|
|
|
84
72
|
""
|
|
85
73
|
]
|
|
86
74
|
},
|
|
75
|
+
"useResource": {
|
|
76
|
+
"scope": "javascriptreact,typescriptreact",
|
|
77
|
+
"prefix": "q:useResource$",
|
|
78
|
+
"description": "useResource$() declaration",
|
|
79
|
+
"body": [
|
|
80
|
+
"const $1 = useResource$(({ track, previous, cleanup }) => {",
|
|
81
|
+
" $0",
|
|
82
|
+
"});",
|
|
83
|
+
""
|
|
84
|
+
]
|
|
85
|
+
},
|
|
87
86
|
"useServerMount": {
|
|
88
87
|
"scope": "javascriptreact,typescriptreact",
|
|
89
|
-
"prefix": "useServerMount",
|
|
88
|
+
"prefix": "q:useServerMount",
|
|
90
89
|
"description": "useServerMount$() function hook",
|
|
91
90
|
"body": [
|
|
92
91
|
"useServerMount$(() => {",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
- [Qwik Docs](https://qwik.builder.io/)
|
|
4
4
|
- [Discord](https://qwik.builder.io/chat)
|
|
5
|
-
- [Qwik
|
|
5
|
+
- [Qwik GitHub](https://github.com/BuilderIO/qwik)
|
|
6
6
|
- [@QwikDev](https://twitter.com/QwikDev)
|
|
7
7
|
- [Vite](https://vitejs.dev/)
|
|
8
8
|
- [Partytown](https://partytown.builder.io/)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
## Project Structure
|
|
15
15
|
|
|
16
|
-
Inside
|
|
16
|
+
Inside your project, you'll see the following directory structure:
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
├── public/
|
|
@@ -25,7 +25,7 @@ Inside of you project, you'll see the following directories and files:
|
|
|
25
25
|
└── ...
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
- `src/routes`: Provides the directory based routing, which can include a hierarchy of `layout.tsx` layout files, and `index.tsx`
|
|
28
|
+
- `src/routes`: Provides the directory based routing, which can include a hierarchy of `layout.tsx` layout files, and an `index.tsx` file as the page. Additionally, `index.ts` files are endpoints. Please see the [routing docs](https://qwik.builder.io/qwikcity/routing/overview/) for more info.
|
|
29
29
|
|
|
30
30
|
- `src/components`: Recommended directory for components.
|
|
31
31
|
|
|
@@ -33,34 +33,34 @@ Inside of you project, you'll see the following directories and files:
|
|
|
33
33
|
|
|
34
34
|
## Add Integrations
|
|
35
35
|
|
|
36
|
-
Use the `npm run qwik add` command to add
|
|
36
|
+
Use the `npm run qwik add` command to add additional integrations. Some examples of integrations include: Cloudflare, Netlify or Vercel server, and the [Static Site Generator (SSG)](https://qwik.builder.io/qwikcity/static-site-generation/static-site-config/).
|
|
37
37
|
|
|
38
|
-
```
|
|
39
|
-
npm run qwik add
|
|
38
|
+
```shell
|
|
39
|
+
npm run qwik add # or `yarn qwik add`
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Development
|
|
43
43
|
|
|
44
|
-
Development mode uses [Vite's development server](https://vitejs.dev/).
|
|
44
|
+
Development mode uses [Vite's development server](https://vitejs.dev/). During development, the `dev` command will server-side render (SSR) the output.
|
|
45
45
|
|
|
46
|
-
```
|
|
47
|
-
npm run dev
|
|
46
|
+
```shell
|
|
47
|
+
npm run dev # or `yarn dev`
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
> Note: during dev mode, Vite
|
|
50
|
+
> Note: during dev mode, Vite may request a significant number of `.js` files. This does not represent a Qwik production build.
|
|
51
51
|
|
|
52
52
|
## Preview
|
|
53
53
|
|
|
54
|
-
The preview command will create a production build of the client modules, production build of `src/entry.preview.tsx`, and
|
|
54
|
+
The preview command will create a production build of the client modules, a production build of `src/entry.preview.tsx`, and run a local server. The preview server is only for convenience to locally preview a production build, and it should not be used as a production server.
|
|
55
55
|
|
|
56
|
-
```
|
|
57
|
-
npm run preview
|
|
56
|
+
```shell
|
|
57
|
+
npm run preview # or `yarn preview`
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
## Production
|
|
61
61
|
|
|
62
|
-
The production build
|
|
62
|
+
The production build will generate client and server modules by running both client and server build commands. Additionally, the build command will use Typescript to run a type check on the source code.
|
|
63
63
|
|
|
64
|
-
```
|
|
65
|
-
npm run build
|
|
64
|
+
```shell
|
|
65
|
+
npm run build # or `yarn build`
|
|
66
66
|
```
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"build": "qwik build",
|
|
5
5
|
"build.client": "vite build",
|
|
6
6
|
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
|
7
|
+
"build.types": "tsc --incremental --noEmit",
|
|
7
8
|
"dev": "vite --mode ssr",
|
|
8
9
|
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
|
9
10
|
"fmt": "prettier --write .",
|
|
@@ -11,17 +12,16 @@
|
|
|
11
12
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
12
13
|
"preview": "qwik build preview && vite preview --open",
|
|
13
14
|
"start": "vite --open --mode ssr",
|
|
14
|
-
"typecheck": "tsc --incremental --noEmit",
|
|
15
15
|
"qwik": "qwik"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@builder.io/qwik": "0.0
|
|
18
|
+
"@builder.io/qwik": "0.10.0",
|
|
19
19
|
"@builder.io/qwik-city": "0.0.111",
|
|
20
20
|
"@types/eslint": "8.4.6",
|
|
21
21
|
"@types/node": "latest",
|
|
22
22
|
"@typescript-eslint/eslint-plugin": "5.37.0",
|
|
23
23
|
"@typescript-eslint/parser": "5.37.0",
|
|
24
|
-
"eslint-plugin-qwik": "0.0
|
|
24
|
+
"eslint-plugin-qwik": "0.10.0",
|
|
25
25
|
"eslint": "8.23.1",
|
|
26
26
|
"node-fetch": "3.2.10",
|
|
27
27
|
"prettier": "2.7.1",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* WHAT IS THIS FILE?
|
|
3
3
|
*
|
|
4
4
|
* The service-worker.ts file is used to have state of the art prefetching.
|
|
5
|
-
* https://qwik.builder.io/
|
|
5
|
+
* https://qwik.builder.io/qwikcity/prefetching/overview/
|
|
6
6
|
*
|
|
7
|
-
* Qwik uses service worker to speed up your site and reduce latency, ie, not used in the
|
|
7
|
+
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
|
|
8
8
|
* You can also use this file to add more functionality that runs in the service worker.
|
|
9
9
|
*/
|
|
10
10
|
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker';
|
|
@@ -120,6 +120,12 @@ export default component$(() => {
|
|
|
120
120
|
Github
|
|
121
121
|
</a>
|
|
122
122
|
</li>
|
|
123
|
+
<li>
|
|
124
|
+
<span>Watch </span>
|
|
125
|
+
<a href="https://qwik.builder.io/media/" target="_blank">
|
|
126
|
+
Presentations, Podcasts, Videos, etc.
|
|
127
|
+
</a>
|
|
128
|
+
</li>
|
|
123
129
|
</ul>
|
|
124
130
|
<Link class="mindblow" href="/flower">
|
|
125
131
|
Blow my mind 🤯
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { component$,
|
|
1
|
+
import { component$, useStyles$ } from '@builder.io/qwik';
|
|
2
2
|
import { useContent, Link, useLocation } from '@builder.io/qwik-city';
|
|
3
3
|
import styles from './menu.css?inline';
|
|
4
4
|
|
|
@@ -18,10 +18,10 @@ export default component$(() => {
|
|
|
18
18
|
{item.items?.map((item) => (
|
|
19
19
|
<li>
|
|
20
20
|
<Link
|
|
21
|
-
href={
|
|
22
|
-
class={
|
|
21
|
+
href={item.href}
|
|
22
|
+
class={{
|
|
23
23
|
'is-active': loc.pathname === item.href,
|
|
24
|
-
}
|
|
24
|
+
}}
|
|
25
25
|
>
|
|
26
26
|
{item.text}
|
|
27
27
|
</Link>
|
|
@@ -11,5 +11,5 @@ This page is at the root level, so it only uses the `/src/routes/layout.tsx` lay
|
|
|
11
11
|
- [Layouts](https://qwik.builder.io/qwikcity/layout/overview/)
|
|
12
12
|
- [Routing](https://qwik.builder.io/qwikcity/routing/overview/)
|
|
13
13
|
- [Authoring Content](https://qwik.builder.io/qwikcity/content/component/)
|
|
14
|
-
- [Server Middleware](https://qwik.builder.io/qwikcity/
|
|
14
|
+
- [Server Adaptors and Middleware](https://qwik.builder.io/qwikcity/adaptors/overview/)
|
|
15
15
|
- [Static Site Generation (SSG)](https://qwik.builder.io/qwikcity/static-site-generation/overview/)
|
|
@@ -18,5 +18,5 @@ The left menu ordering is created with the `src/routes/docs/menu.md` markdown fi
|
|
|
18
18
|
- [Layouts](https://qwik.builder.io/qwikcity/layout/overview/)
|
|
19
19
|
- [Routing](https://qwik.builder.io/qwikcity/routing/overview/)
|
|
20
20
|
- [Authoring Content](https://qwik.builder.io/qwikcity/content/component/)
|
|
21
|
-
- [Server Middleware](https://qwik.builder.io/qwikcity/
|
|
21
|
+
- [Server Adaptors and Middleware](https://qwik.builder.io/qwikcity/adaptors/overview/)
|
|
22
22
|
- [Static Site Generation (SSG)](https://qwik.builder.io/qwikcity/static-site-generation/overview/)
|
|
@@ -127,6 +127,12 @@ export default component$(() => {
|
|
|
127
127
|
Github
|
|
128
128
|
</a>
|
|
129
129
|
</li>
|
|
130
|
+
<li>
|
|
131
|
+
<span>Watch </span>
|
|
132
|
+
<a href="https://qwik.builder.io/media/" target="_blank">
|
|
133
|
+
Presentations, Podcasts, Videos, etc.
|
|
134
|
+
</a>
|
|
135
|
+
</li>
|
|
130
136
|
</ul>
|
|
131
137
|
</>
|
|
132
138
|
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
**/*.log
|
|
2
|
+
**/.DS_Store
|
|
3
|
+
*.
|
|
4
|
+
.vscode/settings.json
|
|
5
|
+
.history
|
|
6
|
+
.yarn
|
|
7
|
+
bazel-*
|
|
8
|
+
bazel-bin
|
|
9
|
+
bazel-out
|
|
10
|
+
bazel-qwik
|
|
11
|
+
bazel-testlogs
|
|
12
|
+
dist
|
|
13
|
+
dist-dev
|
|
14
|
+
lib
|
|
15
|
+
lib-types
|
|
16
|
+
etc
|
|
17
|
+
external
|
|
18
|
+
node_modules
|
|
19
|
+
temp
|
|
20
|
+
tsc-out
|
|
21
|
+
tsdoc-metadata.json
|
|
22
|
+
target
|
|
23
|
+
output
|
|
24
|
+
rollup.config.js
|
|
25
|
+
build
|
|
26
|
+
.cache
|
|
27
|
+
.vscode
|
|
28
|
+
.rollup.cache
|
|
29
|
+
dist
|
|
30
|
+
tsconfig.tsbuildinfo
|
|
31
|
+
vite.config.ts
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
browser: true,
|
|
5
|
+
es2021: true,
|
|
6
|
+
node: true,
|
|
7
|
+
},
|
|
8
|
+
extends: [
|
|
9
|
+
'eslint:recommended',
|
|
10
|
+
'plugin:@typescript-eslint/recommended',
|
|
11
|
+
'plugin:qwik/recommended',
|
|
12
|
+
],
|
|
13
|
+
parser: '@typescript-eslint/parser',
|
|
14
|
+
parserOptions: {
|
|
15
|
+
tsconfigRootDir: __dirname,
|
|
16
|
+
project: ['./tsconfig.json'],
|
|
17
|
+
ecmaVersion: 2021,
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
ecmaFeatures: {
|
|
20
|
+
jsx: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
plugins: ['@typescript-eslint'],
|
|
24
|
+
rules: {
|
|
25
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
26
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
27
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
28
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
29
|
+
'@typescript-eslint/no-empty-interface': 'off',
|
|
30
|
+
'@typescript-eslint/no-namespace': 'off',
|
|
31
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
32
|
+
'@typescript-eslint/no-this-alias': 'off',
|
|
33
|
+
'@typescript-eslint/ban-types': 'off',
|
|
34
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
35
|
+
'prefer-spread': 'off',
|
|
36
|
+
'no-case-declarations': 'off',
|
|
37
|
+
'no-console': 'off',
|
|
38
|
+
'@typescript-eslint/no-unused-vars': ['error'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Qwik Library ⚡️
|
|
2
|
+
|
|
3
|
+
- [Qwik Docs](https://qwik.builder.io/)
|
|
4
|
+
- [Discord](https://qwik.builder.io/chat)
|
|
5
|
+
- [Qwik Github](https://github.com/BuilderIO/qwik)
|
|
6
|
+
- [@QwikDev](https://twitter.com/QwikDev)
|
|
7
|
+
- [Vite](https://vitejs.dev/)
|
|
8
|
+
- [Partytown](https://partytown.builder.io/)
|
|
9
|
+
- [Mitosis](https://github.com/BuilderIO/mitosis)
|
|
10
|
+
- [Builder.io](https://www.builder.io/)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
Inside of you project, you'll see the following directories and files:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
├── public/
|
|
20
|
+
│ └── ...
|
|
21
|
+
└── src/
|
|
22
|
+
├── components/
|
|
23
|
+
│ └── ...
|
|
24
|
+
└── index.ts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- `src/components`: Recommended directory for components.
|
|
28
|
+
|
|
29
|
+
- `index.ts`: This is the entry point of your component library, make sure all the public components are exported from this file.
|
|
30
|
+
|
|
31
|
+
## Development
|
|
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.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
npm run dev
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> Note: during dev mode, Vite will request many JS files, which does not represent a Qwik production build.
|
|
40
|
+
|
|
41
|
+
## Production
|
|
42
|
+
|
|
43
|
+
The production build should generate the production build of your component library in (./lib) and the typescript type definitions in (./lib-types).
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
npm run build
|
|
47
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Build
|
|
2
|
+
/dist
|
|
3
|
+
/lib
|
|
4
|
+
/lib-types
|
|
5
|
+
/server
|
|
6
|
+
|
|
7
|
+
# Development
|
|
8
|
+
node_modules
|
|
9
|
+
|
|
10
|
+
# Cache
|
|
11
|
+
.cache
|
|
12
|
+
.mf
|
|
13
|
+
.vscode
|
|
14
|
+
.rollup.cache
|
|
15
|
+
tsconfig.tsbuildinfo
|
|
16
|
+
|
|
17
|
+
# Logs
|
|
18
|
+
logs
|
|
19
|
+
*.log
|
|
20
|
+
npm-debug.log*
|
|
21
|
+
yarn-debug.log*
|
|
22
|
+
yarn-error.log*
|
|
23
|
+
pnpm-debug.log*
|
|
24
|
+
lerna-debug.log*
|
|
25
|
+
|
|
26
|
+
# Editor
|
|
27
|
+
!.vscode/extensions.json
|
|
28
|
+
.idea
|
|
29
|
+
.DS_Store
|
|
30
|
+
*.suo
|
|
31
|
+
*.ntvs*
|
|
32
|
+
*.njsproj
|
|
33
|
+
*.sln
|
|
34
|
+
*.sw?
|
|
35
|
+
|
|
36
|
+
# Yarn
|
|
37
|
+
.yarn/*
|
|
38
|
+
!.yarn/releases
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "qwik-library-
|
|
2
|
+
"name": "qwik-library-name",
|
|
3
3
|
"description": "Create a component library",
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./lib/index.qwik.cjs",
|
|
7
7
|
"qwik": "./lib/index.qwik.mjs",
|
|
8
8
|
"module": "./lib/index.qwik.mjs",
|
|
9
|
-
"types": "./lib
|
|
9
|
+
"types": "./lib-types/index.d.ts",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -15,16 +15,35 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"lib"
|
|
18
|
+
"lib",
|
|
19
|
+
"lib-types"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
|
-
"build": "
|
|
22
|
+
"build": "qwik build",
|
|
22
23
|
"build.lib": "vite build --mode lib",
|
|
23
24
|
"build.types": "tsc --emitDeclarationOnly",
|
|
25
|
+
"dev": "vite --mode ssr",
|
|
26
|
+
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
|
27
|
+
"fmt": "prettier --write .",
|
|
28
|
+
"fmt.check": "prettier --check .",
|
|
29
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
30
|
+
"start": "vite --open --mode ssr",
|
|
31
|
+
"qwik": "qwik",
|
|
24
32
|
"release": "np"
|
|
25
33
|
},
|
|
26
34
|
"devDependencies": {
|
|
27
|
-
"
|
|
35
|
+
"@builder.io/qwik": "0.10.0",
|
|
36
|
+
"@types/eslint": "8.4.6",
|
|
37
|
+
"@types/node": "latest",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "5.37.0",
|
|
39
|
+
"@typescript-eslint/parser": "5.37.0",
|
|
40
|
+
"eslint-plugin-qwik": "latest",
|
|
41
|
+
"eslint": "8.23.1",
|
|
42
|
+
"node-fetch": "3.2.10",
|
|
43
|
+
"np": "7.6.1",
|
|
44
|
+
"prettier": "2.7.1",
|
|
45
|
+
"typescript": "4.8.3",
|
|
46
|
+
"vite": "3.1.1"
|
|
28
47
|
},
|
|
29
48
|
"__qwik__": {
|
|
30
49
|
"priority": -1
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHAT IS THIS FILE?
|
|
3
|
+
*
|
|
4
|
+
* Development entry point using only client-side modules:
|
|
5
|
+
* - Do not use this mode in production!
|
|
6
|
+
* - No SSR
|
|
7
|
+
* - No portion of the application is pre-rendered on the server.
|
|
8
|
+
* - All of the application is running eagerly in the browser.
|
|
9
|
+
* - More code is transferred to the browser than in SSR mode.
|
|
10
|
+
* - Optimizer/Serialization/Deserialization code is not exercised!
|
|
11
|
+
*/
|
|
12
|
+
import { render, RenderOptions } from '@builder.io/qwik';
|
|
13
|
+
import Root from './root';
|
|
14
|
+
|
|
15
|
+
export default function (opts: RenderOptions) {
|
|
16
|
+
return render(document, <Root />, opts);
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT IS THIS FILE?
|
|
3
|
+
*
|
|
4
|
+
* SSR entry point, in all cases the application is render outside the browser, this
|
|
5
|
+
* entry point will be the common one.
|
|
6
|
+
*
|
|
7
|
+
* - Server (express, cloudflare...)
|
|
8
|
+
* - npm run start
|
|
9
|
+
* - npm run preview
|
|
10
|
+
* - npm run build
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
14
|
+
import { manifest } from '@qwik-client-manifest';
|
|
15
|
+
import Root from './root';
|
|
16
|
+
|
|
17
|
+
export default function (opts: RenderToStreamOptions) {
|
|
18
|
+
return renderToStream(<Root />, {
|
|
19
|
+
manifest,
|
|
20
|
+
...opts,
|
|
21
|
+
prefetchStrategy: {
|
|
22
|
+
implementation: {
|
|
23
|
+
linkInsert: null,
|
|
24
|
+
workerFetchInsert: null,
|
|
25
|
+
prefetchEvent: 'always',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|