Skip to content

Commit

Permalink
Merge pull request #848 from simonihmig/solid-start-app
Browse files Browse the repository at this point in the history
Add solid-start demo app boilerplate
  • Loading branch information
simonihmig authored Dec 15, 2024
2 parents 0587241 + 779c9ae commit 3c94653
Show file tree
Hide file tree
Showing 14 changed files with 3,036 additions and 269 deletions.
29 changes: 29 additions & 0 deletions apps/solid-start/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

dist
.solid
.output
.vercel
.netlify
.vinxi
app.config.timestamp_*.js

# 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 apps/solid-start/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)
3 changes: 3 additions & 0 deletions apps/solid-start/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineConfig } from "@solidjs/start/config";

export default defineConfig({});
24 changes: 24 additions & 0 deletions apps/solid-start/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "solid-start",
"private": true,
"description": "Demo app using SolidStart",
"repository": "",
"license": "MIT",
"type": "module",
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start",
"version": "vinxi version"
},
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.0.10",
"solid-js": "^1.9.2",
"vinxi": "^0.5.1"
},
"engines": {
"node": ">=18"
}
}
Binary file added apps/solid-start/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/solid-start/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
font-family: "Helvetica Neue", sans-serif;
}
20 changes: 20 additions & 0 deletions apps/solid-start/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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 - ResponsiveImage</Title>
<Suspense>{props.children}</Suspense>
</MetaProvider>
)}
>
<FileRoutes />
</Router>
);
}
4 changes: 4 additions & 0 deletions apps/solid-start/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 apps/solid-start/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 apps/solid-start/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 apps/solid-start/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>
);
}
9 changes: 9 additions & 0 deletions apps/solid-start/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Title } from '@solidjs/meta';

export default function Home() {
return (
<main>
<h1>ResponsiveImage for Solid</h1>
</main>
);
}
19 changes: 19 additions & 0 deletions apps/solid-start/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 3c94653

Please sign in to comment.