Skip to content

build: Update Docusaurus to v3 #52

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

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub Pages
name: Deploy to GitHub Pages

on:
push:
@@ -8,37 +8,27 @@ on:
- '.github/workflows/pages.yml'
- 'website/**'

permissions:
contents: write

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18
cache: yarn

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-website-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-website-
- run: yarn install --frozen-lockfile
- run: yarn docusaurus write-translations

- name: Sync translations
uses: crowdin/github-action@1.4.12
with:
@@ -50,9 +40,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

- run: yarn build
- name: Build website
run: yarn build

- name: Deploy pages
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/develop' }}
with:
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
### Housekeeping

- Update Gradle to 8.4
- Update Docusaurus to 3.0

## [v0.1.3] (2022-08-27)

27 changes: 20 additions & 7 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
// @ts-check

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
import {themes as prismThemes} from 'prism-react-renderer';

const defaultLocale = 'en';

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'ECInventory',
tagline: 'Change inventories how you need',
favicon: 'img/favicon.ico',

url: 'https://endlesscodegroup.github.io',
baseUrl: '/ECInventory/',
trailingSlash: false,
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',

// GitHub pages deployment config.
organizationName: 'EndlessCodeGroup',
projectName: 'ECInventory',

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

i18n: {
defaultLocale: defaultLocale,
locales: ['en', 'ru'],
@@ -99,10 +103,19 @@ const config = {
copyright: `Copyright © ${new Date().getFullYear()} EndlessCode Group. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),

// https://docusaurus.io/docs/migration/v3#turn-off-mdx-v1-compat
markdown: {
mdx1Compat: {
comments: false,
admonitions: false,
headingIds: true,
},
},
};

module.exports = config;
27 changes: 12 additions & 15 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -15,20 +15,17 @@
"dev": "docusaurus start"
},
"dependencies": {
"@docusaurus/core": "^2.1.0",
"@docusaurus/preset-classic": "^2.1.0",
"@mdx-js/react": "^1.6.22",
"@docusaurus/core": "3.0.0",
"@docusaurus/preset-classic": "3.0.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"prism-react-renderer": "^2.1.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.1"
},
"resolutions": {
"update-notifier": "^6.0.2",
"trim": "^1.0.1"
"@docusaurus/module-type-aliases": "3.0.0",
"@docusaurus/types": "3.0.0"
},
"browserslist": {
"production": [
@@ -37,12 +34,12 @@
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
"last 3 chrome version",
"last 3 firefox version",
"last 5 safari version"
]
},
"engines": {
"node": ">=16.14"
"node": ">=18.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import clsx from 'clsx';
import styles from './HomepageFeatures.module.css';
import Heading from '@theme/Heading';
import styles from './styles.module.css';

const FeatureList = [
{
@@ -36,7 +36,7 @@ function Feature({title, description}) {
return (
<div className={clsx('col col--4')}>
<div className="text--center padding-horiz--md">
<h3>{title}</h3>
<Heading as="h3">{title}</Heading>
<p>{description}</p>
</div>
</div>
34 changes: 18 additions & 16 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
@@ -6,23 +6,25 @@

/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: rgb(33, 175, 144);
--ifm-color-primary-darker: rgb(31, 165, 136);
--ifm-color-primary-darkest: rgb(26, 136, 112);
--ifm-color-primary-light: rgb(70, 203, 174);
--ifm-color-primary-lighter: rgb(102, 212, 189);
--ifm-color-primary-lightest: rgb(146, 224, 208);
--ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}

.docusaurus-highlight-code-line {
background-color: rgba(0, 0, 0, 0.1);
display: block;
margin: 0 calc(-1 * var(--ifm-pre-padding));
padding: 0 var(--ifm-pre-padding);
}

html[data-theme='dark'] .docusaurus-highlight-code-line {
background-color: rgba(0, 0, 0, 0.3);
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
11 changes: 7 additions & 4 deletions website/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import React from 'react';
import clsx from 'clsx';
import Layout from '@theme/Layout';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';

import Heading from '@theme/Heading';
import styles from './index.module.css';
import HomepageFeatures from '../components/HomepageFeatures';

function HomepageHeader() {
const {siteConfig} = useDocusaurusContext();
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
2 changes: 1 addition & 1 deletion website/src/pages/index.module.css
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
overflow: hidden;
}

@media screen and (max-width: 966px) {
@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
}
5,776 changes: 3,657 additions & 2,119 deletions website/yarn.lock

Large diffs are not rendered by default.