Skip to content

Commit 9a9f933

Browse files
authored
update docusaurus from 2.0.0-alpha.70 to 2.0.0-beta.1 (#4889)
* exit with an error if no paths given to copy script * consolidate and normalize scripts in website package * update docusaurus from 2.0.0-alpha.70 to 2.0.0-beta.1 * fix badge url in fast-components doc
1 parent 07bc68c commit 9a9f933

File tree

9 files changed

+2248
-1929
lines changed

9 files changed

+2248
-1929
lines changed

build/clean.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-env node */
2+
/* eslint-disable @typescript-eslint/explicit-function-return-type,@typescript-eslint/no-var-requires,@typescript-eslint/typedef */
13
/**
24
* Utility for cleaning directories.
35
* Usage: node build/clean.js %path%
@@ -15,7 +17,11 @@ const paths = argv._;
1517
* Function to remove a given path
1618
*/
1719
function cleanPath(cleanPath) {
18-
const removePath = path.resolve(process.cwd(), cleanPath)
20+
if (!cleanPath) {
21+
console.error("No path specified.");
22+
process.exit(1);
23+
}
24+
const removePath = path.resolve(process.cwd(), cleanPath);
1925
rimraf(removePath, () => {
2026
console.log(removePath, "cleaned");
2127
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
"sites/website"
2121
],
2222
"nohoist": [
23-
"**/react-syntax-highlighter",
2423
"**/@types/chai",
2524
"**/@types/jest",
2625
"**/@types/karma",
2726
"**/@types/mocha",
2827
"**/@types/node",
29-
"**/chai"
28+
"**/chai",
29+
"**/html-minifier-terser",
30+
"**/react-syntax-highlighter"
3031
]
3132
},
3233
"repository": {

sites/fast-website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"scripts": {
4141
"build:all": "yarn build:rollup && yarn build:webpack",
4242
"build:rollup": "rollup -c",
43-
"build:webpack": "webpack --config=./webpack.prod.js",
43+
"build:webpack": "webpack --config=./webpack.prod.js --progress",
4444
"clean": "rimraf dist temp",
4545
"prepare": "yarn clean && yarn build:rollup",
4646
"start": "webpack-dev-server --config=./webpack.dev.js --history-api-fallback --progress",

sites/website/docusaurus.config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/* eslint-disable @typescript-eslint/typedef */
2+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
3+
/* eslint-disable @typescript-eslint/no-var-requires */
4+
/* eslint-env node */
5+
const path = require("path");
6+
const fs = require("fs-extra");
7+
18
module.exports = {
29
title: "FAST",
310
tagline: "The adaptive interface system for modern web experiences",
@@ -135,4 +142,32 @@ module.exports = {
135142
},
136143
],
137144
],
145+
plugins: [
146+
// Work around an issue where Docusaurus resolves modules based on relative paths,
147+
// which doesn't work properly when in the context of a monorepo.
148+
// https://github.com/facebook/docusaurus/issues/3515
149+
function webpackOverride(context, options) {
150+
return {
151+
configureWebpack(config) {
152+
return {
153+
resolve: {
154+
modules: [
155+
path.resolve(
156+
path.dirname(
157+
require.resolve("@docusaurus/core/package.json")
158+
),
159+
"node_modules"
160+
),
161+
"node_modules",
162+
path.resolve(
163+
fs.realpathSync(process.cwd()),
164+
"node_modules"
165+
),
166+
],
167+
},
168+
};
169+
},
170+
};
171+
},
172+
],
138173
};

sites/website/package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
"version": "0.6.2",
44
"private": true,
55
"scripts": {
6-
"clean": "node ../../build/clean.js docs",
7-
"prepare-docs": "yarn clean && node src/prepare-docs.js",
8-
"build-static": "node src/build-static.js",
9-
"generate:badges": "yarn workspace @microsoft/site-utilities generate:badges",
10-
"start": "yarn build-static && yarn prepare-docs && docusaurus start",
11-
"build": "yarn generate:badges && yarn build-static && yarn prepare-docs && yarn docusaurus build"
6+
"clean": "concurrently \"yarn:clean-*\"",
7+
"clean-docs": "node ../../build/clean.js docs",
8+
"clean-static": "node ../../build/clean.js static",
9+
"copy-static": "node src/copy-static.js",
10+
"generate": "concurrently \"yarn:generate-*\"",
11+
"generate-badges": "yarn workspace @microsoft/site-utilities generate:badges",
12+
"generate-docs": "node src/generate-docs.js",
13+
"generate-homepage": "yarn workspace @microsoft/fast-website build",
14+
"prebuild": "yarn clean && yarn generate && yarn copy-static",
15+
"build": "docusaurus build",
16+
"prestart": "yarn prebuild",
17+
"start": "docusaurus start"
1218
},
1319
"browserslist": {
1420
"production": [
@@ -22,14 +28,11 @@
2228
"last 1 safari version"
2329
]
2430
},
25-
"dependencies": {
26-
"@docusaurus/core": "2.0.0-alpha.70",
27-
"@docusaurus/preset-classic": "2.0.0-alpha.70",
28-
"@docusaurus/theme-live-codeblock": "2.0.0-alpha.70"
29-
},
3031
"devDependencies": {
32+
"@docusaurus/core": "2.0.0-beta.1",
33+
"@docusaurus/preset-classic": "2.0.0-beta.1",
34+
"@docusaurus/theme-live-codeblock": "2.0.0-beta.1",
3135
"@microsoft/api-documenter": "7.8.13",
32-
"classnames": "^2.2.6",
33-
"progress-bar-webpack-plugin": "^2.1.0"
36+
"concurrently": "^6.2.0"
3437
}
3538
}

sites/website/src/build-static.js renamed to sites/website/src/copy-static.js

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
/* eslint-disable @typescript-eslint/typedef */
66
/* eslint-disable @typescript-eslint/no-var-requires */
77
const path = require("path");
8-
const webpack = require("webpack");
9-
const merge = require("webpack-merge");
10-
const ProgressBarPlugin = require("progress-bar-webpack-plugin");
11-
const fastWebsiteConfig = require("@microsoft/fast-website/webpack.prod.js");
128
const copy = require("../../../build/copy");
139

1410
function getPackageDir(pkg) {
@@ -17,41 +13,13 @@ function getPackageDir(pkg) {
1713

1814
const outputPath = path.resolve(__dirname, "../static");
1915

16+
const homepageDir = getPackageDir("@microsoft/fast-website");
2017
const utilitiesDir = getPackageDir("@microsoft/site-utilities");
2118
const fastComponentsDir = getPackageDir("@microsoft/fast-components");
2219
const utilitiesAssets = path.resolve(utilitiesDir, "statics/assets");
2320

24-
const config = merge(fastWebsiteConfig, {
25-
output: { path: outputPath },
26-
performance: { hints: false },
27-
plugins: [new ProgressBarPlugin()],
28-
});
29-
30-
const compiler = webpack(config);
31-
32-
compiler.hooks.beforeRun.tap("buildMessage", () => {
33-
console.info("Building @microsoft/fast-website with webpack to static/");
34-
});
35-
36-
compiler.run(async (err, stats) => {
37-
if (err) {
38-
console.error(err.stack || err);
39-
if (err.details) {
40-
console.error(err.details);
41-
}
42-
process.exit(1);
43-
}
44-
45-
const info = stats.toJson();
46-
47-
if (stats.hasErrors()) {
48-
info.errors.forEach(e => console.error(e));
49-
process.exit(1);
50-
}
51-
52-
if (stats.hasWarnings()) {
53-
info.warnings.forEach(w => console.warn(w));
54-
}
21+
(async function () {
22+
await copy([`${homepageDir}/dist/*`], outputPath);
5523

5624
await copy(
5725
[
@@ -63,5 +31,10 @@ compiler.run(async (err, stats) => {
6331
outputPath
6432
);
6533

34+
await copy([`${homepageDir}/dist/bundle/*`], `${outputPath}/bundle`, {
35+
flat: false,
36+
verbose: true,
37+
up: true,
38+
});
6639
await copy([`${utilitiesAssets}/badges/*.svg`], `${outputPath}/badges`);
67-
});
40+
})();

sites/website/src/docs/components/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_label: Getting Started
44
custom_edit_url: https://github.com/microsoft/fast/edit/master/sites/website/src/docs/fast-foundation/getting-started.md
55
---
66
[![License: MIT](/badges/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7-
[![npm version](/badges/fast-components.svg)](https://www.npmjs.com/package/@microsoft/fast-element)
7+
[![npm version](/badges/fast-components.svg)](https://www.npmjs.com/package/@microsoft/fast-components)
88

99
The `fast-components` and `@fluentui/web-components` libraries contain Web Components built on top of our standard component and design system foundation. `fast-components` express the FAST design language while `@fluentui/web-components` expresses Microsoft's Fluent design language.
1010

0 commit comments

Comments
 (0)