Skip to content

Commit

Permalink
[feat] Add SolidStart plugin support (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitvinnakota-codecov authored Jul 30, 2024
1 parent 42bf08e commit 22c99a7
Show file tree
Hide file tree
Showing 58 changed files with 10,528 additions and 11,890 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-donuts-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codecov/solidstart-plugin": patch
---

Add support for SolidStart through new plugin
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const config = {
"./packages/nuxt-plugin/tsconfig.json",
"./packages/remix-vite-plugin/tsconfig.json",
"./packages/rollup-plugin/tsconfig.json",
"./packages/solidstart-plugin/tsconfig.json",
"./packages/sveltekit-plugin/tsconfig.json",
"./packages/vite-plugin/tsconfig.json",
"./packages/webpack-plugin/tsconfig.json",
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ jobs:
fail-fast: false
matrix:
example:
["next-js", "nuxt", "remix", "rollup", "sveltekit", "vite", "webpack"]
["next-js", "nuxt", "remix", "rollup", "sveltekit", "vite", "webpack", "solidstart"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -336,6 +336,8 @@ jobs:
REMIX_API_URL: ${{ secrets.CODECOV_API_URL }}
ROLLUP_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
ROLLUP_API_URL: ${{ secrets.CODECOV_API_URL }}
SOLIDSTART_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
SOLIDSTART_API_URL: ${{ secrets.CODECOV_API_URL }}
SVELTEKIT_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
SVELTEKIT_API_URL: ${{ secrets.CODECOV_API_URL }}
VITE_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
Expand All @@ -352,7 +354,7 @@ jobs:
fail-fast: false
matrix:
example:
["next-js", "nuxt", "remix", "rollup", "sveltekit", "vite", "webpack"]
["next-js", "nuxt", "remix", "rollup", "sveltekit", "vite", "webpack", "solidstart"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -408,6 +410,8 @@ jobs:
REMIX_API_URL: ${{ secrets.CODECOV_API_URL }}
ROLLUP_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
ROLLUP_API_URL: ${{ secrets.CODECOV_STAGING_API_URL }}
SOLIDSTART_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
SOLIDSTART_API_URL: ${{ secrets.CODECOV_API_URL }}
SVELTEKIT_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
SVELTEKIT_API_URL: ${{ secrets.CODECOV_API_URL }}
VITE_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
Expand All @@ -432,6 +436,7 @@ jobs:
"sveltekit-plugin",
"vite-plugin",
"webpack-plugin",
"solidstart-plugin",
]
steps:
- name: Checkout
Expand Down Expand Up @@ -498,6 +503,7 @@ jobs:
"sveltekit-plugin",
"vite-plugin",
"webpack-plugin",
"solidstart-plugin",
]
steps:
- name: Checkout
Expand Down
28 changes: 28 additions & 0 deletions examples/solidstart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

dist
.solid
.output
.vercel
.netlify
.vinxi

# Environment
.env
.env*.local

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
*.launch
.settings/

# Temp
gitignore

# System Files
.DS_Store
Thumbs.db
32 changes: 32 additions & 0 deletions examples/solidstart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SolidStart

Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);

## Creating a project

```bash
# create a new project in the current directory
npm init solid@latest

# create a new project in my-app
npm init solid@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

Solid apps are built with _presets_, which optimise your project for deployment to different environments.

By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.

## This project was created with the [Solid CLI](https://solid-cli.netlify.app)
18 changes: 18 additions & 0 deletions examples/solidstart/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from "@solidjs/start/config";
import solidPlugin from "vite-plugin-solid";
import { codecovSolidStartPlugin } from "@codecov/solidstart-plugin";

export default defineConfig({
vite: {
plugins: [
solidPlugin(),
codecovSolidStartPlugin({
enableBundleAnalysis: true,
bundleName: "@codecov/example-solidstart-app",
uploadToken: process.env.SOLIDSTART_UPLOAD_TOKEN,
apiUrl: process.env.SOLIDSTART_API_URL,
debug: true,
}) as any,
],
},
});
22 changes: 22 additions & 0 deletions examples/solidstart/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@codecov/example-solidstart-app",
"type": "module",
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start",
"version": "vinxi version"
},
"dependencies": {
"@codecov/solidstart-plugin": "workspace:^",
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.1",
"@solidjs/start": "^1.0.6",
"solid-js": "^1.8.18",
"vinxi": "^0.4.1",
"vite-plugin-solid": "^2.10.2"
},
"engines": {
"node": ">=18"
}
}
Binary file added examples/solidstart/public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions examples/solidstart/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
body {
font-family: Gordita, Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
"Helvetica Neue", sans-serif;
}

a {
margin-right: 1rem;
}

main {
text-align: center;
padding: 1em;
margin: 0 auto;
}

h1 {
color: #335d92;
text-transform: uppercase;
font-size: 4rem;
font-weight: 100;
line-height: 1.1;
margin: 4rem auto;
max-width: 14rem;
}

p {
max-width: 14rem;
margin: 2rem auto;
line-height: 1.35;
}

@media (min-width: 480px) {
h1 {
max-width: none;
}

p {
max-width: none;
}
}
22 changes: 22 additions & 0 deletions examples/solidstart/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { MetaProvider, Title } from "@solidjs/meta";
import { Router } from "@solidjs/router";
import { FileRoutes } from "@solidjs/start/router";
import { Suspense } from "solid-js";
import "./app.css";

export default function App() {
return (
<Router
root={(props) => (
<MetaProvider>
<Title>SolidStart - Basic</Title>
<a href="/">Index</a>
<a href="/about">About</a>
<Suspense>{props.children}</Suspense>
</MetaProvider>
)}
>
<FileRoutes />
</Router>
);
}
20 changes: 20 additions & 0 deletions examples/solidstart/src/components/Counter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.increment {
font-family: inherit;
font-size: inherit;
padding: 1em 2em;
color: #335d92;
background-color: rgba(68, 107, 158, 0.1);
border-radius: 2em;
border: 2px solid rgba(68, 107, 158, 0);
outline: none;
width: 200px;
font-variant-numeric: tabular-nums;
}

.increment:focus {
border: 2px solid #335d92;
}

.increment:active {
background-color: rgba(68, 107, 158, 0.2);
}
15 changes: 15 additions & 0 deletions examples/solidstart/src/components/Counter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createSignal } from "solid-js";
import "./Counter.css";

export default function Counter() {
const [count, setCount] = createSignal(0);
return (
<button
class="increment"
onClick={() => setCount(count() + 1)}
type="button"
>
Clicks: {count()}
</button>
);
}
4 changes: 4 additions & 0 deletions examples/solidstart/src/entry-client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @refresh reload
import { mount, StartClient } from "@solidjs/start/client";

mount(() => <StartClient />, document.getElementById("app")!);
21 changes: 21 additions & 0 deletions examples/solidstart/src/entry-server.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
<StartServer
document={({ assets, children, scripts }) => (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<div id="app">{children}</div>
{scripts}
</body>
</html>
)}
/>
));
1 change: 1 addition & 0 deletions examples/solidstart/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@solidjs/start/env" />
19 changes: 19 additions & 0 deletions examples/solidstart/src/routes/[...404].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Title } from "@solidjs/meta";
import { HttpStatusCode } from "@solidjs/start";

export default function NotFound() {
return (
<main>
<Title>Not Found</Title>
<HttpStatusCode code={404} />
<h1>Page Not Found</h1>
<p>
Visit{" "}
<a href="https://start.solidjs.com" target="_blank">
start.solidjs.com
</a>{" "}
to learn how to build SolidStart apps.
</p>
</main>
);
}
10 changes: 10 additions & 0 deletions examples/solidstart/src/routes/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Title } from "@solidjs/meta";

export default function Home() {
return (
<main>
<Title>About</Title>
<h1>About</h1>
</main>
);
}
19 changes: 19 additions & 0 deletions examples/solidstart/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Title } from "@solidjs/meta";
import Counter from "~/components/Counter";

export default function Home() {
return (
<main>
<Title>Hello World</Title>
<h1>Hello world!</h1>
<Counter />
<p>
Visit{" "}
<a href="https://start.solidjs.com" target="_blank">
start.solidjs.com
</a>{" "}
to learn how to build SolidStart apps.
</p>
</main>
);
}
19 changes: 19 additions & 0 deletions examples/solidstart/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"strict": true,
"noEmit": true,
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"],
},
},
}
Loading

0 comments on commit 22c99a7

Please sign in to comment.