diff --git a/docs/guide/index.md b/docs/guide/index.md index a7ab75dbfe5fb8..c257e48ceef202 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -36,6 +36,7 @@ The supported template presets are: | [preact](https://vite.new/preact) | [preact-ts](https://vite.new/preact-ts) | | [lit](https://vite.new/lit) | [lit-ts](https://vite.new/lit-ts) | | [svelte](https://vite.new/svelte) | [svelte-ts](https://vite.new/svelte-ts) | +| [solid](https://vite.new/solid) | [solid-ts](https://vite.new/solid-ts) | ## Scaffolding Your First Vite Project @@ -79,7 +80,7 @@ yarn create vite my-vue-app --template vue pnpm create vite my-vue-app --template vue ``` -See [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) for more details on each supported template: `vanilla`, `vanilla-ts`, `vue`, `vue-ts`, `react`, `react-ts`, `react-swc`, `react-swc-ts`, `preact`, `preact-ts`, `lit`, `lit-ts`, `svelte`, `svelte-ts`. +See [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) for more details on each supported template: `vanilla`, `vanilla-ts`, `vue`, `vue-ts`, `react`, `react-ts`, `react-swc`, `react-swc-ts`, `preact`, `preact-ts`, `lit`, `lit-ts`, `svelte`, `svelte-ts`, `solid`, `solid-ts`. ## Community Templates diff --git a/packages/create-vite/README.md b/packages/create-vite/README.md index 8df8f4e338f8cc..8776ab3c3aeb3c 100644 --- a/packages/create-vite/README.md +++ b/packages/create-vite/README.md @@ -57,6 +57,8 @@ Currently supported template presets include: - `lit-ts` - `svelte` - `svelte-ts` +- `solid` +- `solid-ts` You can use `.` for the project name to scaffold in the current directory. diff --git a/packages/create-vite/src/index.ts b/packages/create-vite/src/index.ts index 04e44a2c1f0429..a333bd1986a2b4 100755 --- a/packages/create-vite/src/index.ts +++ b/packages/create-vite/src/index.ts @@ -169,6 +169,23 @@ const FRAMEWORKS: Framework[] = [ }, ], }, + { + name: 'solid', + display: 'Solid', + color: blue, + variants: [ + { + name: 'solid-ts', + display: 'TypeScript', + color: blue, + }, + { + name: 'solid', + display: 'JavaScript', + color: yellow, + }, + ], + }, { name: 'others', display: 'Others', diff --git a/packages/create-vite/template-solid-ts/README.md b/packages/create-vite/template-solid-ts/README.md new file mode 100644 index 00000000000000..99613fc0a5d37f --- /dev/null +++ b/packages/create-vite/template-solid-ts/README.md @@ -0,0 +1,28 @@ +## Usage + +```bash +$ npm install # or pnpm install or yarn install +``` + +### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) + +## 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.
+It correctly bundles Solid in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +## Deployment + +Learn more about deploying your application with the [documentations](https://vitejs.dev/guide/static-deploy.html) diff --git a/packages/create-vite/template-solid-ts/_gitignore b/packages/create-vite/template-solid-ts/_gitignore new file mode 100644 index 00000000000000..a547bf36d8d11a --- /dev/null +++ b/packages/create-vite/template-solid-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-solid-ts/index.html b/packages/create-vite/template-solid-ts/index.html new file mode 100644 index 00000000000000..f399a33d3c7c09 --- /dev/null +++ b/packages/create-vite/template-solid-ts/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + Solid + TS + + +
+ + + diff --git a/packages/create-vite/template-solid-ts/package.json b/packages/create-vite/template-solid-ts/package.json new file mode 100644 index 00000000000000..35eeb544ae10eb --- /dev/null +++ b/packages/create-vite/template-solid-ts/package.json @@ -0,0 +1,19 @@ +{ + "name": "vite-solid-typescript-starter", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "solid-js": "^1.7.7" + }, + "devDependencies": { + "typescript": "^5.0.2", + "vite": "^4.3.9", + "vite-plugin-solid": "^2.7.0" + } +} diff --git a/packages/create-vite/template-solid-ts/public/vite.svg b/packages/create-vite/template-solid-ts/public/vite.svg new file mode 100644 index 00000000000000..e7b8dfb1b2a60b --- /dev/null +++ b/packages/create-vite/template-solid-ts/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/create-vite/template-solid-ts/src/App.css b/packages/create-vite/template-solid-ts/src/App.css new file mode 100644 index 00000000000000..613607d40c7e52 --- /dev/null +++ b/packages/create-vite/template-solid-ts/src/App.css @@ -0,0 +1,27 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.solid:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/packages/create-vite/template-solid-ts/src/App.tsx b/packages/create-vite/template-solid-ts/src/App.tsx new file mode 100644 index 00000000000000..93e250bf04b172 --- /dev/null +++ b/packages/create-vite/template-solid-ts/src/App.tsx @@ -0,0 +1,35 @@ +import { createSignal } from 'solid-js' +import solidLogo from './assets/solid.svg' +import viteLogo from '/vite.svg' +import './App.css' + +function App() { + const [count, setCount] = createSignal(0) + + return ( + <> +
+ + + + + + +
+

Vite + Solid

+
+ +

+ Edit src/App.tsx and save to test HMR +

+
+

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

+ + ) +} + +export default App diff --git a/packages/create-vite/template-solid-ts/src/assets/solid.svg b/packages/create-vite/template-solid-ts/src/assets/solid.svg new file mode 100644 index 00000000000000..025aa303c5e3a9 --- /dev/null +++ b/packages/create-vite/template-solid-ts/src/assets/solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/create-vite/template-solid-ts/src/index.css b/packages/create-vite/template-solid-ts/src/index.css new file mode 100644 index 00000000000000..2c3fac689c7c46 --- /dev/null +++ b/packages/create-vite/template-solid-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-solid-ts/src/index.tsx b/packages/create-vite/template-solid-ts/src/index.tsx new file mode 100644 index 00000000000000..af7bf042c3ac05 --- /dev/null +++ b/packages/create-vite/template-solid-ts/src/index.tsx @@ -0,0 +1,9 @@ +/* @refresh reload */ +import { render } from 'solid-js/web' + +import './index.css' +import App from './App' + +const root = document.getElementById('root') + +render(() => , root!) diff --git a/packages/create-vite/template-solid-ts/src/vite-env.d.ts b/packages/create-vite/template-solid-ts/src/vite-env.d.ts new file mode 100644 index 00000000000000..11f02fe2a0061d --- /dev/null +++ b/packages/create-vite/template-solid-ts/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/create-vite/template-solid-ts/tsconfig.json b/packages/create-vite/template-solid-ts/tsconfig.json new file mode 100644 index 00000000000000..3999958409cd1d --- /dev/null +++ b/packages/create-vite/template-solid-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": "preserve", + "jsxImportSource": "solid-js", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/packages/create-vite/template-solid-ts/tsconfig.node.json b/packages/create-vite/template-solid-ts/tsconfig.node.json new file mode 100644 index 00000000000000..42872c59f5b01c --- /dev/null +++ b/packages/create-vite/template-solid-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-solid-ts/vite.config.ts b/packages/create-vite/template-solid-ts/vite.config.ts new file mode 100644 index 00000000000000..4095d9be507def --- /dev/null +++ b/packages/create-vite/template-solid-ts/vite.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite' +import solid from 'vite-plugin-solid' + +export default defineConfig({ + plugins: [solid()], +}) diff --git a/packages/create-vite/template-solid/README.md b/packages/create-vite/template-solid/README.md new file mode 100644 index 00000000000000..99613fc0a5d37f --- /dev/null +++ b/packages/create-vite/template-solid/README.md @@ -0,0 +1,28 @@ +## Usage + +```bash +$ npm install # or pnpm install or yarn install +``` + +### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) + +## 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.
+It correctly bundles Solid in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +## Deployment + +Learn more about deploying your application with the [documentations](https://vitejs.dev/guide/static-deploy.html) diff --git a/packages/create-vite/template-solid/_gitignore b/packages/create-vite/template-solid/_gitignore new file mode 100644 index 00000000000000..a547bf36d8d11a --- /dev/null +++ b/packages/create-vite/template-solid/_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-solid/index.html b/packages/create-vite/template-solid/index.html new file mode 100644 index 00000000000000..7d9c3a45ee7966 --- /dev/null +++ b/packages/create-vite/template-solid/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + Solid + + +
+ + + diff --git a/packages/create-vite/template-solid/package.json b/packages/create-vite/template-solid/package.json new file mode 100644 index 00000000000000..5ed5dd9f91991c --- /dev/null +++ b/packages/create-vite/template-solid/package.json @@ -0,0 +1,18 @@ +{ + "name": "vite-solid-starter", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "solid-js": "^1.7.7" + }, + "devDependencies": { + "vite": "^4.3.9", + "vite-plugin-solid": "^2.7.0" + } +} diff --git a/packages/create-vite/template-solid/public/vite.svg b/packages/create-vite/template-solid/public/vite.svg new file mode 100644 index 00000000000000..e7b8dfb1b2a60b --- /dev/null +++ b/packages/create-vite/template-solid/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/create-vite/template-solid/src/App.css b/packages/create-vite/template-solid/src/App.css new file mode 100644 index 00000000000000..613607d40c7e52 --- /dev/null +++ b/packages/create-vite/template-solid/src/App.css @@ -0,0 +1,27 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.solid:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/packages/create-vite/template-solid/src/App.jsx b/packages/create-vite/template-solid/src/App.jsx new file mode 100644 index 00000000000000..63b8025d125f09 --- /dev/null +++ b/packages/create-vite/template-solid/src/App.jsx @@ -0,0 +1,35 @@ +import { createSignal } from 'solid-js' +import solidLogo from './assets/solid.svg' +import viteLogo from '/vite.svg' +import './App.css' + +function App() { + const [count, setCount] = createSignal(0) + + return ( + <> +
+ + + + + + +
+

Vite + Solid

+
+ +

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

+
+

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

+ + ) +} + +export default App diff --git a/packages/create-vite/template-solid/src/assets/solid.svg b/packages/create-vite/template-solid/src/assets/solid.svg new file mode 100644 index 00000000000000..025aa303c5e3a9 --- /dev/null +++ b/packages/create-vite/template-solid/src/assets/solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/create-vite/template-solid/src/index.css b/packages/create-vite/template-solid/src/index.css new file mode 100644 index 00000000000000..2c3fac689c7c46 --- /dev/null +++ b/packages/create-vite/template-solid/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-solid/src/index.jsx b/packages/create-vite/template-solid/src/index.jsx new file mode 100644 index 00000000000000..ab0c0929b48615 --- /dev/null +++ b/packages/create-vite/template-solid/src/index.jsx @@ -0,0 +1,9 @@ +/* @refresh reload */ +import { render } from 'solid-js/web' + +import './index.css' +import App from './App' + +const root = document.getElementById('root') + +render(() => , root) diff --git a/packages/create-vite/template-solid/vite.config.js b/packages/create-vite/template-solid/vite.config.js new file mode 100644 index 00000000000000..4095d9be507def --- /dev/null +++ b/packages/create-vite/template-solid/vite.config.js @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite' +import solid from 'vite-plugin-solid' + +export default defineConfig({ + plugins: [solid()], +})