Skip to content

Commit

Permalink
mdx transform + docs project
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Oct 1, 2024
1 parent e296c48 commit 075d474
Show file tree
Hide file tree
Showing 17 changed files with 295 additions and 36 deletions.
29 changes: 29 additions & 0 deletions docs/.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 docs/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)
8 changes: 8 additions & 0 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "@solidjs/start/config";
import { withSolidBase } from "../src";

export default defineConfig(
withSolidBase({
ssr: true,
}),
);
21 changes: 21 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Binary file added docs/public/favicon.ico
Binary file not shown.
60 changes: 60 additions & 0 deletions docs/src/app.css
Original file line number Diff line number Diff line change
@@ -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);
}
12 changes: 12 additions & 0 deletions docs/src/app.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Router>
<FileRoutes />
</Router>
);
}
4 changes: 4 additions & 0 deletions docs/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 docs/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 docs/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 docs/src/routes/index.mdx
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions docs/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/*"]
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 33 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages:
- "."
- "docs"
16 changes: 9 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??= [];
Expand All @@ -28,5 +30,5 @@ export function withSolidBase(
return viteConfig;
};

return startConfig;
return config;
}
51 changes: 23 additions & 28 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"]
}

0 comments on commit 075d474

Please sign in to comment.