Skip to content

Commit 772ff6d

Browse files
phateddonghwi park
and
donghwi park
authored
feat: Upgrade to Docusaurus v3 (#149)
Co-authored-by: donghwi park <35325234+donghwipark@users.noreply.github.com>
1 parent dc446a2 commit 772ff6d

35 files changed

+15428
-15854
lines changed

.github/workflows/deploy.yml

+29-13
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,40 @@ on:
66
- source
77

88
jobs:
9-
deploy:
10-
runs-on: ubuntu-18.04
9+
build:
10+
permissions:
11+
contents: read
12+
runs-on: ubuntu-latest
1113
steps:
12-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1315

1416
- name: Setup Node
15-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v4
1618
with:
17-
node-version: '10.x'
19+
node-version: 18
20+
21+
- run: npm ci
1822

19-
- run: npm install
2023
- run: npm run build
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2126

22-
- name: Deploy
23-
# Use the SHA because I am untrustworthy
24-
# TODO: We probably should fork any non-GitHub owned actions
25-
uses: peaceiris/actions-gh-pages@1828d864aeb7ba79a37f40035aa6d0b7ff66254f
27+
- name: Upload artifact
28+
uses: actions/upload-pages-artifact@v2
2629
with:
27-
github_token: ${{ secrets.GITHUB_TOKEN }}
28-
publish_dir: ./build
29-
publish_branch: master
30+
path: build
31+
32+
deploy:
33+
permissions:
34+
contents: read
35+
pages: write
36+
id-token: write
37+
environment:
38+
name: github-pages
39+
url: ${{ steps.deployment.outputs.page_url }}
40+
runs-on: ubuntu-latest
41+
needs: build
42+
steps:
43+
- name: Deploy to GitHub Pages
44+
id: deployment
45+
uses: actions/deploy-pages@v2

docusaurus.config.js

+15-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

3-
var isProd = process.env.NODE_ENV === 'production';
3+
const {themes} = require('prism-react-renderer');
4+
5+
const isProd = process.env.NODE_ENV === 'production';
46

57
module.exports = {
68
title: 'gulp.js',
@@ -44,27 +46,16 @@ module.exports = {
4446
href: 'https://github.com/sponsors/gulpjs',
4547
label: 'Donate',
4648
position: 'left',
47-
},
48-
{
49-
to: 'docs/en/support/for-enterprise',
50-
label: 'Enterprise',
51-
position: 'left',
52-
emphasis: true,
49+
className: 'emphasis',
5350
},
5451
{
5552
href: 'https://twitter.com/gulpjs',
56-
logo: {
57-
alt: 'Gulp on Twitter',
58-
src: 'img/twitter.svg',
59-
},
53+
html: '<img class="navbarIcon" src="/img/twitter.svg" alt="Gulp on Twitter" />',
6054
position: 'right'
6155
},
6256
{
6357
href: 'https://medium.com/gulpjs',
64-
logo: {
65-
alt: 'The gulp blog',
66-
src: 'img/medium.svg',
67-
},
58+
html: '<img class="navbarIcon" src="/img/medium.svg" alt="The gulp blog" />',
6859
position: 'right'
6960
},
7061
]
@@ -112,19 +103,14 @@ module.exports = {
112103
// One of:
113104
// dracula, duotoneDark, duotoneLight, github, nightOwl, nightOwlLight,
114105
// oceanicNext, palenight, shad esOfPurple, ultramin, vsDark
115-
theme: require('prism-react-renderer/themes/vsDark'),
106+
theme: themes.vsDark,
116107
},
117108
algolia: {
118-
apiKey: 'a6ef919bce0b83de1bcbad1d4ef753f8',
109+
appId: 'HQ9BYTRO7N',
110+
apiKey: 'e0f1bf55fa3f4fb5150c708638b02e22',
119111
indexName: 'gulpjs',
120112
algoliaOptions: {} // Optional, if provided by Algolia
121113
},
122-
googleAnalytics: {
123-
trackingID: 'UA-128126650-1',
124-
},
125-
gtag: {
126-
trackingID: 'UA-128126650-1',
127-
},
128114
companyLogos: [
129115
// Stopped donating on April 1, 2020
130116
// {
@@ -224,8 +210,12 @@ module.exports = {
224210
}],
225211
['docusaurus-plugin-sass', {}],
226212
['@docusaurus/plugin-content-pages', {}],
227-
isProd && ['@docusaurus/plugin-google-analytics', {}],
228-
isProd && ['@docusaurus/plugin-google-gtag', {}],
213+
isProd && ['@docusaurus/plugin-google-analytics', {
214+
trackingID: 'UA-128126650-1',
215+
}],
216+
isProd && ['@docusaurus/plugin-google-gtag', {
217+
trackingID: 'UA-128126650-1',
218+
}],
229219
isProd && ['@docusaurus/plugin-sitemap', {}],
230220
]
231221
};

gulpfile.js gulpfile.mjs

+25-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
'use strict';
2-
31
// This file is only for generating the docs
42
// No need to use any of this if working on the main website
5-
const del = require('del');
6-
const gulplog = require('gulplog');
7-
const { series } = require('gulp');
8-
const frontMatter = require('gray-matter');
9-
const download = require('github-download-directory');
3+
import { deleteAsync } from 'del';
4+
import gulplog from 'gulplog';
5+
import { series } from 'gulp';
6+
import frontMatter from 'gray-matter';
7+
import { Downloader } from 'github-download-directory';
8+
import { dirname } from 'path';
9+
import { mkdir, writeFile } from 'fs/promises';
1010

1111
// Exports for task registration
12-
exports.default = series(clean, generateDocs);
12+
export default series(clean, generateDocs);
1313

1414
const owner = 'gulpjs';
1515
const repo = 'gulp';
@@ -20,10 +20,25 @@ const fmOptions = {
2020
};
2121

2222
async function clean() {
23-
return del(directory);
23+
return deleteAsync(directory);
24+
}
25+
26+
async function createDirectories(filepath) {
27+
var dir = dirname(filepath);
28+
return mkdir(dir, { recursive: true });
29+
}
30+
31+
async function output(file) {
32+
await createDirectories(file.path);
33+
await writeFile(file.path, file.contents);
2434
}
2535

2636
async function generateDocs() {
37+
const download = new Downloader({
38+
github: {
39+
auth: process.env.GITHUB_TOKEN
40+
}
41+
});
2742
// Fetch
2843
const files = await download.fetchFiles(owner, repo, directory, { sha: "master" });
2944

@@ -42,5 +57,5 @@ async function generateDocs() {
4257
}, []);
4358

4459
// Write
45-
await Promise.all(docusaurusFiles.map(download.output))
60+
await Promise.all(docusaurusFiles.map(output))
4661
}

0 commit comments

Comments
 (0)