Skip to content

Commit 50877a9

Browse files
committed
feat(examples): add solidjs example using cli codemod
1 parent fa280da commit 50877a9

File tree

15 files changed

+304
-0
lines changed

15 files changed

+304
-0
lines changed

examples/solid/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

examples/solid/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Usage
2+
3+
```bash
4+
$ npm install # or pnpm install or yarn install
5+
```
6+
7+
### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs)
8+
9+
## Available Scripts
10+
11+
In the project directory, you can run:
12+
13+
### `npm run dev`
14+
15+
Runs the app in the development mode.<br>
16+
Open [http://localhost:5173](http://localhost:5173) to view it in the browser.
17+
18+
### `npm run build`
19+
20+
Builds the app for production to the `dist` folder.<br>
21+
It correctly bundles Solid in production mode and optimizes the build for the best performance.
22+
23+
The build is minified and the filenames include the hashes.<br>
24+
Your app is ready to be deployed!
25+
26+
## Deployment
27+
28+
Learn more about deploying your application with the [documentations](https://vite.dev/guide/static-deploy.html)

examples/solid/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>solid</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/index.tsx"></script>
12+
</body>
13+
</html>

examples/solid/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "solid",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc -b && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"solid-js": "^1.9.10"
13+
},
14+
"devDependencies": {
15+
"@mcpc-tech/unplugin-dev-inspector-mcp": "workspace:*",
16+
"@types/node": "^24.10.1",
17+
"typescript": "~5.9.3",
18+
"vite": "^7.2.4",
19+
"vite-plugin-solid": "^2.11.10"
20+
}
21+
}

examples/solid/public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

examples/solid/src/App.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+
8+
.logo {
9+
height: 6em;
10+
padding: 1.5em;
11+
will-change: filter;
12+
transition: filter 300ms;
13+
}
14+
.logo:hover {
15+
filter: drop-shadow(0 0 2em #646cffaa);
16+
}
17+
.logo.solid:hover {
18+
filter: drop-shadow(0 0 2em #61dafbaa);
19+
}
20+
21+
.card {
22+
padding: 2em;
23+
}
24+
25+
.read-the-docs {
26+
color: #888;
27+
}

examples/solid/src/App.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { createSignal } from 'solid-js'
2+
import solidLogo from './assets/solid.svg'
3+
import viteLogo from '/vite.svg'
4+
import './App.css'
5+
6+
function App() {
7+
const [count, setCount] = createSignal(0)
8+
9+
return (
10+
<>
11+
<div>
12+
<a href="https://vite.dev" target="_blank">
13+
<img src={viteLogo} class="logo" alt="Vite logo" />
14+
</a>
15+
<a href="https://solidjs.com" target="_blank">
16+
<img src={solidLogo} class="logo solid" alt="Solid logo" />
17+
</a>
18+
</div>
19+
<h1>Vite + Solid</h1>
20+
<div class="card">
21+
<button onClick={() => setCount((count) => count + 1)}>
22+
count is {count()}
23+
</button>
24+
<p>
25+
Edit <code>src/App.tsx</code> and save to test HMR
26+
</p>
27+
</div>
28+
<p class="read-the-docs">
29+
Click on the Vite and Solid logos to learn more
30+
</p>
31+
</>
32+
)
33+
}
34+
35+
export default App
Lines changed: 1 addition & 0 deletions
Loading

examples/solid/src/index.css

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
:root {
2+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3+
line-height: 1.5;
4+
font-weight: 400;
5+
6+
color-scheme: light dark;
7+
color: rgba(255, 255, 255, 0.87);
8+
background-color: #242424;
9+
10+
font-synthesis: none;
11+
text-rendering: optimizeLegibility;
12+
-webkit-font-smoothing: antialiased;
13+
-moz-osx-font-smoothing: grayscale;
14+
}
15+
16+
a {
17+
font-weight: 500;
18+
color: #646cff;
19+
text-decoration: inherit;
20+
}
21+
a:hover {
22+
color: #535bf2;
23+
}
24+
25+
body {
26+
margin: 0;
27+
display: flex;
28+
place-items: center;
29+
min-width: 320px;
30+
min-height: 100vh;
31+
}
32+
33+
h1 {
34+
font-size: 3.2em;
35+
line-height: 1.1;
36+
}
37+
38+
button {
39+
border-radius: 8px;
40+
border: 1px solid transparent;
41+
padding: 0.6em 1.2em;
42+
font-size: 1em;
43+
font-weight: 500;
44+
font-family: inherit;
45+
background-color: #1a1a1a;
46+
cursor: pointer;
47+
transition: border-color 0.25s;
48+
}
49+
button:hover {
50+
border-color: #646cff;
51+
}
52+
button:focus,
53+
button:focus-visible {
54+
outline: 4px auto -webkit-focus-ring-color;
55+
}
56+
57+
@media (prefers-color-scheme: light) {
58+
:root {
59+
color: #213547;
60+
background-color: #ffffff;
61+
}
62+
a:hover {
63+
color: #747bff;
64+
}
65+
button {
66+
background-color: #f9f9f9;
67+
}
68+
}

examples/solid/src/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* @refresh reload */
2+
import { render } from 'solid-js/web'
3+
import './index.css'
4+
import App from './App.tsx'
5+
6+
const root = document.getElementById('root')
7+
8+
render(() => <App />, root!)

0 commit comments

Comments
 (0)