1
- .PHONY : clean install build serve dev upgrade
1
+ .PHONY : clean install build serve dev lint format upgrade update-current \
2
+ swizzled-components-upgrade swizzled-components-clean reswizzle-components swizzled-components-apply-patches
2
3
3
4
package-lock.json :
4
5
npm install
@@ -27,6 +28,12 @@ clean:
27
28
rm -rf build
28
29
rm package-lock.json || true
29
30
31
+ lint :
32
+ npm run pretty:check
33
+
34
+ format :
35
+ npm run pretty:write
36
+
30
37
upgrade : clean install
31
38
# Update to the latest version of react and react-dom when it is supported and does not create dependency conflicts
32
39
npm install \
@@ -50,8 +57,34 @@ update-current:
50
57
# Remove the entry for the temporary version in the versions.json file
51
58
sed -i ' /updated/d' versions.json
52
59
53
- lint :
54
- npm run pretty:check
60
+ swizzled-components-upgrade : swizzled-components-clean reswizzle-components swizzled-components-apply-patches
55
61
56
- format :
57
- npm run pretty:write
62
+ swizzled-components-clean :
63
+ @echo " \033[1mRemoving swizzled components\033[0m"
64
+ rm -rf ./src/theme/Footer ./src/theme/Navbar
65
+ @echo
66
+
67
+ reswizzle-components :
68
+ @echo " \033[1mRe-swizzling Docusaurus components\033[0m"
69
+ npm run swizzle @docusaurus/theme-classic Footer/Layout -- --eject --typescript
70
+ npm run swizzle @docusaurus/theme-classic Footer/LinkItem -- --eject --typescript
71
+ npm run swizzle @docusaurus/theme-classic Footer/Links/MultiColumn -- --eject --typescript
72
+ npm run swizzle @docusaurus/theme-classic Footer/Logo -- --eject --typescript
73
+
74
+ npm run swizzle @docusaurus/theme-classic Navbar/Content -- --eject --typescript --danger
75
+ npm run swizzle @docusaurus/theme-classic Navbar/Layout -- --eject --typescript --danger
76
+ npm run swizzle @docusaurus/theme-classic Navbar/MobileSidebar/Layout -- --eject --typescript --danger
77
+ npm run swizzle @docusaurus/theme-classic Navbar/MobileSidebar/PrimaryMenu -- --eject --typescript --danger
78
+
79
+ @echo "\033[1mApplying prettier\033[0m"
80
+ prettier --write ./src/theme/Footer ./src/theme/Navbar
81
+ @echo
82
+
83
+ swizzled-components-apply-patches :
84
+ @echo " \033[1mTrying to apply custom changes ...\033[33m conflicts must be handled manually\033[0m"
85
+ $(MAKE ) $(wildcard ./upgrade/* .patch)
86
+
87
+ upgrade/% .patch : src/theme
88
+ @echo " git apply --verbose --reject ${@ } "
89
+ @git apply --verbose --reject $@ || echo " \033[31mPatch '${@ } ' failed, check '.rej' files\033[0m"
90
+ @echo
0 commit comments