Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(create-vite): add solidjs templates (#12218) #12241

Merged
merged 48 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a5da63b
feat(create-vite): add solid javascript template
AbdelrahmanDwedar Feb 28, 2023
62da498
feat(create-vite): add solid typescript template
AbdelrahmanDwedar Feb 28, 2023
f07f788
feat(create-vite): add the solid framework to frameworks list
AbdelrahmanDwedar Feb 28, 2023
b925aff
fix(solid template): start following the style of vite projects
AbdelrahmanDwedar Mar 1, 2023
a0f9415
fix(solid templates): add "template" to the name of the directory
AbdelrahmanDwedar Mar 1, 2023
1fa253a
fix(solid template): add the recommanded gitignore files
AbdelrahmanDwedar Mar 1, 2023
e0bfd1e
fix(solid template): rename template-solid-js to template-solid
AbdelrahmanDwedar Mar 1, 2023
2db8466
fix(solid template): add the recommanded html template
AbdelrahmanDwedar Mar 1, 2023
fde969a
fix(solid template): add the recommanded package.json
AbdelrahmanDwedar Mar 1, 2023
72ed3c5
fix(solid template): fixed code error in template
AbdelrahmanDwedar Mar 1, 2023
38dde55
fix(solid template): fixed a typo
AbdelrahmanDwedar Mar 1, 2023
2746535
fix(solid template): Removed unneeded configurations
AbdelrahmanDwedar Mar 1, 2023
6b20f18
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 2, 2023
ffd9a0a
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 4, 2023
f4ed87c
update the version of the packages
AbdelrahmanDwedar Apr 4, 2023
3e64960
docs: add the docs for solid template
AbdelrahmanDwedar Apr 5, 2023
f19cc1e
docs: fix format
AbdelrahmanDwedar Apr 5, 2023
aa1a689
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 5, 2023
4d42420
fix: fixed typo in readme
AbdelrahmanDwedar Apr 5, 2023
2fa4c45
fix(docs): fix docs issues
AbdelrahmanDwedar Apr 5, 2023
93a36db
fix(home): fixed the css import and the logo alt
AbdelrahmanDwedar Apr 5, 2023
15053d9
fix: removed jsconfig
AbdelrahmanDwedar Apr 5, 2023
e1ea34c
fix(tsconfig): update to the new format to match the other templates
AbdelrahmanDwedar Apr 5, 2023
8b15600
fix(docs): add the right command for dev environment
AbdelrahmanDwedar Apr 5, 2023
3d399c8
fix(docs): use the right extension in the file name
AbdelrahmanDwedar Apr 5, 2023
58f450f
fix: use normal css files instead of modules
AbdelrahmanDwedar Apr 5, 2023
4a4695d
fix(docs): add the right command for dev environment
AbdelrahmanDwedar Apr 5, 2023
9092306
fix: fix all the left issues
AbdelrahmanDwedar Apr 7, 2023
2986219
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 7, 2023
ffad51c
fix: remove unneeded error throw
AbdelrahmanDwedar Apr 7, 2023
9b6b80e
fix: use the index.{t,j}sx file instead of main.{t,j}sx
AbdelrahmanDwedar Apr 7, 2023
8526721
fix: use the preserve option for the jsx
AbdelrahmanDwedar Apr 7, 2023
c1219f6
fix: use the right function for the signal
AbdelrahmanDwedar Apr 7, 2023
adcea94
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 7, 2023
1a5a95c
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 14, 2023
baa8f50
fix: put typescript first
AbdelrahmanDwedar Apr 16, 2023
fcba8e2
fix: remove unneeded class
AbdelrahmanDwedar Apr 16, 2023
3721cd8
fix(docs): add docs for deployment
AbdelrahmanDwedar Apr 16, 2023
c105f5d
fix: remove the spinning logo
AbdelrahmanDwedar Apr 21, 2023
e97dc9b
fix: add the vite-env.d.ts
AbdelrahmanDwedar Apr 21, 2023
8becd94
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Apr 21, 2023
97529eb
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar May 12, 2023
1f79326
fix: add jsxImportSource
AbdelrahmanDwedar May 12, 2023
909c6e2
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar May 18, 2023
c6af16a
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar May 23, 2023
dff6293
Merge branch 'vitejs:main' into solidjs-template
AbdelrahmanDwedar Jun 8, 2023
c08ea56
Apply updates from React template
ArnaudBarre Jun 16, 2023
be17e47
chore: flip dev and devdep
bluwy Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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

Expand Down Expand Up @@ -77,7 +78,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

Expand Down
2 changes: 2 additions & 0 deletions packages/create-vite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
17 changes: 17 additions & 0 deletions packages/create-vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@ const FRAMEWORKS: Framework[] = [
},
],
},
{
name: 'solid',
display: 'Solid',
color: blue,
variants: [
{
name: 'solid-ts',
AbdelrahmanDwedar marked this conversation as resolved.
Show resolved Hide resolved
display: 'TypeScript',
color: blue,
},
{
name: 'solid',
display: 'JavaScript',
color: yellow,
},
],
},
{
name: 'others',
display: 'Others',
Expand Down
28 changes: 28 additions & 0 deletions packages/create-vite/template-solid-ts/README.md
Original file line number Diff line number Diff line change
@@ -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.<br>
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.<br>
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.<br>
Your app is ready to be deployed!

## Deployment

Learn more about deploying your application with the [documentations](https://vitejs.dev/guide/static-deploy.html)
24 changes: 24 additions & 0 deletions packages/create-vite/template-solid-ts/_gitignore
Original file line number Diff line number Diff line change
@@ -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?
13 changes: 13 additions & 0 deletions packages/create-vite/template-solid-ts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Solid + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions packages/create-vite/template-solid-ts/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
1 change: 1 addition & 0 deletions packages/create-vite/template-solid-ts/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions packages/create-vite/template-solid-ts/src/App.css
Original file line number Diff line number Diff line change
@@ -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;
}
35 changes: 35 additions & 0 deletions packages/create-vite/template-solid-ts/src/App.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} class="logo" alt="Vite logo" />
</a>
<a href="https://solidjs.com" target="_blank">
<img src={solidLogo} class="logo solid" alt="Solid logo" />
</a>
</div>
<h1>Vite + Solid</h1>
<div class="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count()}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p class="read-the-docs">
Click on the Vite and Solid logos to learn more
</p>
</>
)
}

export default App
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions packages/create-vite/template-solid-ts/src/index.css
Original file line number Diff line number Diff line change
@@ -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;
}
}
9 changes: 9 additions & 0 deletions packages/create-vite/template-solid-ts/src/index.tsx
Original file line number Diff line number Diff line change
@@ -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(() => <App />, root!)
1 change: 1 addition & 0 deletions packages/create-vite/template-solid-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
26 changes: 26 additions & 0 deletions packages/create-vite/template-solid-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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" }]
}
10 changes: 10 additions & 0 deletions packages/create-vite/template-solid-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
6 changes: 6 additions & 0 deletions packages/create-vite/template-solid-ts/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid'

export default defineConfig({
plugins: [solid()],
})
28 changes: 28 additions & 0 deletions packages/create-vite/template-solid/README.md
Original file line number Diff line number Diff line change
@@ -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.<br>
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.<br>
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.<br>
Your app is ready to be deployed!

## Deployment

Learn more about deploying your application with the [documentations](https://vitejs.dev/guide/static-deploy.html)
24 changes: 24 additions & 0 deletions packages/create-vite/template-solid/_gitignore
Original file line number Diff line number Diff line change
@@ -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?
Loading