-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate documentation to Starlight
- Loading branch information
1 parent
75ad960
commit b81f7d9
Showing
71 changed files
with
9,336 additions
and
9,910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,15 @@ jobs: | |
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: 📦 Setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
uses: pnpm/action-setup@v4 | ||
|
||
- name: 🐧 Use Node.js v18.x | ||
- name: 🐧 Use Node.js v20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: v18.x | ||
node-version: v20.x | ||
cache: 'pnpm' | ||
cache-dependency-path: pnpm-lock.yaml | ||
|
||
|
@@ -29,11 +29,11 @@ jobs: | |
working-directory: ./ | ||
|
||
- name: 🔧 Build | ||
run: pnpm build | ||
working-directory: ./website | ||
run: pnpm doc build | ||
working-directory: ./ | ||
|
||
- name: 🚀 Deploy | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: ./website/build | ||
folder: ./documentation/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# build output | ||
dist/ | ||
# generated types | ||
.astro/ | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
|
||
# environment variables | ||
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @type {import("prettier").Config} */ | ||
export default { | ||
plugins: ['prettier-plugin-astro'], | ||
overrides: [ | ||
{ | ||
files: '*.astro', | ||
options: { | ||
parser: 'astro', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"recommendations": ["astro-build.astro-vscode"], | ||
"unwantedRecommendations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"command": "./node_modules/.bin/astro dev", | ||
"name": "Development server", | ||
"request": "launch", | ||
"type": "node-terminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Starlight Starter Kit: Basics | ||
|
||
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) | ||
|
||
``` | ||
npm create astro@latest -- --template starlight | ||
``` | ||
|
||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) | ||
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) | ||
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics) | ||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs) | ||
|
||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! | ||
## 🚀 Project Structure | ||
|
||
Inside of your Astro + Starlight project, you'll see the following folders and files: | ||
|
||
``` | ||
. | ||
├── public/ | ||
├── src/ | ||
│ ├── assets/ | ||
│ ├── content/ | ||
│ │ ├── docs/ | ||
│ │ └── config.ts | ||
│ └── env.d.ts | ||
├── astro.config.mjs | ||
├── package.json | ||
└── tsconfig.json | ||
``` | ||
|
||
Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. | ||
|
||
Images can be added to `src/assets/` and embedded in Markdown with a relative link. | ||
|
||
Static assets, like favicons, can be placed in the `public/` directory. | ||
|
||
## 🧞 Commands | ||
|
||
All commands are run from the root of the project, from a terminal: | ||
|
||
| Command | Action | | ||
| :------------------------ | :----------------------------------------------- | | ||
| `npm install` | Installs dependencies | | ||
| `npm run dev` | Starts local dev server at `localhost:4321` | | ||
| `npm run build` | Build your production site to `./dist/` | | ||
| `npm run preview` | Preview your build locally, before deploying | | ||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | | ||
| `npm run astro -- --help` | Get help using the Astro CLI | | ||
|
||
## 👀 Want to learn more? | ||
|
||
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import starlight from '@astrojs/starlight'; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
site: 'https://patronum.effector.dev', | ||
integrations: [ | ||
starlight({ | ||
title: 'effector patronum ✨', | ||
description: 'Operators library delivering modularity and convenience.', | ||
logo: { | ||
src: './src/assets/comet.png', | ||
}, | ||
editLink: { | ||
baseUrl: 'https://github.com/effector/patronum/edit/main/documentation', | ||
}, | ||
social: { | ||
github: 'https://github.com/effector/patronum', | ||
telegram: 'https://t.me/effector_en', | ||
'x.com': 'https://x.com/effectorjs', | ||
reddit: 'https://www.reddit.com/r/effectorjs/', | ||
discord: 'https://discord.gg/yHcMcuRWeC', | ||
youtube: 'https://youtube.com/@effectorjs', | ||
}, | ||
defaultLocale: 'en', | ||
locales: { | ||
root: { label: 'English', lang: 'en' }, | ||
// 'ru-RU': { label: 'Russian' }, | ||
}, | ||
sidebar: [ | ||
{ | ||
label: 'Guides', | ||
autogenerate: { directory: 'guides' }, | ||
}, | ||
{ | ||
label: 'Reference', | ||
items: [ | ||
{ | ||
label: 'Operators', | ||
link: '/operators', | ||
}, | ||
], | ||
}, | ||
], | ||
}), | ||
], | ||
experimental: { | ||
contentLayer: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "documentation", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"scripts": { | ||
"dev": "astro dev", | ||
"start": "astro dev", | ||
"sync": "astro sync", | ||
"preview": "astro preview", | ||
"build": "astro check && astro build", | ||
"astro": "astro", | ||
"format": "prettier --write ." | ||
}, | ||
"dependencies": { | ||
"@astrojs/check": "^0.9.3", | ||
"@astrojs/starlight": "^0.26.1", | ||
"astro": "^4.15.1", | ||
"sharp": "^0.32.5", | ||
"starlight-package-managers": "^0.6.0", | ||
"typescript": "^5.5.4" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-astro": "^0.14.1" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
User-agent: * | ||
Allow: / | ||
|
||
Sitemap: https://effector.patronum.dev/sitemap-index.xml |
File renamed without changes
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { defineCollection, z } from 'astro:content'; | ||
import { docsSchema } from '@astrojs/starlight/schema'; | ||
import { glob } from 'astro/loaders'; | ||
|
||
const operators = defineCollection({ | ||
type: 'content_layer', | ||
loader: glob({ pattern: '*/*.md', base: '../src' }), | ||
schema: z.object({ | ||
title: z.string(), | ||
description: z.string().optional(), | ||
slug: z.string(), | ||
group: z.enum(['predicate', 'effect', 'timeouts', 'combination', 'debug']), | ||
badge: z | ||
.object({ | ||
variant: z | ||
.enum(['note', 'danger', 'success', 'caution', 'tip', 'default']) | ||
.default('default'), | ||
text: z.string(), | ||
}) | ||
.optional(), | ||
}), | ||
}); | ||
|
||
export const collections = { | ||
docs: defineCollection({ schema: docsSchema() }), | ||
operators, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: Installation | ||
description: A guide how to use effector with patronum. | ||
--- | ||
|
||
import { PackageManagers } from 'starlight-package-managers'; | ||
|
||
<PackageManagers pkg="patronum" frame="none" /> | ||
|
||
## Usage | ||
|
||
Just import method from the root module: | ||
|
||
```js | ||
import { throttle, splitMap } from 'patronum'; | ||
``` | ||
|
||
Or from the personal module: | ||
|
||
```js | ||
import { throttle } from 'patronum/throttle'; | ||
import { splitMap } from 'patronum/split-map'; | ||
``` | ||
|
||
> Except `patronum/debug`. It is only available by personal module import. | ||
Be careful in the module naming: | ||
|
||
- Method export always exports as named export in camelCase | ||
- Module with the operator always named in param-case | ||
|
||
## Helpful reading | ||
|
||
[Prefer Operators over Methods](https://withease.effector.dev/magazine/no_methods.html) | ||
|
||
## Tests and SSR support | ||
|
||
For SSR it is very useful to automatically identify each store, so it is recommended to read article about [Stable Identifiers in Effector](https://effector.dev/en/explanation/sids/). | ||
|
||
Tests can be written without SWC or Babel-plugins, but it is recommended to use them to simplify debug and development. | ||
|
||
### SWC | ||
|
||
Install [`@effector/swc-plugin`](https://effector.dev/en/api/effector/swc-plugin/) to your project then add it to `.swcrc`: | ||
|
||
```json | ||
{ | ||
"$schema": "https://json.schemastore.org/swcrc", | ||
"jsc": { | ||
"experimental": { | ||
"plugins": [["@effector/swc-plugin", {}]] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Babel | ||
|
||
Just add `effector/babel-plugin` to your `.babelrc` or `babel.config.js` at the `"plugins"` section: | ||
|
||
```json | ||
{ | ||
"plugins": ["effector/babel-plugin"] | ||
} | ||
``` |
10 changes: 9 additions & 1 deletion
10
website/src/pages/docs/migration-guide.md → ...ion/src/content/docs/guides/migration.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.