diff --git a/packages/create-vite/src/index.ts b/packages/create-vite/src/index.ts index a333bd1986a2b4..20212c337580dd 100755 --- a/packages/create-vite/src/index.ts +++ b/packages/create-vite/src/index.ts @@ -8,6 +8,7 @@ import { blue, cyan, green, + lightBlue, lightGreen, lightRed, magenta, @@ -186,6 +187,29 @@ const FRAMEWORKS: Framework[] = [ }, ], }, + { + name: 'qwik', + display: 'Qwik', + color: lightBlue, + variants: [ + { + name: 'qwik-ts', + display: 'TypeScript', + color: lightBlue, + }, + { + name: 'qwik', + display: 'JavaScript', + color: yellow, + }, + { + name: 'custom-qwik-city', + display: 'QwikCity ↗', + color: lightBlue, + customCommand: 'npm create qwik@latest basic TARGET_DIR', + }, + ], + }, { name: 'others', display: 'Others', diff --git a/packages/create-vite/template-qwik-ts/README.md b/packages/create-vite/template-qwik-ts/README.md new file mode 100644 index 00000000000000..c813736fccfe5f --- /dev/null +++ b/packages/create-vite/template-qwik-ts/README.md @@ -0,0 +1,38 @@ +# Qwik + Vite + +## Qwik in CSR mode + +This starter is using a pure CSR (Client Side Rendering) mode. This means, that the application is fully bootstrapped in the browser. Most of Qwik innovations however take advantage of SSR (Server Side Rendering) mode. + +```ts +export default defineConfig({ + plugins: [ + qwikVite({ + csr: true, + }), + ], +}) +``` + +Use `npm create qwik@latest` to create a full production ready Qwik application, using SSR and [QwikCity](https://qwik.builder.io/docs/qwikcity/), our server-side metaframwork. + +## Usage + +```bash +$ npm install # or pnpm install or yarn install +``` + +Learn more on the [Qwik Website](https://qwik.builder.io) and join our community on our [Discord](https://qwik.builder.io/chat) + +## Available Scripts + +In the project directory, you can run: + +### `npm run dev` + +Runs the app in the development mode.
+Open [http://localhost:5173](http://localhost:5173) to view it in the browser. + +### `npm run build` + +Builds the app for production to the `dist` folder.
diff --git a/packages/create-vite/template-qwik-ts/_gitignore b/packages/create-vite/template-qwik-ts/_gitignore new file mode 100644 index 00000000000000..a547bf36d8d11a --- /dev/null +++ b/packages/create-vite/template-qwik-ts/_gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/packages/create-vite/template-qwik-ts/index.html b/packages/create-vite/template-qwik-ts/index.html new file mode 100644 index 00000000000000..d6bb24c16eb40f --- /dev/null +++ b/packages/create-vite/template-qwik-ts/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + Qwik + TS + + +
+ + + diff --git a/packages/create-vite/template-qwik-ts/package.json b/packages/create-vite/template-qwik-ts/package.json new file mode 100644 index 00000000000000..c469b33d332480 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/package.json @@ -0,0 +1,18 @@ +{ + "name": "vite-qwik", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "^5.0.2", + "vite": "^4.3.9" + }, + "dependencies": { + "@builder.io/qwik": "^1.2.5" + } +} diff --git a/packages/create-vite/template-qwik-ts/public/vite.svg b/packages/create-vite/template-qwik-ts/public/vite.svg new file mode 100644 index 00000000000000..e7b8dfb1b2a60b --- /dev/null +++ b/packages/create-vite/template-qwik-ts/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/create-vite/template-qwik-ts/src/app.css b/packages/create-vite/template-qwik-ts/src/app.css new file mode 100644 index 00000000000000..64b24cbabc0379 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/src/app.css @@ -0,0 +1,24 @@ +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.qwik:hover { + filter: drop-shadow(0 0 2em #673ab8aa); +} +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/packages/create-vite/template-qwik-ts/src/app.tsx b/packages/create-vite/template-qwik-ts/src/app.tsx new file mode 100644 index 00000000000000..3acdaacda30749 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/src/app.tsx @@ -0,0 +1,29 @@ +import { component$, useSignal } from '@builder.io/qwik' + +import qwikLogo from './assets/qwik.svg' +import viteLogo from '/vite.svg' +import './app.css' + +export const App = component$(() => { + const count = useSignal(0) + + return ( + <> +
+ + + + + + +
+

Vite + Qwik

+
+ +
+

+ Click on the Vite and Qwik logos to learn more +

+ + ) +}) diff --git a/packages/create-vite/template-qwik-ts/src/assets/qwik.svg b/packages/create-vite/template-qwik-ts/src/assets/qwik.svg new file mode 100644 index 00000000000000..08a46e2da85814 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/src/assets/qwik.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/create-vite/template-qwik-ts/src/index.css b/packages/create-vite/template-qwik-ts/src/index.css new file mode 100644 index 00000000000000..2c3fac689c7c46 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/src/index.css @@ -0,0 +1,69 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/packages/create-vite/template-qwik-ts/src/main.tsx b/packages/create-vite/template-qwik-ts/src/main.tsx new file mode 100644 index 00000000000000..931d312effc3e6 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/src/main.tsx @@ -0,0 +1,7 @@ +import '@builder.io/qwik/qwikloader.js' + +import { render } from '@builder.io/qwik' +import { App } from './app.tsx' +import './index.css' + +render(document.getElementById('app') as HTMLElement, ) diff --git a/packages/create-vite/template-qwik-ts/src/vite-env.d.ts b/packages/create-vite/template-qwik-ts/src/vite-env.d.ts new file mode 100644 index 00000000000000..11f02fe2a0061d --- /dev/null +++ b/packages/create-vite/template-qwik-ts/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/create-vite/template-qwik-ts/tsconfig.json b/packages/create-vite/template-qwik-ts/tsconfig.json new file mode 100644 index 00000000000000..9a262f041fc748 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + "jsxImportSource": "@builder.io/qwik", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/packages/create-vite/template-qwik-ts/tsconfig.node.json b/packages/create-vite/template-qwik-ts/tsconfig.node.json new file mode 100644 index 00000000000000..42872c59f5b01c --- /dev/null +++ b/packages/create-vite/template-qwik-ts/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/packages/create-vite/template-qwik-ts/vite.config.ts b/packages/create-vite/template-qwik-ts/vite.config.ts new file mode 100644 index 00000000000000..cabd66b013a920 --- /dev/null +++ b/packages/create-vite/template-qwik-ts/vite.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vite' +import { qwikVite } from '@builder.io/qwik/optimizer' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + qwikVite({ + csr: true, + }), + ], +}) diff --git a/packages/create-vite/template-qwik/README.md b/packages/create-vite/template-qwik/README.md new file mode 100644 index 00000000000000..c813736fccfe5f --- /dev/null +++ b/packages/create-vite/template-qwik/README.md @@ -0,0 +1,38 @@ +# Qwik + Vite + +## Qwik in CSR mode + +This starter is using a pure CSR (Client Side Rendering) mode. This means, that the application is fully bootstrapped in the browser. Most of Qwik innovations however take advantage of SSR (Server Side Rendering) mode. + +```ts +export default defineConfig({ + plugins: [ + qwikVite({ + csr: true, + }), + ], +}) +``` + +Use `npm create qwik@latest` to create a full production ready Qwik application, using SSR and [QwikCity](https://qwik.builder.io/docs/qwikcity/), our server-side metaframwork. + +## Usage + +```bash +$ npm install # or pnpm install or yarn install +``` + +Learn more on the [Qwik Website](https://qwik.builder.io) and join our community on our [Discord](https://qwik.builder.io/chat) + +## Available Scripts + +In the project directory, you can run: + +### `npm run dev` + +Runs the app in the development mode.
+Open [http://localhost:5173](http://localhost:5173) to view it in the browser. + +### `npm run build` + +Builds the app for production to the `dist` folder.
diff --git a/packages/create-vite/template-qwik/_gitignore b/packages/create-vite/template-qwik/_gitignore new file mode 100644 index 00000000000000..a547bf36d8d11a --- /dev/null +++ b/packages/create-vite/template-qwik/_gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/packages/create-vite/template-qwik/index.html b/packages/create-vite/template-qwik/index.html new file mode 100644 index 00000000000000..e16ad7f984fc62 --- /dev/null +++ b/packages/create-vite/template-qwik/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + Qwik + TS + + +
+ + + diff --git a/packages/create-vite/template-qwik/package.json b/packages/create-vite/template-qwik/package.json new file mode 100644 index 00000000000000..c469b33d332480 --- /dev/null +++ b/packages/create-vite/template-qwik/package.json @@ -0,0 +1,18 @@ +{ + "name": "vite-qwik", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "^5.0.2", + "vite": "^4.3.9" + }, + "dependencies": { + "@builder.io/qwik": "^1.2.5" + } +} diff --git a/packages/create-vite/template-qwik/public/vite.svg b/packages/create-vite/template-qwik/public/vite.svg new file mode 100644 index 00000000000000..e7b8dfb1b2a60b --- /dev/null +++ b/packages/create-vite/template-qwik/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/create-vite/template-qwik/src/app.css b/packages/create-vite/template-qwik/src/app.css new file mode 100644 index 00000000000000..64b24cbabc0379 --- /dev/null +++ b/packages/create-vite/template-qwik/src/app.css @@ -0,0 +1,24 @@ +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.qwik:hover { + filter: drop-shadow(0 0 2em #673ab8aa); +} +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/packages/create-vite/template-qwik/src/app.jsx b/packages/create-vite/template-qwik/src/app.jsx new file mode 100644 index 00000000000000..659d065fe5362b --- /dev/null +++ b/packages/create-vite/template-qwik/src/app.jsx @@ -0,0 +1,32 @@ +import { component$, useSignal } from '@builder.io/qwik' + +import qwikLogo from './assets/qwik.svg' +import viteLogo from '/vite.svg' +import './app.css' + +export const App = component$(() => { + const count = useSignal(0) + + return ( + <> +
+ + + + + + +
+

Vite + Qwik

+
+ +

+ Edit src/app.jsx and save to test HMR +

+
+

+ Click on the Vite and Qwik logos to learn more +

+ + ) +}) diff --git a/packages/create-vite/template-qwik/src/assets/qwik.svg b/packages/create-vite/template-qwik/src/assets/qwik.svg new file mode 100644 index 00000000000000..08a46e2da85814 --- /dev/null +++ b/packages/create-vite/template-qwik/src/assets/qwik.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/create-vite/template-qwik/src/index.css b/packages/create-vite/template-qwik/src/index.css new file mode 100644 index 00000000000000..2c3fac689c7c46 --- /dev/null +++ b/packages/create-vite/template-qwik/src/index.css @@ -0,0 +1,69 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/packages/create-vite/template-qwik/src/main.jsx b/packages/create-vite/template-qwik/src/main.jsx new file mode 100644 index 00000000000000..ef08a39af1d908 --- /dev/null +++ b/packages/create-vite/template-qwik/src/main.jsx @@ -0,0 +1,7 @@ +import '@builder.io/qwik/qwikloader.js' + +import { render } from '@builder.io/qwik' +import { App } from './app.jsx' +import './index.css' + +render(document.getElementById('app'), ) diff --git a/packages/create-vite/template-qwik/src/vite-env.d.ts b/packages/create-vite/template-qwik/src/vite-env.d.ts new file mode 100644 index 00000000000000..11f02fe2a0061d --- /dev/null +++ b/packages/create-vite/template-qwik/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/create-vite/template-qwik/vite.config.js b/packages/create-vite/template-qwik/vite.config.js new file mode 100644 index 00000000000000..cabd66b013a920 --- /dev/null +++ b/packages/create-vite/template-qwik/vite.config.js @@ -0,0 +1,11 @@ +import { defineConfig } from 'vite' +import { qwikVite } from '@builder.io/qwik/optimizer' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + qwikVite({ + csr: true, + }), + ], +})