create-qwik 0.0.107 → 0.0.108-dev20220913212706

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.
Files changed (65) hide show
  1. package/README.md +7 -19
  2. package/create-qwik.cjs +3 -0
  3. package/package.json +9 -6
  4. package/starters/apps/base/.prettierignore +6 -0
  5. package/starters/apps/base/README.md +6 -16
  6. package/starters/apps/base/gitignore +4 -6
  7. package/starters/apps/base/package.json +16 -19
  8. package/starters/apps/base/public/favicon.ico +0 -0
  9. package/starters/apps/base/public/favicons/android-chrome-192x192.png +0 -0
  10. package/starters/apps/base/public/favicons/android-chrome-512x512.png +0 -0
  11. package/starters/apps/base/public/favicons/apple-touch-icon.png +0 -0
  12. package/starters/apps/base/public/favicons/favicon-16x16.png +0 -0
  13. package/starters/apps/base/public/favicons/favicon-32x32.png +0 -0
  14. package/starters/apps/base/public/favicons/favicon.svg +13 -0
  15. package/starters/apps/base/src/entry.preview.tsx +6 -0
  16. package/starters/apps/base/src/entry.ssr.tsx +7 -5
  17. package/starters/apps/base/tsconfig.json +5 -4
  18. package/starters/apps/base/vite.config.ts +1 -6
  19. package/starters/apps/blank/package.json +1 -16
  20. package/starters/apps/blank/src/entry.preview.tsx +19 -0
  21. package/starters/apps/blank/src/root.tsx +2 -2
  22. package/starters/apps/{qwik-city → library}/tsconfig.json +1 -4
  23. package/starters/apps/library/vite.config.ts +1 -6
  24. package/starters/apps/qwik-city/package.json +2 -13
  25. package/starters/apps/qwik-city/src/components/menu/menu.tsx +4 -4
  26. package/starters/apps/qwik-city/src/entry.ssr.tsx +17 -0
  27. package/starters/apps/qwik-city/src/root.tsx +4 -4
  28. package/starters/apps/qwik-city/src/routes/service-worker.ts +10 -0
  29. package/starters/apps/qwik-city/vite.config.ts +1 -8
  30. package/create-qwik +0 -107
  31. package/index.js +0 -22
  32. package/starters/apps/blank/src/entry.express.tsx +0 -59
  33. package/starters/apps/qwik-city/public/_headers +0 -2
  34. package/starters/apps/qwik-city/public/favicon.ico +0 -0
  35. package/starters/apps/qwik-city/public/favicons/android-chrome-192x192.png +0 -0
  36. package/starters/apps/qwik-city/public/favicons/android-chrome-256x256.png +0 -0
  37. package/starters/apps/qwik-city/public/favicons/apple-touch-icon.png +0 -0
  38. package/starters/apps/qwik-city/public/favicons/favicon.svg +0 -1
  39. package/starters/apps/qwik-city/public/logos/qwik-logo.svg +0 -1
  40. package/starters/apps/qwik-city/public/logos/qwik.svg +0 -1
  41. package/starters/features/prettier/.prettierignore +0 -23
  42. package/starters/features/prettier/package.json +0 -10
  43. package/starters/features/react/package.json +0 -26
  44. package/starters/features/react/src/entry.ssr.tsx +0 -11
  45. package/starters/features/react/src/react/app.tsx +0 -14
  46. package/starters/features/tailwindcss/package.json +0 -8
  47. package/starters/features/tailwindcss/postcss.config.cjs +0 -6
  48. package/starters/features/tailwindcss/src/global.css +0 -3
  49. package/starters/features/tailwindcss/tailwind.config.cjs +0 -7
  50. package/starters/servers/cloudflare-pages/.node-version +0 -1
  51. package/starters/servers/cloudflare-pages/README.md +0 -17
  52. package/starters/servers/cloudflare-pages/functions/[[path]].ts +0 -5
  53. package/starters/servers/cloudflare-pages/package.json +0 -18
  54. package/starters/servers/cloudflare-pages/public/_headers +0 -2
  55. package/starters/servers/cloudflare-pages/src/entry.cloudflare.tsx +0 -4
  56. package/starters/servers/express/README.md +0 -9
  57. package/starters/servers/express/package.json +0 -11
  58. package/starters/servers/express/src/entry.express.tsx +0 -31
  59. package/starters/servers/netlify-edge/.node-version +0 -1
  60. package/starters/servers/netlify-edge/README.md +0 -39
  61. package/starters/servers/netlify-edge/netlify.toml +0 -10
  62. package/starters/servers/netlify-edge/package.json +0 -19
  63. package/starters/servers/netlify-edge/public/_headers +0 -2
  64. package/starters/servers/netlify-edge/src/entry.netlify.ts +0 -6
  65. package/starters/servers/netlify-edge/tsconfig.json +0 -17
package/README.md CHANGED
@@ -1,48 +1,36 @@
1
- # Create Qwik
1
+ # Create Qwik ⚡️
2
2
 
3
3
  ## Interactive mode
4
4
 
5
5
  ```
6
- npm init qwik@latest
6
+ npm create qwik@latest
7
7
  ```
8
8
 
9
9
  ## Command mode
10
10
 
11
11
  ```
12
- npm init qwik@latest <starter> <projectName>
13
- ```
14
-
15
- #### Example:
16
-
17
- ```
18
- npm init qwik@latest todo my-app
12
+ npm create qwik@latest <starter> <projectName>
19
13
  ```
20
14
 
21
15
  ## API
22
16
 
23
17
  ```javascript
24
- const { getStarters, generateStarter } = require('create-qwik');
25
-
26
- const starters = await getStarters();
27
- console.log(starters);
18
+ const { createApp } = require('create-qwik');
28
19
 
29
20
  const opts = {
30
21
  projectName: 'my-project',
31
- appId: 'todo',
32
- serverId: 'express',
22
+ starterId: 'todo',
33
23
  outDir: '/path/to/output/dir',
34
- featureIds: [],
35
24
  };
36
25
 
37
- const result = await generateStarter(opts);
26
+ const result = await createApp(opts);
38
27
  console.log(result);
39
28
  ```
40
29
 
41
30
  ## Community
42
31
 
43
32
  - Ping us at [@QwikDev](https://twitter.com/QwikDev)
44
- - Join our [Discord](https://qwik.builder.io/chat) community.
45
- - Join our [weekly office hours](https://calendar.google.com/calendar/u/0?cid=Y180ZG91YjR2NTZ1cW43YmgzbW1oZGJ2M3R2c0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t)
33
+ - Join our [Discord](https://qwik.builder.io/chat) community
46
34
 
47
35
  ## Related
48
36
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ const createQwik = require('./index.cjs');
3
+ createQwik.runCli();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "create-qwik",
3
- "version": "0.0.107",
4
- "description": "Interactive CLI and API for generating Qwik projects.",
5
- "bin": "create-qwik",
3
+ "version": "0.0.108-dev20220913212706",
4
+ "description": "Interactive CLI for create Qwik projects and adding features.",
5
+ "bin": "./create-qwik.cjs",
6
6
  "main": "index.js",
7
7
  "files": [
8
- "create-qwik",
8
+ "create-qwik.cjs",
9
9
  "starters/"
10
10
  ],
11
11
  "author": "Builder.io Team",
@@ -13,7 +13,9 @@
13
13
  "keywords": [
14
14
  "qwik",
15
15
  "generator",
16
- "builder.io"
16
+ "builder.io",
17
+ "starters",
18
+ "template"
17
19
  ],
18
20
  "homepage": "https://qwik.builder.io/",
19
21
  "repository": {
@@ -27,10 +29,11 @@
27
29
  "devDependencies": {
28
30
  "@types/prompts": "2.0.14",
29
31
  "kleur": "4.1.5",
32
+ "ora": "^6.1.2",
30
33
  "prompts": "2.4.2"
31
34
  },
32
35
  "engines": {
33
- "node": ">=14",
36
+ "node": ">=14.18",
34
37
  "npm": ">=6.0.0"
35
38
  }
36
39
  }
@@ -0,0 +1,6 @@
1
+ # Files Prettier should not format
2
+ **/*.log
3
+ **/.DS_Store
4
+ *.
5
+ dist
6
+ node_modules
@@ -1,24 +1,14 @@
1
- ## Development Builds
1
+ ## Development Build
2
2
 
3
- ### Client only
4
-
5
- During development, the index.html is not a result of server-side rendering, but rather the Qwik app is built using client-side JavaScript only. This is ideal for development with Vite and its ability to reload modules quickly and on-demand. However, this mode is only for development and does not showcase "how" Qwik works since JavaScript is required to execute, and Vite imports many development modules for the app to work.
3
+ Server-side rendered index.html, with client-side modules prefetched and loaded by the browser.
6
4
 
7
5
  ```
8
6
  npm run dev
9
7
  ```
10
8
 
11
- ### Server-side Rendering (SSR) and Client
12
-
13
- Server-side rendered index.html, with client-side modules prefetched and loaded by the browser. This can be used to test out server-side rendered content during development, but will be slower than the client-only development builds.
14
-
15
- ```
16
- npm run dev.ssr
17
- ```
18
-
19
9
  ## Production Builds
20
10
 
21
- A production build should generate the client and server modules by running both client and server build commands.
11
+ The production build should generate the client and server modules by running both client and server build commands. Additionally, the build command will use Typescript run a type check on the source.
22
12
 
23
13
  ```
24
14
  npm run build
@@ -32,10 +22,10 @@ Production build that creates only the client-side modules that are dynamically
32
22
  npm run build.client
33
23
  ```
34
24
 
35
- ### Server Modules
25
+ ### Preview
36
26
 
37
- Production build that creates the server-side render (SSR) module that is used by the server to render the HTML.
27
+ The preview command is intended for previewing the build locally and not meant as a production server.
38
28
 
39
29
  ```
40
- npm run build.ssr
30
+ npm run preview
41
31
  ```
@@ -1,9 +1,7 @@
1
1
  # Build
2
- build
3
- dist
4
- lib
5
- server
6
- functions/**/*.js
2
+ /dist
3
+ /lib
4
+ /server
7
5
 
8
6
  # Development
9
7
  node_modules
@@ -36,4 +34,4 @@ lerna-debug.log*
36
34
 
37
35
  # Yarn
38
36
  .yarn/*
39
- !.yarn/releases
37
+ !.yarn/releases
@@ -1,35 +1,32 @@
1
1
  {
2
2
  "name": "qwik-project-name",
3
- "description": "",
4
- "license": "",
5
3
  "scripts": {
6
- "build": "npm run typecheck && npm run build.client && npm run build.ssr",
4
+ "build": "qwik build",
7
5
  "build.client": "vite build",
8
- "build.ssr": "vite build --ssr src/entry.ssr.tsx",
9
- "dev": "npm run dev.ssr",
10
- "dev.client": "vite",
11
- "dev.ssr": "node --inspect node_modules/vite/bin/vite.js --mode ssr",
12
- "dev.debug": "node --inspect-brk node_modules/vite/bin/vite.js --force --mode ssr",
13
- "start": "npm run dev",
6
+ "build.preview": "vite build --ssr src/entry.preview.tsx",
7
+ "dev": "vite --mode ssr",
8
+ "fmt": "prettier --write .",
9
+ "fmt.check": "prettier --check .",
14
10
  "lint": "eslint \"src/**/*.ts*\"",
15
- "typecheck": "tsc --incremental --noEmit"
11
+ "preview": "qwik build preview && vite preview",
12
+ "start": "vite --mode ssr",
13
+ "typecheck": "tsc --incremental --noEmit",
14
+ "qwik": "qwik"
16
15
  },
17
16
  "devDependencies": {
18
- "@builder.io/qwik": "0.0.107",
17
+ "@builder.io/qwik": "0.0.108-dev20220913212706",
18
+ "@builder.io/qwik-city": "0.0.109",
19
19
  "@types/eslint": "8.4.6",
20
20
  "@types/node": "latest",
21
21
  "@typescript-eslint/eslint-plugin": "5.34.0",
22
22
  "@typescript-eslint/parser": "5.34.0",
23
- "eslint-plugin-qwik": "0.0.107",
23
+ "eslint-plugin-qwik": "0.0.108-dev20220913212706",
24
24
  "eslint": "8.22.0",
25
25
  "node-fetch": "3.2.10",
26
+ "prettier": "2.7.1",
26
27
  "typescript": "4.7.4",
27
- "vite": "3.0.9"
28
+ "vite": "3.0.9",
29
+ "vite-tsconfig-paths": "3.5.0"
28
30
  },
29
- "type": "module",
30
- "homepage": "https://qwik.builder.io/",
31
- "private": true,
32
- "engines": {
33
- "node": "^14.18.0 || >=16.0.0"
34
- }
31
+ "private": true
35
32
  }
@@ -0,0 +1,13 @@
1
+ <svg width="500" height="500" viewBox="0 0 500 500" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_645_1322)">
3
+ <circle cx="250" cy="250" r="250" fill="white"/>
4
+ <path d="M367.865 418.452L306.699 357.271L305.765 357.405V356.734L175.687 227.529L207.739 196.402L188.908 87.7251L99.5631 199.085C84.3384 214.515 81.5338 239.604 92.4849 258.12L148.309 351.233C156.856 365.589 172.348 374.176 189.042 374.042L216.687 373.773L367.865 418.452Z" fill="#18B6F6"/>
5
+ <path d="M401.247 196.938L388.961 174.129L382.55 162.457L380.013 157.895L379.746 158.163L346.091 99.5314C337.677 84.7728 321.918 75.6493 304.824 75.7834L275.309 76.5884L187.3 76.8568C170.606 76.9909 155.381 85.8461 146.968 100.202L93.4141 207.001L189.17 87.4562L314.707 226.187L292.404 248.861L305.759 357.404L305.892 357.136V357.404H305.625L305.892 357.672L316.309 367.869L366.925 417.646C369.062 419.658 372.534 417.243 371.065 414.694L339.814 352.842L394.303 251.545L396.039 249.532C396.707 248.727 397.374 247.922 397.909 247.117C408.592 232.493 410.062 212.904 401.247 196.938Z" fill="#AC7EF4"/>
6
+ <path d="M315.106 225.651L189.168 87.5908L207.064 195.731L175.012 226.992L305.49 357.27L293.738 249.13L315.106 225.651Z" fill="white"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_645_1322">
10
+ <rect width="500" height="500" fill="white"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>
@@ -0,0 +1,6 @@
1
+ import { qwikCity } from '@builder.io/qwik-city/middleware/node';
2
+ import render from './entry.ssr';
3
+
4
+ // Create the Qwik City ssr preview middleware
5
+ // Imported by vite preview
6
+ export default qwikCity(render);
@@ -2,14 +2,16 @@ import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
2
2
  import { manifest } from '@qwik-client-manifest';
3
3
  import Root from './root';
4
4
 
5
- /**
6
- * Server-Side Render method to be called by a server.
7
- */
8
5
  export default function (opts: RenderToStreamOptions) {
9
- // Render the Root component to a string
10
- // Pass in the manifest that was generated from the client build
11
6
  return renderToStream(<Root />, {
12
7
  manifest,
13
8
  ...opts,
9
+ prefetchStrategy: {
10
+ implementation: {
11
+ linkInsert: null,
12
+ workerFetchInsert: null,
13
+ prefetchEvent: 'always',
14
+ },
15
+ },
14
16
  });
15
17
  }
@@ -3,19 +3,20 @@
3
3
  "allowJs": true,
4
4
  "target": "ES2017",
5
5
  "module": "ES2020",
6
- "lib": ["es2020", "DOM"],
6
+ "lib": ["es2020", "DOM", "WebWorker"],
7
7
  "jsx": "react-jsx",
8
8
  "jsxImportSource": "@builder.io/qwik",
9
9
  "strict": true,
10
- "declaration": true,
11
- "declarationDir": "lib/types",
12
10
  "resolveJsonModule": true,
13
11
  "moduleResolution": "node",
14
12
  "esModuleInterop": true,
15
13
  "skipLibCheck": true,
16
14
  "incremental": true,
17
15
  "isolatedModules": true,
18
- "types": ["vite/client"]
16
+ "types": ["vite/client"],
17
+ "paths": {
18
+ "~/*": ["./src/*"]
19
+ }
19
20
  },
20
21
  "include": ["src"]
21
22
  }
@@ -1,13 +1,8 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import { qwikVite } from '@builder.io/qwik/optimizer';
3
- /* VITE_IMPORTS */
4
3
 
5
4
  export default defineConfig(() => {
6
5
  return {
7
- /* VITE_CONFIG */
8
- plugins: [
9
- qwikVite(/* VITE_QWIK */),
10
- /* VITE_PLUGINS */
11
- ],
6
+ plugins: [qwikVite()],
12
7
  };
13
8
  });
@@ -1,22 +1,7 @@
1
1
  {
2
2
  "description": "Blank Qwik starter app.",
3
- "scripts": {
4
- "build.ssr": "vite build --ssr src/entry.express.tsx",
5
- "serve": "node server/entry.express"
6
- },
7
- "devDependencies": {
8
- "@types/express": "4.17.13",
9
- "express": "4.17.3"
10
- },
11
3
  "type": "module",
12
4
  "__qwik__": {
13
- "priority": 0,
14
- "featureOptions": [
15
- "prettier",
16
- "tailwindcss"
17
- ],
18
- "featureEnabled": [
19
- "prettier"
20
- ]
5
+ "priority": 0
21
6
  }
22
7
  }
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" />
2
+ import type { IncomingMessage, ServerResponse } from 'http';
3
+ import render from './entry.ssr';
4
+
5
+ // Create the Qwik ssr preview middleware
6
+ // Imported by vite preview
7
+ export default async function (req: IncomingMessage, res: ServerResponse, next: (e?: any) => void) {
8
+ try {
9
+ await render({
10
+ stream: res,
11
+ envData: {
12
+ url: `http://${req.headers.host}${req.url}`,
13
+ },
14
+ });
15
+ res.end();
16
+ } catch (e) {
17
+ next(e);
18
+ }
19
+ }
@@ -2,7 +2,7 @@ import { App } from './components/app/app';
2
2
 
3
3
  import './global.css';
4
4
 
5
- export default () => {
5
+ export default function () {
6
6
  return (
7
7
  <html>
8
8
  <head>
@@ -15,4 +15,4 @@ export default () => {
15
15
  </body>
16
16
  </html>
17
17
  );
18
- };
18
+ }
@@ -15,10 +15,7 @@
15
15
  "skipLibCheck": true,
16
16
  "incremental": true,
17
17
  "isolatedModules": true,
18
- "types": ["vite/client"],
19
- "paths": {
20
- "~/*": ["./src/*"]
21
- }
18
+ "types": ["vite/client"]
22
19
  },
23
20
  "include": ["src"]
24
21
  }
@@ -1,10 +1,8 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import { qwikVite } from '@builder.io/qwik/optimizer';
3
- /* VITE_IMPORTS */
4
3
 
5
4
  export default defineConfig(() => {
6
5
  return {
7
- /* VITE_CONFIG */
8
6
  build: {
9
7
  target: 'es2020',
10
8
  lib: {
@@ -13,9 +11,6 @@ export default defineConfig(() => {
13
11
  fileName: (format) => `index.qwik.${format === 'es' ? 'mjs' : 'cjs'}`,
14
12
  },
15
13
  },
16
- plugins: [
17
- qwikVite(/* VITE_QWIK */),
18
- /* VITE_PLUGINS */
19
- ],
14
+ plugins: [qwikVite()],
20
15
  };
21
16
  });
@@ -2,18 +2,7 @@
2
2
  "description": "File based routing and MDX support",
3
3
  "__qwik__": {
4
4
  "priority": 1,
5
- "selectServer": true,
6
- "featureOptions": [
7
- "prettier",
8
- "tailwindcss"
9
- ],
10
- "featureEnabled": [
11
- "prettier"
12
- ]
5
+ "selectServer": true
13
6
  },
14
- "type": "module",
15
- "devDependencies": {
16
- "@builder.io/qwik-city": "0.0.106",
17
- "vite-tsconfig-paths": "3.5.0"
18
- }
7
+ "type": "module"
19
8
  }
@@ -1,4 +1,4 @@
1
- import { component$, useStyles$ } from '@builder.io/qwik';
1
+ import { component$, mutable, 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 const Menu = component$(() => {
18
18
  {item.items?.map((item) => (
19
19
  <li>
20
20
  <Link
21
- href={item.href}
22
- class={{
21
+ href={mutable(item.href)}
22
+ class={mutable({
23
23
  'is-active': loc.pathname === item.href,
24
- }}
24
+ })}
25
25
  >
26
26
  {item.text}
27
27
  </Link>
@@ -0,0 +1,17 @@
1
+ import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
2
+ import { manifest } from '@qwik-client-manifest';
3
+ import Root from './root';
4
+
5
+ export default function (opts: RenderToStreamOptions) {
6
+ return renderToStream(<Root />, {
7
+ manifest,
8
+ ...opts,
9
+ prefetchStrategy: {
10
+ implementation: {
11
+ linkInsert: null,
12
+ workerFetchInsert: null,
13
+ prefetchEvent: 'always',
14
+ },
15
+ },
16
+ });
17
+ }
@@ -1,16 +1,16 @@
1
- import { component$ } from '@builder.io/qwik';
2
- import { QwikCity, RouterOutlet } from '@builder.io/qwik-city';
1
+ import { QwikCity, RouterOutlet, ServiceWorkerRegister } from '@builder.io/qwik-city';
3
2
  import { Head } from './components/head/head';
4
3
 
5
4
  import './global.css';
6
5
 
7
- export default component$(() => {
6
+ export default function () {
8
7
  return (
9
8
  <QwikCity>
10
9
  <Head />
11
10
  <body lang="en">
12
11
  <RouterOutlet />
12
+ <ServiceWorkerRegister />
13
13
  </body>
14
14
  </QwikCity>
15
15
  );
16
- });
16
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference lib="webworker" />
2
+ declare const self: ServiceWorkerGlobalScope;
3
+
4
+ import { setupServiceWorker } from '@builder.io/qwik-city/service-worker';
5
+
6
+ setupServiceWorker();
7
+
8
+ addEventListener('install', () => self.skipWaiting());
9
+
10
+ addEventListener('activate', () => self.clients.claim());
@@ -2,16 +2,9 @@ import { defineConfig } from 'vite';
2
2
  import { qwikVite } from '@builder.io/qwik/optimizer';
3
3
  import { qwikCity } from '@builder.io/qwik-city/vite';
4
4
  import tsconfigPaths from 'vite-tsconfig-paths';
5
- /* VITE_IMPORTS */
6
5
 
7
6
  export default defineConfig(() => {
8
7
  return {
9
- /* VITE_CONFIG */
10
- plugins: [
11
- qwikCity(),
12
- qwikVite(/* VITE_QWIK */),
13
- tsconfigPaths(),
14
- /* VITE_PLUGINS */
15
- ],
8
+ plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
16
9
  };
17
10
  });