lint: добавление линтера #5
+3
-3
@@ -1,4 +1,4 @@
|
||||
title: "Title example"
|
||||
title: 'Title example'
|
||||
project:
|
||||
org: "example"
|
||||
repo: "example"
|
||||
org: 'example'
|
||||
repo: 'example'
|
||||
|
||||
@@ -14,7 +14,8 @@ yarn
|
||||
yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
This command starts a local development server and opens up a browser window. Most changes are
|
||||
reflected live without having to restart the server.
|
||||
|
||||
## Build
|
||||
|
||||
@@ -22,4 +23,5 @@ This command starts a local development server and opens up a browser window. Mo
|
||||
yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
This command generates static content into the `build` directory and can be served using any static
|
||||
contents hosting service.
|
||||
|
||||
+13
-18
@@ -1,9 +1,9 @@
|
||||
import fs from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
import type {Config} from '@docusaurus/types';
|
||||
import { themes as prismThemes } from 'prism-react-renderer';
|
||||
import type { Config } from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
import type {NavbarItem} from '@docusaurus/theme-common'
|
||||
import type { NavbarItem } from '@docusaurus/theme-common';
|
||||
|
||||
interface DocsConfig {
|
||||
title: string;
|
||||
@@ -13,24 +13,17 @@ interface DocsConfig {
|
||||
|
||||
const docsConfig = yaml.load(fs.readFileSync('./.docuservix.yml', 'utf8')) as DocsConfig;
|
||||
|
||||
const {
|
||||
title,
|
||||
} = docsConfig
|
||||
const { title } = docsConfig;
|
||||
|
||||
const url = process.env.DOCUSERVIX_URL;
|
||||
|
||||
const {
|
||||
org,
|
||||
repo
|
||||
} = docsConfig.project
|
||||
const { org, repo } = docsConfig.project;
|
||||
|
||||
const {
|
||||
docs: docsDir = 'docs',
|
||||
blog: blogDir
|
||||
} = docsConfig.dirs || {}
|
||||
const { docs: docsDir = 'docs', blog: blogDir } = docsConfig.dirs || {};
|
||||
|
||||
const giteaUrl = 'https://git.jt4d.ru';
|
||||
const onBrokenLinks = (process.env.DOCUSERVIX_ON_BROKEN_LINKS as Config['onBrokenLinks']) || 'throw';
|
||||
const onBrokenLinks =
|
||||
(process.env.DOCUSERVIX_ON_BROKEN_LINKS as Config['onBrokenLinks']) || 'throw';
|
||||
|
||||
const config: Config = {
|
||||
title,
|
||||
@@ -107,11 +100,13 @@ const config: Config = {
|
||||
label: 'Документация',
|
||||
position: 'left',
|
||||
},
|
||||
blogDir ? {
|
||||
blogDir
|
||||
? {
|
||||
to: '/blog',
|
||||
label: 'Блог',
|
||||
position: 'left'
|
||||
} : undefined,
|
||||
position: 'left',
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
href: `${giteaUrl}/${org}/${repo}`,
|
||||
label: 'Gitea',
|
||||
|
||||
+21
-18
@@ -3,20 +3,35 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"deploy": "docusaurus deploy",
|
||||
"docusaurus": "docusaurus",
|
||||
"prepare": "husky",
|
||||
"prettier:check": "prettier --check \"**/*.{ts,tsx,js,mjs,json,yml,yaml,md,mdx}\"",
|
||||
"prettier:fix": "prettier --write \"**/*.{ts,tsx,js,mjs,json,yml,yaml,md,mdx}\"",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"start": "docusaurus start",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"typecheck": "tsc",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"typecheck": "tsc"
|
||||
"write-translations": "docusaurus write-translations"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{json,ts,tsx,js,jsx,js,mjs,md,mdx,yaml,yml}": "prettier --write"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 3 chrome version",
|
||||
"last 3 firefox version",
|
||||
"last 5 safari version"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.10.1",
|
||||
"@docusaurus/faster": "3.10.1",
|
||||
@@ -40,18 +55,6 @@
|
||||
"prettier": "^3.8.4",
|
||||
"typescript": "~6.0.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 3 chrome version",
|
||||
"last 3 firefox version",
|
||||
"last 5 safari version"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ function pinIndexToTop() {
|
||||
const frontMatter = content.slice(4, endIdx);
|
||||
if (/^sidebar_position\s*:/m.test(frontMatter)) return;
|
||||
|
||||
content = '---\nsidebar_position: 0\n' + frontMatter + '\n---\n' + content.slice(endIdx + 5);
|
||||
content =
|
||||
'---\nsidebar_position: 0\n' + frontMatter + '\n---\n' + content.slice(endIdx + 5);
|
||||
} else {
|
||||
content = '---\nsidebar_position: 0\n---\n' + content;
|
||||
}
|
||||
|
||||
+11
-6
@@ -1,4 +1,4 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
@@ -8,18 +8,22 @@ import Heading from '@theme/Heading';
|
||||
import styles from './index.module.css';
|
||||
|
||||
function HomepageHeader() {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
return (
|
||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||
<div className="container">
|
||||
<Heading as="h1" className="hero__title">
|
||||
<Heading
|
||||
as="h1"
|
||||
className="hero__title"
|
||||
>
|
||||
{siteConfig.title}
|
||||
</Heading>
|
||||
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
||||
<div className={styles.buttons}>
|
||||
<Link
|
||||
className="button button--secondary button--lg"
|
||||
to="/docs">
|
||||
to="/docs"
|
||||
>
|
||||
Документация
|
||||
</Link>
|
||||
</div>
|
||||
@@ -29,11 +33,12 @@ function HomepageHeader() {
|
||||
}
|
||||
|
||||
export default function Home(): ReactNode {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
title={`Hello from ${siteConfig.title}`}
|
||||
description="Description will go into a meta tag in <head />">
|
||||
description="Description will go into a meta tag in <head />"
|
||||
>
|
||||
<HomepageHeader />
|
||||
</Layout>
|
||||
);
|
||||
|
||||
+4
-1
@@ -8,5 +8,8 @@
|
||||
"ignoreDeprecations": "6.0",
|
||||
"strict": true
|
||||
},
|
||||
"exclude": [".docusaurus", "build"]
|
||||
"exclude": [
|
||||
".docusaurus",
|
||||
"build"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user