Skip to content

Commit 39b66d8

Browse files
Josh-Cenaslorber
andauthored
feat(core): rework swizzle CLI (facebook#6243)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
1 parent d43066f commit 39b66d8

78 files changed

Lines changed: 3633 additions & 585 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ copyUntypedFiles.mjs
1717

1818
packages/create-docusaurus/lib/*
1919
packages/create-docusaurus/templates/facebook/.eslintrc.js
20+
21+
website/_dogfooding/_swizzle_theme_tests

.eslintrc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ module.exports = {
260260
'no-unused-vars': OFF,
261261
'@typescript-eslint/no-unused-vars': [
262262
ERROR,
263-
{argsIgnorePattern: '^_', ignoreRestSiblings: true},
263+
{
264+
argsIgnorePattern: '^_',
265+
varsIgnorePattern: '^_',
266+
ignoreRestSiblings: true,
267+
},
264268
],
265269
},
266270
overrides: [
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Swizzle Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- packages/**
9+
10+
jobs:
11+
test:
12+
name: Swizzle
13+
timeout-minutes: 30
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
action: ['eject', 'wrap']
18+
variant: ['js', 'ts']
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Use Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: 14
25+
cache: yarn
26+
- name: Installation
27+
run: yarn
28+
29+
# Swizzle all the theme components
30+
- name: Swizzle (${{matrix.action}} - ${{matrix.variant}})
31+
run: yarn workspace website test:swizzle:${{matrix.action}}:${{matrix.variant}}
32+
# Build swizzled site
33+
- name: Build website
34+
run: yarn build:website:fast
35+
# Ensure swizzled site still typechecks
36+
- name: TypeCheck website
37+
run: yarn workspace website typecheck

.github/workflows/tests-windows.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@ jobs:
3434
mkdir -p "website/_dogfooding/_pages tests/deep-file-path-test/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar"
3535
cd "$_"
3636
echo "# hello" > test-file.md
37+
# Lightweight version of tests-swizzle.yml workflow, but for Windows
38+
- name: Swizzle Wrap TS
39+
run: yarn workspace website test:swizzle:wrap:ts
3740
- name: Docusaurus Build
38-
run: yarn build:website --locale en
41+
run: yarn build:website:fast
42+
- name: TypeCheck website
43+
run: yarn workspace website typecheck

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ website/changelog
3131
!website/netlifyDeployPreview/index.html
3232
!website/netlifyDeployPreview/_redirects
3333

34+
website/_dogfooding/_swizzle_theme_tests
35+
3436
website/i18n/**/*
3537
#!website/i18n/fr
3638
#!website/i18n/fr/**/*

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ website/versioned_sidebars/*.json
2020

2121
examples/
2222
website/static/katex/katex.min.css
23+
24+
website/changelog/_swizzle_theme_tests
25+
website/_dogfooding/_swizzle_theme_tests

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*
33
!*/
44
!*.css
5+
__tests__/
56
build
67
coverage
78
examples/

jest.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {fileURLToPath} from 'url';
1010
const ignorePatterns = [
1111
'/node_modules/',
1212
'__fixtures__',
13+
'/testUtils.ts',
1314
'/packages/docusaurus/lib',
1415
'/packages/docusaurus-utils/lib',
1516
'/packages/docusaurus-utils-validation/lib',

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
"build:website": "yarn workspace website build",
2424
"build:website:baseUrl": "yarn workspace website build:baseUrl",
2525
"build:website:blogOnly": "yarn workspace website build:blogOnly",
26-
"build:website:deployPreview": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website build",
26+
"build:website:deployPreview:testWrap": "yarn workspace website test:swizzle:wrap:ts",
27+
"build:website:deployPreview:build": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website build",
28+
"build:website:deployPreview": "yarn build:website:deployPreview:testWrap && yarn build:website:deployPreview:build",
2729
"build:website:fast": "yarn workspace website build:fast",
2830
"build:website:en": "yarn workspace website build --locale en",
2931
"clear:website": "yarn workspace website clear",

packages/docusaurus-logger/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ function success(msg: unknown, ...values: InterpolatableValue[]): void {
120120
);
121121
}
122122

123+
function newLine(): void {
124+
console.log();
125+
}
126+
123127
const logger = {
124128
red: chalk.red,
125129
yellow: chalk.yellow,
@@ -136,6 +140,7 @@ const logger = {
136140
warn,
137141
error,
138142
success,
143+
newLine,
139144
};
140145

141146
// TODO remove when migrating to ESM

0 commit comments

Comments
 (0)