diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..d16c893 --- /dev/null +++ b/docs/.gitignore @@ -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 diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..a84af39 --- /dev/null +++ b/docs/README.md @@ -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) diff --git a/docs/app.config.ts b/docs/app.config.ts new file mode 100644 index 0000000..45c6f57 --- /dev/null +++ b/docs/app.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "@solidjs/start/config"; +import { withSolidBase } from "../src"; + +export default defineConfig( + withSolidBase({ + ssr: true, + }), +); diff --git a/docs/package.json b/docs/package.json new file mode 100644 index 0000000..165107d --- /dev/null +++ b/docs/package.json @@ -0,0 +1,21 @@ +{ + "name": "@kobalte/solidbase-docs", + "type": "module", + "scripts": { + "dev": "vinxi dev", + "build": "vinxi build", + "start": "vinxi start" + }, + "dependencies": { + "@kobalte/solidbase": "workspace:*", + "@solidjs/router": "^0.14.7", + "@solidjs/start": "^1.0.8", + "solid-js": "^1.9.1", + "vinxi": "^0.4.3", + "@vinxi/plugin-mdx": "^3.7.2", + "solid-mdx": "^0.0.7" + }, + "engines": { + "node": ">=18" + } +} diff --git a/docs/public/favicon.ico b/docs/public/favicon.ico new file mode 100644 index 0000000..fb282da Binary files /dev/null and b/docs/public/favicon.ico differ diff --git a/docs/src/app.css b/docs/src/app.css new file mode 100644 index 0000000..3c1ab86 --- /dev/null +++ b/docs/src/app.css @@ -0,0 +1,60 @@ +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; + } +} + +.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); +} diff --git a/docs/src/app.tsx b/docs/src/app.tsx new file mode 100644 index 0000000..05b40d0 --- /dev/null +++ b/docs/src/app.tsx @@ -0,0 +1,12 @@ +import { createSignal } from "solid-js"; +import { Router } from "@solidjs/router"; +import { FileRoutes } from "@solidjs/start/router"; +import "./app.css"; + +export default function App() { + return ( + + + + ); +} diff --git a/docs/src/entry-client.tsx b/docs/src/entry-client.tsx new file mode 100644 index 0000000..0ca4e3c --- /dev/null +++ b/docs/src/entry-client.tsx @@ -0,0 +1,4 @@ +// @refresh reload +import { mount, StartClient } from "@solidjs/start/client"; + +mount(() => , document.getElementById("app")!); diff --git a/docs/src/entry-server.tsx b/docs/src/entry-server.tsx new file mode 100644 index 0000000..401eff8 --- /dev/null +++ b/docs/src/entry-server.tsx @@ -0,0 +1,21 @@ +// @refresh reload +import { createHandler, StartServer } from "@solidjs/start/server"; + +export default createHandler(() => ( + ( + + + + + + {assets} + + +
{children}
+ {scripts} + + + )} + /> +)); diff --git a/docs/src/global.d.ts b/docs/src/global.d.ts new file mode 100644 index 0000000..dc6f10c --- /dev/null +++ b/docs/src/global.d.ts @@ -0,0 +1 @@ +/// diff --git a/docs/src/routes/index.mdx b/docs/src/routes/index.mdx new file mode 100644 index 0000000..6ea3884 --- /dev/null +++ b/docs/src/routes/index.mdx @@ -0,0 +1,19 @@ +# Heading 1 + +## Heading 2 + +### Heading 3 + +#### Heading 4 + +Paragraph + +**Bold** + +_Italic_ + +- List item + +1. Numbered list item + +[Link](https://www.example.com) diff --git a/docs/tsconfig.json b/docs/tsconfig.json new file mode 100644 index 0000000..7d5871a --- /dev/null +++ b/docs/tsconfig.json @@ -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/*"] + } + } +} diff --git a/package.json b/package.json index b24189b..cd0cd6c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@kobalte/solidbase", "version": "0.0.1", "description": "Your Solid knowledgebase", - "main": "index.js", + "module": "true", "scripts": { "check": "biome check", "format": "biome check --write && prettier . --write", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c8d0db..996c658 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,6 +31,30 @@ importers: specifier: ^5.6.2 version: 5.6.2 + docs: + dependencies: + '@kobalte/solidbase': + specifier: workspace:* + version: link:.. + '@solidjs/router': + specifier: ^0.14.7 + version: 0.14.7(solid-js@1.9.1) + '@solidjs/start': + specifier: ^1.0.8 + version: 1.0.8(solid-js@1.9.1)(vinxi@0.4.3(@types/node@22.7.4)(ioredis@5.4.1)(terser@5.34.1))(vite@5.4.8(@types/node@22.7.4)(terser@5.34.1)) + '@vinxi/plugin-mdx': + specifier: ^3.7.2 + version: 3.7.2(@mdx-js/mdx@2.3.0) + solid-js: + specifier: ^1.9.1 + version: 1.9.1 + solid-mdx: + specifier: ^0.0.7 + version: 0.0.7(solid-js@1.9.1)(vite@5.4.8(@types/node@22.7.4)(terser@5.34.1)) + vinxi: + specifier: ^0.4.3 + version: 0.4.3(@types/node@22.7.4)(ioredis@5.4.1)(terser@5.34.1) + packages: '@alloc/quick-lru@5.2.0': @@ -934,6 +958,11 @@ packages: resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} engines: {node: '>=18'} + '@solidjs/router@0.14.7': + resolution: {integrity: sha512-agLf8AUz5XnW6+F64a4Iq+QQQobI5zGHQ/gUYd/WHSwcbnFpavbsiwRLob3YhWMXVX3sQyn4ekUN+uchMCRupw==} + peerDependencies: + solid-js: ^1.8.6 + '@solidjs/start@1.0.8': resolution: {integrity: sha512-5JfIa305L898GkUxVDtxqujLYqCjuekJvXDl9uysZmPqtfFMcDmJyfnfkmoIOgGRyswKcyEWySYru8ZRYCIBuw==} @@ -3913,6 +3942,10 @@ snapshots: '@sindresorhus/merge-streams@2.3.0': {} + '@solidjs/router@0.14.7(solid-js@1.9.1)': + dependencies: + solid-js: 1.9.1 + '@solidjs/start@1.0.8(solid-js@1.9.1)(vinxi@0.4.3(@types/node@22.7.4)(ioredis@5.4.1)(terser@5.34.1))(vite@5.4.8(@types/node@22.7.4)(terser@5.34.1))': dependencies: '@vinxi/plugin-directives': 0.4.3(vinxi@0.4.3(@types/node@22.7.4)(ioredis@5.4.1)(terser@5.34.1)) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..4d60b36 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +packages: + - "." + - "docs" diff --git a/src/index.ts b/src/index.ts index 5efa457..7ea5605 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,15 +5,17 @@ import mdx from "@vinxi/plugin-mdx"; export type SolidBaseConfig = {}; export function withSolidBase( - startConfig: SolidStartInlineConfig, - solidBaseConfig: SolidBaseConfig, + startConfig?: SolidStartInlineConfig, + solidBaseConfig?: SolidBaseConfig, ) { - startConfig.extensions = [ - ...new Set((startConfig.extensions ?? []).concat(["ts", "tsx"])), + const config = startConfig ?? {}; + + config.extensions = [ + ...new Set((config.extensions ?? []).concat(["md", "mdx"])), ]; - const vite = startConfig.vite; - startConfig.vite = (options) => { + const vite = config.vite; + config.vite = (options) => { const viteConfig = typeof vite === "function" ? vite(options) : vite ?? {}; viteConfig.plugins ??= []; @@ -28,5 +30,5 @@ export function withSolidBase( return viteConfig; }; - return startConfig; + return config; } diff --git a/tsconfig.json b/tsconfig.json index b1d7426..d0adc34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,30 +1,25 @@ { - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "newLine": "LF", - "allowJs": false, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": false, - "isolatedModules": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "moduleResolution": "Node", - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, - "sourceMap": true, - "lib": [ - "dom", - "esnext", - ], - "types": [ - "solid-js", - ] - }, - "exclude": [ - "node_modules" - ] + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "newLine": "LF", + "allowJs": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": false, + "isolatedModules": true, + "jsx": "preserve", + "jsxImportSource": "solid-js", + "moduleResolution": "Node", + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "sourceMap": true, + "lib": ["dom", "esnext"], + "types": ["solid-js"], + "outDir": "./dist" + }, + "include": ["src"], + "exclude": ["node_modules", "docs"] }