Improve website DX sightly (#17940)
Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
1 parent
c9df58f5f9
commit
70ec01f41a
3 files changed
+8
-4
No files matched your search
@@ -189,6 +189,7 @@
|
|||||||
"fix:prettier": "yarn lint:prettier --write",
|
"fix:prettier": "yarn lint:prettier --write",
|
||||||
"build": "node ./scripts/build/build.js",
|
"build": "node ./scripts/build/build.js",
|
||||||
"build:website": "node ./scripts/build-website.js",
|
"build:website": "node ./scripts/build-website.js",
|
||||||
|
"build:website:pr": "cross-env PULL_REQUEST=true yarn build:website",
|
||||||
"gen:changelog": "node ./scripts/generate-changelog.js",
|
"gen:changelog": "node ./scripts/generate-changelog.js",
|
||||||
"debug": "node bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js",
|
"debug": "node bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js",
|
||||||
"debug:watch": "node --watch bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js",
|
"debug:watch": "node --watch bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ https://prettier.io/
|
|||||||
yarn build:website
|
yarn build:website
|
||||||
```
|
```
|
||||||
|
|
||||||
To build for the current branch, use `PULL_REQUEST=true yarn build:website`. Otherwise, a release version of Prettier from `node_modules` is used.
|
To build for the current branch, use `yarn build:website:pr`. Otherwise, a release version of Prettier from `node_modules` is used.
|
||||||
|
|
||||||
2. Switch to the `website` directory and start the development server:
|
2. Switch to the `website` directory and start the development server:
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,16 @@ await fs.rm(STABLE_DOCS_DIRECTORY, { recursive: true, force: true });
|
|||||||
await fs.mkdir(STABLE_DOCS_DIRECTORY, { recursive: true, force: true });
|
await fs.mkdir(STABLE_DOCS_DIRECTORY, { recursive: true, force: true });
|
||||||
await fs.cp(CURRENT_DOCS_DIRECTORY, STABLE_DOCS_DIRECTORY, { recursive: true });
|
await fs.cp(CURRENT_DOCS_DIRECTORY, STABLE_DOCS_DIRECTORY, { recursive: true });
|
||||||
|
|
||||||
// Replace version placeholders
|
// PRETTIER_VERSION when PULL_REQUEST exists is a temporary one
|
||||||
await Promise.all(
|
if (process.env.PULL_REQUEST !== "true") {
|
||||||
|
// Replace version placeholders
|
||||||
|
await Promise.all(
|
||||||
["browser.md"].map(async (file) => {
|
["browser.md"].map(async (file) => {
|
||||||
file = new URL(file, STABLE_DOCS_DIRECTORY);
|
file = new URL(file, STABLE_DOCS_DIRECTORY);
|
||||||
await replaceVersionPlaceholder(file, version);
|
await replaceVersionPlaceholder(file, version);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function getPrettierVersion() {
|
async function getPrettierVersion() {
|
||||||
const version = process.env.PRETTIER_VERSION;
|
const version = process.env.PRETTIER_VERSION;
|
||||||
|
|||||||
Reference in new issue
Block a user