mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
chore: simplify CI setup (#4447)
* improve ci * improve ci * use actions/setup-node@v2 everywhere * run pwd for test * debug gh action * debug glob CI issue? * Separate v1/v2 tests due to shell conflict * cleanup * test v1 change * circleci fix * fix test docusaurus v1 paths * Refactor CI script names and use paths to filter actions from running unnecessary * fix lighthouse url * v1 tests runInBand * try to fix v1 tests race conditions * change rootDir for v1 tests * minor CI improvements
This commit is contained in:
parent
1135d19333
commit
3422f80a9a
26 changed files with 243 additions and 187 deletions
|
@ -19,10 +19,6 @@ aliases:
|
|||
only:
|
||||
- master
|
||||
|
||||
- &filter-ignore-gh-pages
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/docusaurus
|
||||
docker:
|
||||
|
@ -31,21 +27,7 @@ defaults: &defaults
|
|||
|
||||
version: 2
|
||||
jobs:
|
||||
lint-prettier:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- restore-cache: *root-restore-yarn-cache
|
||||
- run: *root-yarn
|
||||
- save-cache: *root-save-yarn-cache
|
||||
- run:
|
||||
name: Check ESLint
|
||||
command: yarn lint
|
||||
- run:
|
||||
name: Check Prettier
|
||||
command: yarn prettier:diff
|
||||
|
||||
tests:
|
||||
tests-v1:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
|
@ -54,11 +36,11 @@ jobs:
|
|||
- save-cache: *root-save-yarn-cache
|
||||
- run:
|
||||
name: Run Test Suites
|
||||
command: yarn test
|
||||
command: yarn test:v1
|
||||
|
||||
# The CIRCLE_ variables are defined during the CircleCI build process
|
||||
# https://circleci.com/docs/1.0/environment-variables/
|
||||
deploy-website:
|
||||
deploy-website-v1:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
|
@ -112,16 +94,11 @@ jobs:
|
|||
workflows:
|
||||
version: 2
|
||||
|
||||
lint-prettier:
|
||||
tests-and-deploy-v1:
|
||||
jobs:
|
||||
- lint-prettier:
|
||||
filters: *filter-ignore-gh-pages
|
||||
|
||||
tests-and-deploy:
|
||||
jobs:
|
||||
- tests:
|
||||
filters: *filter-ignore-gh-pages
|
||||
- deploy-website:
|
||||
requires:
|
||||
- tests
|
||||
- tests-v1:
|
||||
filters: *filter-only-master
|
||||
- deploy-website-v1:
|
||||
requires:
|
||||
- tests-v1
|
||||
filters: *filter-only-master
|
||||
|
|
|
@ -1,27 +1,14 @@
|
|||
name: Canary releases
|
||||
name: Canary Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'packages/**'
|
||||
|
||||
jobs:
|
||||
checkPackagesHaveChanged:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
packagesHaveChanged: ${{ steps.filter.outputs.packagesHaveChanged }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
packagesHaveChanged:
|
||||
- 'packages/**'
|
||||
|
||||
publish-canary:
|
||||
needs: checkPackagesHaveChanged
|
||||
if: ${{ needs.checkPackagesHaveChanged.outputs.packagesHaveChanged == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -29,7 +16,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Prepare git
|
21
.github/workflows/lint.yml
vendored
Normal file
21
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
- name: Prettier Code
|
||||
run: yarn prettier:diff
|
||||
- name: Prettier Docs
|
||||
run: yarn prettier-docs:diff
|
|
@ -1,25 +1,15 @@
|
|||
name: Migration CLI E2E Test
|
||||
name: Migration CLI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- packages/docusaurus-migration/**
|
||||
- website-1.x/**
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
migration: ${{ steps.filter.outputs.migration }}
|
||||
steps:
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
migration:
|
||||
- 'packages/docusaurus-migration/**'
|
||||
build:
|
||||
needs: check
|
||||
if: ${{ needs.check.outputs.migration == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -27,7 +17,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
28
.github/workflows/v1-tests-windows.yml
vendored
Normal file
28
.github/workflows/v1-tests-windows.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: V1 Tests Windows
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
- name: Docusaurus 1 Tests
|
||||
run: yarn test:v1
|
||||
# Not useful to build v1 site because tests already build v1 (packages/docusaurus-1.x/lib/__tests__/build-files.test.js)
|
28
.github/workflows/v1-tests.yml
vendored
Normal file
28
.github/workflows/v1-tests.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: V1 Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test:v1
|
||||
# Not useful to build v1 site because tests already build v1 (packages/docusaurus-1.x/lib/__tests__/build-files.test.js)
|
20
.github/workflows/v2-build-blog-only.yml
vendored
Normal file
20
.github/workflows/v2-build-blog-only.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: V2 Build Blog-only
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'website-1.x/blog/**'
|
||||
- 'packages/docusaurus/**'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Build blog-only
|
||||
run: yarn workspace docusaurus-2-website build:blogOnly
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
name: Build Size Report
|
||||
name: V2 Build Size Report
|
||||
|
||||
on:
|
||||
# Note! you can't safely use "pull_request_target" here
|
||||
|
@ -10,12 +10,17 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: preactjs/compressed-size-action@v2
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
|
@ -1,6 +1,13 @@
|
|||
name: Lighthouse Report
|
||||
name: V2 Lighthouse Report
|
||||
|
||||
on: pull_request_target
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -18,8 +25,8 @@ jobs:
|
|||
uses: treosh/lighthouse-ci-action@v3
|
||||
with:
|
||||
urls: |
|
||||
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/classic/
|
||||
configPath: ./.github/workflows/lighthousesrc.json
|
||||
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/
|
||||
configPath: ./.github/workflows/v2-lighthousesrc.json
|
||||
uploadArtifacts: true
|
||||
temporaryPublicStorage: true
|
||||
env:
|
|
@ -1,4 +1,4 @@
|
|||
name: E2E Test
|
||||
name: V2 Tests E2E
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -7,6 +7,10 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
yarn-v1:
|
||||
|
@ -17,7 +21,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
|
@ -42,7 +46,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
|
@ -1,9 +1,13 @@
|
|||
name: Windows Build Test
|
||||
name: V2 Windows Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -13,25 +17,15 @@ jobs:
|
|||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
v1:
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
- name: Docusaurus 1 Build
|
||||
if: steps.filter.outputs.v1 == 'true'
|
||||
run: yarn build:v1
|
||||
- name: Docusaurus Jest Tests
|
||||
run: yarn test
|
||||
- name: Docusaurus 2 Build
|
||||
- name: Docusaurus Build
|
||||
run: yarn build:v2
|
||||
env:
|
||||
CI: true
|
27
.github/workflows/v2-tests.yml
vendored
Normal file
27
.github/workflows/v2-tests.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
name: V2 Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -34,3 +34,5 @@ website-1.x-migrated
|
|||
website/i18n/**/*
|
||||
#!website/i18n/fr
|
||||
#!website/i18n/fr/**/*
|
||||
|
||||
.netlify
|
||||
|
|
|
@ -11,3 +11,6 @@ packages/docusaurus-1.x/lib/core/metadata.js
|
|||
packages/docusaurus-1.x/lib/core/MetadataBlog.js
|
||||
packages/docusaurus-*/lib-next/
|
||||
__fixtures__
|
||||
|
||||
website-1.x/translated_docs
|
||||
website/i18n
|
||||
|
|
|
@ -19,6 +19,7 @@ type PackageJsonFile = {
|
|||
|
||||
async function getPackagesJsonFiles(): Promise<PackageJsonFile[]> {
|
||||
const files = await glob('packages/*/package.json');
|
||||
|
||||
return Promise.all(
|
||||
files.map(async (file) => {
|
||||
return {
|
||||
|
|
|
@ -18,6 +18,8 @@ const windowsSpecificIgnorePatterns = [
|
|||
const ignorePatterns = [
|
||||
'/node_modules/',
|
||||
'__fixtures__',
|
||||
'/packages/docusaurus-1.x',
|
||||
'/packages/docusaurus-init-1.x',
|
||||
'/packages/docusaurus/lib',
|
||||
'/packages/docusaurus-utils/lib',
|
||||
'/packages/docusaurus-utils-validation/lib',
|
||||
|
|
26
jest.config.v1.js
Normal file
26
jest.config.v1.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const ignorePatterns = ['/node_modules/', '__fixtures__'];
|
||||
|
||||
module.exports = {
|
||||
rootDir: path.join(path.resolve(__dirname), 'packages', 'docusaurus-1.x'),
|
||||
verbose: true,
|
||||
testURL: 'http://localhost/',
|
||||
testEnvironment: 'node',
|
||||
testPathIgnorePatterns: ignorePatterns,
|
||||
coveragePathIgnorePatterns: ignorePatterns,
|
||||
transform: {
|
||||
'^.+\\.[jt]sx?$': 'babel-jest',
|
||||
},
|
||||
setupFiles: ['../../jest/stylelint-rule-test.js', '../../jest/polyfills.js'],
|
||||
moduleNameMapper: {
|
||||
'@docusaurus/router': 'react-router-dom',
|
||||
},
|
||||
};
|
11
package.json
11
package.json
|
@ -41,12 +41,14 @@
|
|||
"postinstall:dev": "is-ci || husky install",
|
||||
"prettier": "prettier --config .prettierrc --write \"**/*.{js,jsx,ts,tsx}\"",
|
||||
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx}\"",
|
||||
"prettier-docs": "prettier --config .prettierrc --write \"**/*.md\"",
|
||||
"prettier-docs": "prettier --config .prettierrc --write \"**/*.{md,mdx}\"",
|
||||
"prettier-docs:diff": "prettier --config .prettierrc --list-different \"**/*.{md,mdx}\"",
|
||||
"lint": "yarn lint:js && yarn lint:style",
|
||||
"lint:js": "eslint --cache \"**/*.{js,jsx,ts,tsx}\"",
|
||||
"lint:style": "stylelint \"**/*.css\"",
|
||||
"lerna": "lerna",
|
||||
"test": "cross-env TZ=UTC jest",
|
||||
"test:v1": "cross-env TZ=UTC V1_I18N=false jest --config jest.config.v1.js",
|
||||
"test:build:v2": "./admin/scripts/test-release.sh",
|
||||
"watch": "yarn lerna run --parallel --no-private watch",
|
||||
"clear": "yarn workspace docusaurus-2-website clear && yarn lerna exec --ignore docusaurus yarn rimraf lib",
|
||||
|
@ -54,13 +56,6 @@
|
|||
"test:v1Migration:start": "yarn workspace docusaurus-1-website-migrated start",
|
||||
"test:v1Migration:build": "yarn workspace docusaurus-1-website-migrated build",
|
||||
"test:baseUrl": "yarn build:v2:baseUrl && yarn serve:v2:baseUrl",
|
||||
"netlify:deployPreview:v1": "yarn netlify:deployPreview:v1:setDeployPreviewVersions && yarn netlify:deployPreview:v1:build && yarn netlify:deployPreview:v1:moveBuild",
|
||||
"netlify:deployPreview:v1:setDeployPreviewVersions": "yarn node -e 'require(\"./website-1.x/netlifyUtils\").setDeployPreviewVersions()'",
|
||||
"netlify:deployPreview:v1:build": "BASE_URL=/v1/ yarn build:v1",
|
||||
"netlify:deployPreview:v1:moveBuild": "mv website-1.x/build/docusaurus website/netlifyDeployPreview/v1",
|
||||
"netlify:deployPreview:v1-migrated": "yarn test:v1Migration:migrate && yarn netlify:deployPreview:v1-migrated:setBaseUrl && yarn netlify:deployPreview:v1-migrated:build",
|
||||
"netlify:deployPreview:v1-migrated:setBaseUrl": "sed -i -e 's,\"baseUrl\": \"/\",\"baseUrl\": \"/v1-migrated/\",g' ./website-1.x-migrated/docusaurus.config.js",
|
||||
"netlify:deployPreview:v1-migrated:build": "yarn workspace docusaurus-1-website-migrated build --out-dir=../website/netlifyDeployPreview/v1-migrated",
|
||||
"lock:update": "npx yarn-deduplicate"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -17,8 +17,9 @@ const CWD = process.cwd();
|
|||
|
||||
const loadConfig = require('../server/config');
|
||||
|
||||
const siteConfig = loadConfig(`${CWD}/website-1.x/siteConfig.js`);
|
||||
const buildDir = `${CWD}/website-1.x/build`;
|
||||
const website1Dir = 'website-1.x';
|
||||
const siteConfig = loadConfig(`${CWD}/${website1Dir}/siteConfig.js`);
|
||||
const buildDir = `${CWD}/${website1Dir}/build`;
|
||||
const docsDir = `${CWD}/docs`;
|
||||
|
||||
let inputMarkdownFiles = [];
|
||||
|
@ -26,22 +27,16 @@ let inputAssetsFiles = [];
|
|||
let outputHTMLFiles = [];
|
||||
let outputAssetsFiles = [];
|
||||
|
||||
function generateSite() {
|
||||
shell.cd('website-1.x');
|
||||
shell.exec('yarn build', {silent: true});
|
||||
}
|
||||
|
||||
function clearBuildFolder() {
|
||||
return rimraf(buildDir);
|
||||
}
|
||||
|
||||
describe('Build files', () => {
|
||||
beforeEach(() => {
|
||||
shell.cd(CWD);
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
generateSite();
|
||||
shell.exec(`yarn workspace docusaurus-1-website build`, {
|
||||
// silent: true
|
||||
});
|
||||
|
||||
return Promise.all([
|
||||
glob(`${docsDir}/**/*.md`),
|
||||
glob(`${buildDir}/${siteConfig.projectName}/docs/**/*.html`),
|
||||
|
@ -97,8 +92,12 @@ describe('Build files', () => {
|
|||
|
||||
describe('Build files but skip next release', () => {
|
||||
beforeAll(() => {
|
||||
shell.cd('website-1.x');
|
||||
shell.exec('yarn build --skip-next-release', {silent: true});
|
||||
shell.exec(
|
||||
`yarn workspace docusaurus-1-website build --skip-next-release`,
|
||||
{
|
||||
// silent: true,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -95,4 +95,4 @@ This feature has not been an easy one, and we would like to thank everyone that
|
|||
|
||||
Thanks for reading.
|
||||
|
||||
🙏 And please, add your brand new i18n sites to our [showcase page](https://v2.docusaurus.io/showcase). We accept any polished Docusaurus site here, and we are working on a [redesign](https://github.com/facebook/docusaurus/issues/4238) allowing you to filter sites by features.
|
||||
🙏 And please, add your brand new i18n sites to our [showcase page](https://v2.docusaurus.io/showcase). We accept any all polished Docusaurus site here, and we are working on a [redesign](https://github.com/facebook/docusaurus/issues/4238) allowing you to filter sites by features.
|
||||
|
|
|
@ -196,7 +196,21 @@ const onlyEnglishAndFrench = [
|
|||
},
|
||||
];
|
||||
|
||||
const onlyEnglish = [
|
||||
{
|
||||
enabled: true,
|
||||
name: 'English',
|
||||
tag: 'en',
|
||||
},
|
||||
];
|
||||
|
||||
// We want deploy previews to be fast
|
||||
module.exports = require('./netlifyUtils').isDeployPreview
|
||||
? onlyEnglishAndFrench
|
||||
: languages;
|
||||
module.exports = (function () {
|
||||
if (process.env.V1_I18N === 'false') {
|
||||
return onlyEnglish;
|
||||
} else if (require('./netlifyUtils').isDeployPreview) {
|
||||
return onlyEnglishAndFrench;
|
||||
} else {
|
||||
return languages;
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -11,25 +11,5 @@
|
|||
# permits to test that baseUrl works fine (this often breaks!)
|
||||
[context.deploy-preview]
|
||||
command = "yarn workspace docusaurus-2-website netlify:build:deployPreview"
|
||||
publish = "website/netlifyDeployPreview"
|
||||
|
||||
# TODO this does not seem to work
|
||||
# workaroud: a _redirect file is created in npm/yarn scripts
|
||||
# can't we have context-based redirects with Netlify? :'(
|
||||
|
||||
[[context.deploy-preview.redirects]]
|
||||
from = "/classic/*"
|
||||
to = "/classic/404.html"
|
||||
status = 200
|
||||
[[context.deploy-preview.redirects]]
|
||||
from = "/bootstrap/*"
|
||||
to = "/bootstrap/404.html"
|
||||
status = 200
|
||||
[[context.deploy-preview.redirects]]
|
||||
from = "/blog-only/*"
|
||||
to = "/blog-only/404.html"
|
||||
status = 200
|
||||
[[context.deploy-preview.redirects]]
|
||||
from = "/*"
|
||||
to = "/classic/"
|
||||
publish = "website/build"
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
/classic/* /classic/404.html 200
|
||||
/bootstrap/* /bootstrap/404.html 200
|
||||
/blog-only/* /blog-only/404.html 200
|
||||
/v1/* /v1/404.html 200
|
||||
/v1-migrated/* /v1-migrated/404.html 200
|
||||
/* /classic/
|
|
@ -1,44 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body style="padding: 20px;">
|
||||
<img src="https://v2.docusaurus.io/img/docusaurus.png" />
|
||||
<h1 style="margin-top: 20px;">
|
||||
Docusaurus deploy previews
|
||||
</h1>
|
||||
<section style="margin-top: 40px;">
|
||||
<p>
|
||||
We deploy the Docusaurus site with various configurations. It helps us
|
||||
find potential regressions.
|
||||
</p>
|
||||
<p>When in doubt, try the <a href="/classic">classic preview</a></p>
|
||||
</section>
|
||||
<section style="margin-top: 40px;">
|
||||
<h2>V2 deploy previews:</h2>
|
||||
<ul style="margin-top: 20px;">
|
||||
<li style="margin-top: 20px;">
|
||||
<a href="/classic">classic</a>: the regular Docusaurus v2 site
|
||||
</li>
|
||||
<li style="margin-top: 20px;">
|
||||
<a href="/bootstrap">bootstrap</a>: the regular site with the
|
||||
bootstrap theme (WIP / disabled)
|
||||
</li>
|
||||
<li style="margin-top: 20px;">
|
||||
<a href="/blog-only">blog-only</a>: the regular site in blog-only mode
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section style="margin-top: 40px;">
|
||||
<h2>V1 deploy previews:</h2>
|
||||
<ul style="margin-top: 20px;">
|
||||
<li style="margin-top: 20px;">
|
||||
<a href="/v1">v1</a>: the legacy Docusaurus v1 site
|
||||
</li>
|
||||
<li style="margin-top: 20px;">
|
||||
<a href="/v1-migrated">v1-migrated</a>: the legacy Docusaurus v1 site,
|
||||
migrated to v2 with the migration cli
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
|
@ -19,11 +19,7 @@
|
|||
"start:blogOnly": "cross-env yarn start --config=docusaurus.config-blog-only.js",
|
||||
"build:blogOnly": "cross-env yarn build --config=docusaurus.config-blog-only.js",
|
||||
"netlify:build:production": "yarn docusaurus write-translations && yarn netlify:crowdin:uploadSources && yarn netlify:crowdin:downloadTranslations && yarn build",
|
||||
"netlify:build:deployPreview": "yarn docusaurus write-translations --locale fr --messagePrefix '(fr) ' && yarn netlify:build:deployPreview:v1:all && yarn netlify:build:deployPreview:classic && yarn netlify:build:deployPreview:bootstrap && yarn netlify:build:deployPreview:blogOnly",
|
||||
"netlify:build:deployPreview:classic": "cross-env BASE_URL='/classic/' yarn build --out-dir netlifyDeployPreview/classic",
|
||||
"netlify:build:deployPreview:bootstrap": "echo 'netlify:build:deployPreview:bootstrap temporarily disabled' || cross-env BASE_URL='/bootstrap/' DOCUSAURUS_PRESET=bootstrap DISABLE_VERSIONING=true yarn build --out-dir netlifyDeployPreview/bootstrap",
|
||||
"netlify:build:deployPreview:blogOnly": "yarn build:blogOnly --out-dir netlifyDeployPreview/blog-only",
|
||||
"netlify:build:deployPreview:v1:all": "yarn --cwd .. netlify:deployPreview:v1 && yarn --cwd .. netlify:deployPreview:v1-migrated",
|
||||
"netlify:build:deployPreview": "yarn docusaurus write-translations --locale fr --messagePrefix '(fr) ' && yarn build",
|
||||
"netlify:crowdin:downloadTranslations": "yarn --cwd .. crowdin:download:v2",
|
||||
"netlify:crowdin:downloadTranslationsFailSafe": "yarn --cwd .. crowdin:download:v2 || echo 'Crowdin translation download failure (only internal PRs have access to the Crowdin env token)'",
|
||||
"netlify:crowdin:uploadSources": "yarn --cwd .. crowdin:upload:v2",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue