Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): brand new swizzle CLI experience #6243

Merged
merged 111 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
1eb11fe
feat(core): rework swizzle CLI
Josh-Cena Jan 2, 2022
a6ee732
More work
Josh-Cena Jan 2, 2022
2b875db
more work
Josh-Cena Jan 3, 2022
f2c486d
add prompts
Josh-Cena Jan 3, 2022
d405f7e
Merge branch 'main' into jc/swizzle-rework
Josh-Cena Jan 10, 2022
ef8144e
Merge branch 'main' into jc/swizzle-rework
slorber Jan 13, 2022
1544b98
order getThemeNames
slorber Jan 13, 2022
a5a46bd
increase autocomplete limit
slorber Jan 13, 2022
1e349fb
refactor swizzle: split in smaller functions
slorber Jan 13, 2022
84017eb
pursue further refactoring
slorber Jan 13, 2022
326b18b
enhancements
Josh-Cena Jan 14, 2022
3acb92e
refactors
Josh-Cena Jan 14, 2022
2775185
Merge branch 'main' into jc/swizzle-rework
slorber Jan 14, 2022
bd60125
orderBy refactor
slorber Jan 14, 2022
62c66d9
refactor ThemeComponents for further extension
slorber Jan 14, 2022
0953ab7
only apply --list if themeName is not provided
slorber Jan 14, 2022
b0cc3bb
render help tables for --list
slorber Jan 14, 2022
f724bcd
display all theme components with --list
slorber Jan 14, 2022
a8a2079
refactors
Josh-Cena Jan 15, 2022
82d3b98
Merge branch 'main' into jc/swizzle-rework
slorber Jan 20, 2022
91b24bf
progress on the swizzle CLI
slorber Jan 21, 2022
238a27c
test readComponentNames + fix some edge cases for tests and storybook…
slorber Jan 21, 2022
b16d6c4
Merge branch 'main' into jc/swizzle-rework
slorber Jan 27, 2022
9a3cc82
bad merge
slorber Jan 27, 2022
911823b
TS typo
slorber Jan 27, 2022
77303f3
better test/fixture
slorber Jan 27, 2022
bf8885b
simpler regex
slorber Jan 27, 2022
1efa9cd
refactor + add tests for getThemeComponents
slorber Jan 27, 2022
cd21b37
basic test infra for executeAction
slorber Jan 28, 2022
92036d9
Merge branch 'main' into jc/swizzle-rework
slorber Jan 28, 2022
8adb8f3
remove css copyright for __tests__
slorber Jan 28, 2022
28dfd4e
Add sibling to fixture
slorber Jan 28, 2022
044499f
add tests to surface existing eject problems
slorber Jan 28, 2022
9889dd2
refactor components tests
slorber Jan 28, 2022
1e86aca
format
slorber Jan 28, 2022
0e5377c
eslint varsIgnorePattern
slorber Jan 28, 2022
8fa6d10
refactor eject action implementation
slorber Jan 28, 2022
cdedcf2
refactor actions swizzle
slorber Jan 28, 2022
0367c59
remove actions log
slorber Jan 28, 2022
bcdb52f
add cli to test swizzling all classic theme components
slorber Jan 28, 2022
8ff2d4b
Merge branch 'main' into jc/swizzle-rework
slorber Jan 28, 2022
a31dddc
minor ts issues
slorber Jan 28, 2022
44ae28f
add test swizzle commands
slorber Jan 28, 2022
0384940
add tests for wrap action
slorber Jan 28, 2022
6c326bd
ability to eject/wrap all classic theme components minus some exceptions
slorber Jan 28, 2022
c02ab97
Merge branch 'main' into jc/swizzle-rework
slorber Feb 3, 2022
44a13bf
remove useless swizzle executeAction abstraction
slorber Feb 3, 2022
a477421
minor fixes / lint
slorber Feb 3, 2022
6702531
Merge branch 'main' into jc/swizzle-rework
slorber Feb 4, 2022
abc1573
prettier fixes
slorber Feb 4, 2022
a4deb72
add website/changelog to prettierignore
slorber Feb 4, 2022
b6ff043
fix tests for Node 14
slorber Feb 4, 2022
04c6686
wire swizzle tests to CI
slorber Feb 4, 2022
e688e3b
add @theme-init fallback to typedefs + comment blacklisted swizzle comps
slorber Feb 4, 2022
67ee3fb
Merge branch 'main' into jc/swizzle-rework
slorber Feb 4, 2022
b8be5a8
change TS wrap output to enable type-checking
slorber Feb 4, 2022
bad0bda
try to fix windows tests
slorber Feb 4, 2022
a0880a1
wire swizzle wrap/ts to deploy previews
slorber Feb 4, 2022
0d2effa
fix windows tests?
slorber Feb 4, 2022
c342a2e
fix lint
slorber Feb 4, 2022
98b285a
fix windows?
slorber Feb 4, 2022
6d4f495
fix windows tests?
slorber Feb 4, 2022
63b234f
fix windows tests?
slorber Feb 4, 2022
bf5fbac
Merge branch 'main' into jc/swizzle-rework
slorber Feb 9, 2022
4be1dc4
upgrade tree-node-cli: fix windows CI tests (?) + typedefs
slorber Feb 9, 2022
02aa962
Merge branch 'main' into jc/swizzle-rework
slorber Feb 10, 2022
b41b85a
wire swizzle tests to windows CI workflows
slorber Feb 10, 2022
813381b
improve wrap output
Josh-Cena Feb 11, 2022
7785c25
fix snapshots
slorber Feb 11, 2022
7d5f691
add getSwizzleConfig to theme-classic
slorber Feb 11, 2022
d957eee
Polish swizzle DX:
slorber Feb 11, 2022
433738a
Swizzle: work better with local themes + add draft of test site fixture
slorber Feb 11, 2022
790c9fb
prettier
slorber Feb 11, 2022
1e56684
Merge branch 'main' into jc/swizzle-rework
slorber Feb 17, 2022
45184d2
add e2e tests for swizzle wrap/eject happy paths (no prompt, exit 0)
slorber Feb 17, 2022
07c0757
Edge case: swizzle should work with inline theme functions too
slorber Feb 17, 2022
782fd2d
debug logs :s
slorber Feb 18, 2022
75b2117
debug logs :s
slorber Feb 18, 2022
5bdadda
escape getThemePath
slorber Feb 18, 2022
f62db3c
debug snapshotThemeDir
slorber Feb 18, 2022
20c9379
debug snapshotThemeDir
slorber Feb 18, 2022
0605a26
remove debug logs
slorber Feb 18, 2022
cecd82b
extract initSwizzleContext
slorber Feb 18, 2022
5bd2c0e
add swizzle config validation + tests
slorber Feb 18, 2022
8f07947
extract getSwizzleConfig to separate file
slorber Feb 18, 2022
df40bda
improve swizzle config + dogfood tests
slorber Feb 18, 2022
8e7288a
move swizzling doc + change a bit styling-layout docs
slorber Feb 18, 2022
2960060
start upgrading swizzle doc
slorber Feb 18, 2022
de244ee
Merge branch 'main' into jc/swizzle-rework
Josh-Cena Feb 19, 2022
0b31c3c
fix docs
Josh-Cena Feb 19, 2022
b1031c6
Merge branch 'main' into jc/swizzle-rework
Josh-Cena Feb 20, 2022
7b1e70b
fix link
Josh-Cena Feb 22, 2022
e9a8ad1
Merge branch 'main' into jc/swizzle-rework
slorber Feb 24, 2022
7a0544b
Merge branch 'main' into jc/swizzle-rework
slorber Feb 24, 2022
5ad6e80
swizzle documentation
slorber Feb 24, 2022
eb4e603
fix link
Josh-Cena Feb 25, 2022
a323b0d
fix sidebar
Josh-Cena Feb 25, 2022
2cffe7f
fix links...
Josh-Cena Feb 25, 2022
5525623
doc edits
Josh-Cena Feb 25, 2022
f9c4b7b
Final refactors
Josh-Cena Feb 25, 2022
d161b46
refactor
Josh-Cena Feb 25, 2022
dd7ee56
fix link
Josh-Cena Feb 25, 2022
93b5e5d
reformat
Josh-Cena Feb 25, 2022
780459b
Merge branch 'main' into jc/swizzle-rework
Josh-Cena Feb 25, 2022
eec8281
remove unused swizzleWarning partial
slorber Feb 25, 2022
f07ba30
remove duplicate log message
slorber Feb 25, 2022
159b67f
add helpTables log
slorber Feb 25, 2022
b71c26c
fix swizzling doc url
slorber Feb 25, 2022
c3f0f36
add -- for npm cli options
slorber Feb 25, 2022
2d45fc1
doc edits!
Josh-Cena Feb 25, 2022
3da40a8
Merge branch 'main' into jc/swizzle-rework
Josh-Cena Feb 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/docusaurus-plugin-debug/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export default function pluginDebug({
getThemePath() {
return path.resolve(__dirname, '../lib/theme');
},
getTypeScriptThemePath() {
return path.resolve(__dirname, '../src/theme');
},

async contentLoaded({actions: {createData, addRoute}, allContent}) {
const allContentPath = await createData(
Expand Down
5 changes: 4 additions & 1 deletion packages/docusaurus-plugin-pwa/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export default function (
name: 'docusaurus-plugin-pwa',

getThemePath() {
return path.resolve(__dirname, './theme');
return path.resolve(__dirname, '../lib/theme');
},
getTypeScriptThemePath() {
return path.resolve(__dirname, '../src/theme');
},

getClientModules() {
Expand Down
5 changes: 4 additions & 1 deletion packages/docusaurus-theme-live-codeblock/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export default function theme(context: DocusaurusContext): Plugin {
name: 'docusaurus-theme-live-codeblock',

getThemePath() {
return path.resolve(__dirname, './theme');
return path.resolve(__dirname, '../lib/theme');
},
getTypeScriptThemePath() {
return path.resolve(__dirname, '../src/theme');
},

getDefaultCodeTranslationMessages() {
Expand Down
5 changes: 2 additions & 3 deletions packages/docusaurus-theme-search-algolia/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ export default function themeSearchAlgolia(context: LoadContext): Plugin<void> {
name: 'docusaurus-theme-search-algolia',

getThemePath() {
return path.resolve(__dirname, './theme');
return path.resolve(__dirname, '../lib/theme');
},

getTypeScriptThemePath() {
return path.resolve(__dirname, '..', 'src', 'theme');
return path.resolve(__dirname, '../src/theme');
},

getDefaultCodeTranslationMessages() {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-types/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export type PluginModule = {
| Promise<Plugin<Content>>;
validateOptions?: <T>(data: OptionValidationContext<T>) => T;
validateThemeConfig?: <T>(data: ThemeConfigValidationContext<T>) => T;
getSwizzleComponentList?: () => string[];
getSwizzleComponentList?: () => string[] | undefined;
};

export type ImportedPluginModule = PluginModule & {
Expand Down
10 changes: 7 additions & 3 deletions packages/docusaurus/bin/docusaurus.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ cli
.command('swizzle [themeName] [componentName] [siteDir]')
.description('Copy the theme files into website folder for customization.')
.option(
'--typescript',
'-l, --list',
'only list the available themes/components without further prompting (default: false)',
)
.option(
'-t, --typescript',
'copy TypeScript theme files when possible (default: false)',
)
.option('--danger', 'enable swizzle for internal component of themes')
.action((themeName, componentName, siteDir, {typescript, danger}) => {
swizzle(resolveDir(siteDir), themeName, componentName, typescript, danger);
.action((themeName, componentName, siteDir, options) => {
swizzle(resolveDir(siteDir), themeName, componentName, options);
});

cli
Expand Down
296 changes: 0 additions & 296 deletions packages/docusaurus/src/commands/swizzle.ts

This file was deleted.

Loading