Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: next docs #194

Merged
merged 18 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/3-bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
attributes:
label: Reproduction
description: |
Please provide a link to a repo or Stackblitz that can reproduce the problem you ran into. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided within a reasonable time-frame, the issue will be closed.
Please provide a link to a repo or StackBlitz that can reproduce the problem you ran into. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided within a reasonable time-frame, the issue will be closed.
placeholder: Reproduction
validations:
required: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build-preview:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
Expand All @@ -30,4 +30,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: preview-build
path: sites/docs/.svelte-kit/cloudflare
path: docs/.svelte-kit/cloudflare
35 changes: 14 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ on:
push:
branches:
- main
- next
paths-ignore:
- ".changeset/**"
- README.md
- ".vscode/**"
- CHANGELOG.md
pull_request:
paths-ignore:
- ".changeset/**"
- README.md
- ".vscode/**"
- CHANGELOG.md

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
Expand All @@ -13,7 +24,7 @@ concurrency:
jobs:
Check:
name: Run svelte-check
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
Expand All @@ -29,7 +40,7 @@ jobs:
run: pnpm check

Lint:
runs-on: ubuntu-latest
runs-on: macos-latest
name: Lint
steps:
- uses: actions/checkout@v4
Expand All @@ -42,22 +53,4 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint

Test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Test
run: pnpm test
- run: pnpm lint
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

jobs:
deploy-preview:
runs-on: ubuntu-latest
runs-on: macos-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download build artifact
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on:
branches:
- main
paths:
- sites/docs/**
- docs/**
- packages/formsnap/**
workflow_dispatch:

jobs:
deploy-production:
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
contents: read
deployments: write
Expand All @@ -36,5 +37,5 @@ jobs:
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: formsnap
directory: ./.svelte-kit/cloudflare
workingDirectory: sites/docs
workingDirectory: docs
deploymentName: Production
28 changes: 28 additions & 0 deletions .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Preview Release
on:
pull_request:
types: [ready_for_review, synchronize, opened, labeled]
paths: [packages/**]

jobs:
preview-release:
if: github.repository == 'svecosystem/formsnap' && contains(github.event.pull_request.labels.*.name, 'publish:preview')
timeout-minutes: 5
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: install dependencies
run: pnpm install

- name: build
run: pnpm build:packages

- name: publish preview
run: |
pnpx [email protected] publish --pnpm --compact './packages/*'
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ jobs:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
name: Release
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
Expand All @@ -35,8 +32,6 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
commit: "chore(release): version package"
title: "chore(release): version package"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ package.json
CHANGELOG.md

vite.config.js.timestamp-*
vite.config.ts.timestamp-*
vite.config.ts.timestamp-*

docs/.velite/**/*
27 changes: 0 additions & 27 deletions .vscode/settings.json

This file was deleted.

21 changes: 14 additions & 7 deletions sites/docs/.gitignore → docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
.DS_Store
node_modules
/build

# Output
.output
.vercel
/.svelte-kit
/package
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.contentlayer
.contentlayer/
/.contentlayer
.vercel
1 change: 1 addition & 0 deletions docs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
594 changes: 594 additions & 0 deletions docs/.velite/docs.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions docs/.velite/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file is generated by Velite

import type __vc from '../velite.config.js'

type Collections = typeof __vc.collections

export type Doc = Collections['docs']['schema']['_output']
export declare const docs: Doc[]
3 changes: 3 additions & 0 deletions docs/.velite/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file is generated by Velite

export { default as docs } from './docs.json'
38 changes: 38 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# sv

Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create 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

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
18 changes: 18 additions & 0 deletions docs/mdsx.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from "mdsx";
import { baseRemarkPlugins, baseRehypePlugins } from "@svecodocs/kit/mdsxConfig";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";

const __dirname = fileURLToPath(new URL(".", import.meta.url));

export default defineConfig({
remarkPlugins: [...baseRemarkPlugins],
// @ts-expect-error shh
rehypePlugins: [...baseRehypePlugins],
blueprints: {
default: {
path: resolve(__dirname, "./src/lib/components/blueprint.svelte"),
},
},
extensions: [".md"],
});
36 changes: 36 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "docs",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "pnpm \"/dev:/\"",
"dev:content": "velite dev --watch",
"dev:svelte": "vite dev",
"build": "velite && node ./scripts/update-velite-output.js && pnpm build:search && vite build",
"build:search": "node ./scripts/build-search-data.js",
"preview": "vite preview",
"check": "velite && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "pnpm build:content && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@svecodocs/kit": "^0.1.4",
"@sveltejs/adapter-cloudflare": "^4.8.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.2",
"@tailwindcss/vite": "4.0.0-beta.6",
"bits-ui": "1.0.0-next.71",
"formsnap": "workspace:*",
"mdsx": "^0.0.6",
"phosphor-svelte": "^3.0.0",
"svelte": "^5.11.0",
"svelte-check": "^4.1.0",
"svelte-sonner": "^0.3.28",
"sveltekit-superforms": "^2.19.0",
"tailwindcss": "4.0.0-beta.6",
"typescript": "^5.0.0",
"velite": "^0.2.1",
"vite": "^5.4.11",
"zod": "^3.24.1"
}
}
24 changes: 24 additions & 0 deletions docs/scripts/build-search-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { fileURLToPath } from "node:url";
import { writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { docs } from "../.velite/index.js";
import { cleanMarkdown } from "../node_modules/@svecodocs/kit/dist/utils.js";

const __dirname = fileURLToPath(new URL(".", import.meta.url));

export function buildDocsSearchIndex() {
return docs.map((doc) => ({
title: doc.title,
href: `/docs/${doc.slug}`,
description: doc.description,
content: cleanMarkdown(doc.raw),
}));
}

const searchData = buildDocsSearchIndex();

writeFileSync(
resolve(__dirname, "../src/routes/api/search.json/search.json"),
JSON.stringify(searchData),
{ flag: "w" }
);
Loading