Skip to content

Commit

Permalink
feat: add new docs website
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Jul 22, 2024
1 parent 44edb63 commit 76b29e8
Show file tree
Hide file tree
Showing 200 changed files with 14,491 additions and 5,659 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaults and supports es6-module
4 changes: 4 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ runs:
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
shell: bash

- name: Generate content collection types
run: pnpm exec astro sync
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/install-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './docs/.vitepress/dist'
publish-dir: './dist'
production-branch: main
deploy-message: 'deploy from github actions'
enable-pull-request-comment: false
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ on:
pull_request:

jobs:
astro:
name: Astro
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Tools
uses: ./.github/actions/install-tools

- name: Install Dependencies
uses: ./.github/actions/install-dependencies

- name: Test
run: pnpm test:astro

css:
name: CSS
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,6 +75,23 @@ jobs:
- name: Test
run: pnpm test:js

svelte:
name: Svelte
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Tools
uses: ./.github/actions/install-tools

- name: Install Dependencies
uses: ./.github/actions/install-dependencies

- name: Test
run: pnpm test:svelte

types:
name: Types
runs-on: ubuntu-latest
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ dist/
.vscode/
.vim/

# VitePress
docs/.vitepress/cache/
docs/.vitepress/temp/
# Astro
.astro/

# Test
coverage/
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/*.mdx
changelog.md
package.json
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"plugins": ["prettier-plugin-astro", "prettier-plugin-svelte"],
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "lf",
Expand All @@ -10,6 +11,18 @@
"trailingComma": "all",
"useTabs": false,
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
},
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
},
{
"files": "index.ts",
"options": {
Expand Down
4 changes: 2 additions & 2 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "@azat-io/stylelint-config",
"ignoreFiles": ["coverage/**/*", "docs/.vitepress/dist/**/*"],
"ignoreFiles": ["coverage/**/*"],
"overrides": [
{
"files": ["**/*.vue"],
"files": ["**/*.astro", "**/*.svelte"],
"customSyntax": "postcss-html"
}
]
Expand Down
96 changes: 96 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import rehypeExternalLinks from 'rehype-external-links'
import { browserslistToTargets } from 'lightningcss'
import svelteSvg from '@poppanator/sveltekit-svg'
import remarkSectionize from 'remark-sectionize'
import { defineConfig } from 'astro/config'
import compress from '@playform/compress'
import { fileURLToPath } from 'node:url'
import browserslist from 'browserslist'
import sitemap from '@astrojs/sitemap'
import svelte from '@astrojs/svelte'
import mdx from '@astrojs/mdx'
import path from 'node:path'

import { remarkHeadings } from './docs/plugins/remark-headings'
import { colorTheme } from './docs/utils/shiki-theme'

let dirname = fileURLToPath(path.dirname(import.meta.url))

export default defineConfig({
markdown: {
shikiConfig: {
transformers: [
{
pre: node => {
delete node.properties.tabindex
delete node.properties.style
},
},
],
theme: colorTheme,
},
rehypePlugins: [
[
rehypeExternalLinks,
{
rel: ['noopener', 'noreferrer'],
target: '_blank',
},
],
],
remarkPlugins: [remarkSectionize, remarkHeadings],
},
vite: {
css: {
lightningcss: {
targets: browserslistToTargets(
browserslist(null, {
config: path.join(dirname, './.browserslistrc'),
}),
),
},
transformer: 'lightningcss',
},
plugins: [
// @ts-ignore
svelteSvg(),
],
},
integrations: [
compress({
JavaScript: true,
Image: true,
CSS: false,
HTML: true,
SVG: true,
}),
svelte({
compilerOptions: {
cssHash: ({ hash, css }) => `s-${hash(css)}`,
discloseVersion: false,
},
}),
sitemap(),
mdx(),
],
prefetch: {
defaultStrategy: 'viewport',
prefetchAll: true,
},
build: {
inlineStylesheets: 'always',
format: 'file',
},
experimental: {
clientPrerender: true,
},
publicDir: path.join(dirname, './docs/public'),
server: {
port: 3000,
host: true,
},
srcDir: path.join(dirname, './docs'),
root: path.join(dirname, './docs'),
site: 'https://perfectionist.dev',
compressHTML: true,
})
Loading

0 comments on commit 76b29e8

Please sign in to comment.