@qse/edu-scripts 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +333 -0
- package/README.md +105 -0
- package/app.d.ts +68 -0
- package/docs/changelog.md +5 -0
- package/docs/deploy.md +53 -0
- package/docs/feat.md +74 -0
- package/docs/grayscale.md +31 -0
- package/docs/index.md +5 -0
- package/docs/mode.md +42 -0
- package/docs/override.md +165 -0
- package/docs/refactor-react-16.md +40 -0
- package/docs/refactor.md +139 -0
- package/jest.config.js +195 -0
- package/lib/asset/dll/libcommon3-manifest.json +181 -0
- package/lib/asset/template/edu-app-env.d.ts.tpl +15 -0
- package/lib/asset/template/edu-scripts.override.js.tpl +14 -0
- package/lib/asset/template/page/index.class.js.tpl +24 -0
- package/lib/asset/template/page/index.class.tsx.tpl +10 -0
- package/lib/asset/template/page/index.fc.js.tpl +16 -0
- package/lib/asset/template/page/index.fc.tsx.tpl +9 -0
- package/lib/asset/template/page/index.less.tpl +3 -0
- package/lib/asset/template/page/logic.js.tpl +4 -0
- package/lib/asset/template/page/route.js.tpl +12 -0
- package/lib/asset/template/tailwind.config.js.tpl +11 -0
- package/lib/asset/template/tsconfig.json.tpl +24 -0
- package/lib/auto-refactor.js +175 -0
- package/lib/build.js +87 -0
- package/lib/cli.js +63 -0
- package/lib/commit-dist.js +117 -0
- package/lib/config/babel.dependencies.js +56 -0
- package/lib/config/babel.js +82 -0
- package/lib/config/paths.js +44 -0
- package/lib/config/plugins/postcss-safe-area.js +22 -0
- package/lib/config/webpackConfig.js +384 -0
- package/lib/config/webpackDevServerConfig.js +47 -0
- package/lib/deploy.js +186 -0
- package/lib/generator.js +155 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +13 -0
- package/lib/start.js +51 -0
- package/lib/utils/FileSizeReporter.js +131 -0
- package/lib/utils/appConfig.js +44 -0
- package/lib/utils/beforeStart.js +73 -0
- package/lib/utils/changeDeployVersion.js +125 -0
- package/lib/utils/defineConfig.d.ts +59 -0
- package/lib/utils/defineConfig.js +10 -0
- package/lib/utils/exec.js +13 -0
- package/lib/utils/getConfig.js +30 -0
- package/lib/utils/getOverride.js +33 -0
- package/package.json +102 -0
- package/src/asset/dll/libcommon3-manifest.json +181 -0
- package/src/asset/template/edu-app-env.d.ts.tpl +15 -0
- package/src/asset/template/edu-scripts.override.js.tpl +14 -0
- package/src/asset/template/page/index.class.js.tpl +24 -0
- package/src/asset/template/page/index.class.tsx.tpl +10 -0
- package/src/asset/template/page/index.fc.js.tpl +16 -0
- package/src/asset/template/page/index.fc.tsx.tpl +9 -0
- package/src/asset/template/page/index.less.tpl +3 -0
- package/src/asset/template/page/logic.js.tpl +4 -0
- package/src/asset/template/page/route.js.tpl +12 -0
- package/src/asset/template/tailwind.config.js.tpl +11 -0
- package/src/asset/template/tsconfig.json.tpl +24 -0
- package/src/auto-refactor.js +172 -0
- package/src/build.js +74 -0
- package/src/cli.js +91 -0
- package/src/commit-dist.js +103 -0
- package/src/config/babel.dependencies.js +65 -0
- package/src/config/babel.js +88 -0
- package/src/config/paths.js +37 -0
- package/src/config/plugins/postcss-safe-area.js +21 -0
- package/src/config/webpackConfig.js +410 -0
- package/src/config/webpackDevServerConfig.js +44 -0
- package/src/deploy.js +158 -0
- package/src/generator.js +138 -0
- package/src/index.ts +1 -0
- package/src/start.js +46 -0
- package/src/utils/FileSizeReporter.js +144 -0
- package/src/utils/appConfig.js +35 -0
- package/src/utils/beforeStart.js +66 -0
- package/src/utils/changeDeployVersion.js +115 -0
- package/src/utils/defineConfig.ts +63 -0
- package/src/utils/exec.js +7 -0
- package/src/utils/getConfig.js +26 -0
- package/src/utils/getOverride.js +32 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "libcommon3_3b2812567db0aac08740",
|
|
3
|
+
"content": {
|
|
4
|
+
"react": { "id": 0 },
|
|
5
|
+
"./node_modules/core-js/library/modules/_core.js": { "id": 1 },
|
|
6
|
+
"./node_modules/core-js/library/modules/_global.js": { "id": 2 },
|
|
7
|
+
"./node_modules/core-js/library/modules/_wks.js": { "id": 3 },
|
|
8
|
+
"./node_modules/core-js/library/modules/_an-object.js": { "id": 4 },
|
|
9
|
+
"./node_modules/core-js/library/modules/_descriptors.js": { "id": 5 },
|
|
10
|
+
"./node_modules/react-keeper/utils/Util.js": { "id": 6 },
|
|
11
|
+
"./node_modules/core-js/library/modules/_export.js": { "id": 7 },
|
|
12
|
+
"./node_modules/core-js/library/modules/_object-dp.js": { "id": 8 },
|
|
13
|
+
"./node_modules/core-js/library/modules/_is-object.js": { "id": 9 },
|
|
14
|
+
"./node_modules/react-keeper/HistoryControl.js": { "id": 10 },
|
|
15
|
+
"./node_modules/warning/browser.js": { "id": 11 },
|
|
16
|
+
"./node_modules/vhistory/PathUtils.js": { "id": 12 },
|
|
17
|
+
"./node_modules/core-js/library/modules/_hide.js": { "id": 13 },
|
|
18
|
+
"./node_modules/core-js/library/modules/_has.js": { "id": 14 },
|
|
19
|
+
"./node_modules/core-js/library/modules/_to-iobject.js": { "id": 15 },
|
|
20
|
+
"./node_modules/core-js/library/modules/_fails.js": { "id": 16 },
|
|
21
|
+
"./node_modules/prop-types/index.js": { "id": 17 },
|
|
22
|
+
"./node_modules/react-keeper/utils/Logger.js": { "id": 18 },
|
|
23
|
+
"./node_modules/vhistory/LocationUtils.js": { "id": 19 },
|
|
24
|
+
"./node_modules/core-js/library/modules/_library.js": { "id": 20 },
|
|
25
|
+
"./node_modules/core-js/library/modules/_ctx.js": { "id": 21 },
|
|
26
|
+
"./node_modules/core-js/library/modules/_cof.js": { "id": 22 },
|
|
27
|
+
"./node_modules/core-js/library/modules/_iterators.js": { "id": 23 },
|
|
28
|
+
"./node_modules/invariant/browser.js": { "id": 24 },
|
|
29
|
+
"./node_modules/vhistory/DOMUtils.js": { "id": 25 },
|
|
30
|
+
"./node_modules/core-js/library/modules/_a-function.js": { "id": 26 },
|
|
31
|
+
"./node_modules/core-js/library/modules/_uid.js": { "id": 27 },
|
|
32
|
+
"./node_modules/core-js/library/modules/_property-desc.js": { "id": 28 },
|
|
33
|
+
"./node_modules/core-js/library/modules/_set-to-string-tag.js": { "id": 29 },
|
|
34
|
+
"./node_modules/core-js/library/modules/_object-keys.js": { "id": 30 },
|
|
35
|
+
"./node_modules/core-js/library/modules/_object-pie.js": { "id": 31 },
|
|
36
|
+
"./node_modules/core-js/library/modules/_to-object.js": { "id": 32 },
|
|
37
|
+
"./node_modules/react-keeper/Router.js": { "id": 33 },
|
|
38
|
+
"./node_modules/react-keeper/utils/CacheOfLinkControl.js": { "id": 34 },
|
|
39
|
+
"./node_modules/vhistory/ExecutionEnvironment.js": { "id": 35 },
|
|
40
|
+
"./node_modules/vhistory/BrowserProtocol.js": { "id": 36 },
|
|
41
|
+
"./node_modules/vhistory/Actions.js": { "id": 37 },
|
|
42
|
+
"./node_modules/vhistory/createHistory.js": { "id": 38 },
|
|
43
|
+
"./node_modules/core-js/library/modules/_shared.js": { "id": 39 },
|
|
44
|
+
"./node_modules/core-js/library/modules/_dom-create.js": { "id": 40 },
|
|
45
|
+
"./node_modules/core-js/library/modules/_to-primitive.js": { "id": 41 },
|
|
46
|
+
"./node_modules/core-js/library/modules/_to-integer.js": { "id": 42 },
|
|
47
|
+
"./node_modules/core-js/library/modules/_wks-ext.js": { "id": 43 },
|
|
48
|
+
"./node_modules/core-js/library/modules/_wks-define.js": { "id": 44 },
|
|
49
|
+
"./node_modules/core-js/library/modules/_defined.js": { "id": 45 },
|
|
50
|
+
"./node_modules/core-js/library/modules/_shared-key.js": { "id": 46 },
|
|
51
|
+
"./node_modules/core-js/library/modules/_enum-bug-keys.js": { "id": 47 },
|
|
52
|
+
"./node_modules/core-js/library/modules/_object-gops.js": { "id": 48 },
|
|
53
|
+
"./node_modules/core-js/library/modules/_object-create.js": { "id": 49 },
|
|
54
|
+
"./node_modules/core-js/library/modules/_object-gopd.js": { "id": 50 },
|
|
55
|
+
"./node_modules/core-js/library/modules/_object-sap.js": { "id": 51 },
|
|
56
|
+
"./node_modules/babel-runtime/helpers/typeof.js": { "id": 52 },
|
|
57
|
+
"./node_modules/babel-runtime/core-js/object/define-property.js": { "id": 53 },
|
|
58
|
+
"./node_modules/prop-types/lib/ReactPropTypesSecret.js": { "id": 54 },
|
|
59
|
+
"./node_modules/react-keeper/InnerRouter.js": { "id": 55 },
|
|
60
|
+
"./node_modules/react-keeper/RouteBase.js": { "id": 56 },
|
|
61
|
+
"./node_modules/object-assign/index.js": { "id": 57 },
|
|
62
|
+
"./node_modules/vhistory/DOMStateStorage.js": { "id": 58 },
|
|
63
|
+
"./node_modules/vhistory/runTransitionHook.js": { "id": 59 },
|
|
64
|
+
"./node_modules/vhistory/useBasename.js": { "id": 60 },
|
|
65
|
+
"./node_modules/react-keeper/Link.js": { "id": 61 },
|
|
66
|
+
"./node_modules/core-js/library/modules/_classof.js": { "id": 62 },
|
|
67
|
+
"./node_modules/core-js/library/modules/_ie8-dom-define.js": { "id": 63 },
|
|
68
|
+
"./node_modules/core-js/library/modules/_to-length.js": { "id": 64 },
|
|
69
|
+
"./node_modules/core-js/library/modules/_task.js": { "id": 65 },
|
|
70
|
+
"./node_modules/core-js/library/modules/_html.js": { "id": 66 },
|
|
71
|
+
"./node_modules/core-js/library/modules/_new-promise-capability.js": { "id": 67 },
|
|
72
|
+
"./node_modules/core-js/library/modules/es6.symbol.js": { "id": 68 },
|
|
73
|
+
"./node_modules/core-js/library/modules/_redefine.js": { "id": 69 },
|
|
74
|
+
"./node_modules/core-js/library/modules/_object-keys-internal.js": { "id": 70 },
|
|
75
|
+
"./node_modules/core-js/library/modules/_iobject.js": { "id": 71 },
|
|
76
|
+
"./node_modules/core-js/library/modules/_object-gopn.js": { "id": 72 },
|
|
77
|
+
"./node_modules/core-js/library/fn/object/assign.js": { "id": 73 },
|
|
78
|
+
"./node_modules/core-js/library/modules/es6.object.assign.js": { "id": 74 },
|
|
79
|
+
"./node_modules/core-js/library/modules/_object-assign.js": { "id": 75 },
|
|
80
|
+
"./node_modules/core-js/library/fn/object/define-property.js": { "id": 76 },
|
|
81
|
+
"./node_modules/core-js/library/modules/es6.object.define-property.js": { "id": 77 },
|
|
82
|
+
"./node_modules/core-js/library/fn/object/get-own-property-descriptor.js": { "id": 78 },
|
|
83
|
+
"./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js": {
|
|
84
|
+
"id": 79
|
|
85
|
+
},
|
|
86
|
+
"./node_modules/core-js/library/fn/object/get-prototype-of.js": { "id": 80 },
|
|
87
|
+
"./node_modules/core-js/library/modules/es6.object.get-prototype-of.js": { "id": 81 },
|
|
88
|
+
"./node_modules/core-js/library/modules/_object-gpo.js": { "id": 82 },
|
|
89
|
+
"./node_modules/prop-types/checkPropTypes.js": { "id": 83 },
|
|
90
|
+
"./node_modules/core-js/library/modules/_iter-define.js": { "id": 84 },
|
|
91
|
+
"./node_modules/babel-runtime/core-js/object/assign.js": { "id": 85 },
|
|
92
|
+
"./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js": { "id": 86 },
|
|
93
|
+
"./node_modules/babel-runtime/core-js/object/get-prototype-of.js": { "id": 87 },
|
|
94
|
+
"./node_modules/process/browser.js": { "id": 88 },
|
|
95
|
+
"./node_modules/refast/dist/index.js": { "id": 90 },
|
|
96
|
+
"./node_modules/react-keeper/index.js": { "id": 91 },
|
|
97
|
+
"./node_modules/react-keeper/HashRouter.js": { "id": 92 },
|
|
98
|
+
"./node_modules/prop-types/factoryWithThrowingShims.js": { "id": 93 },
|
|
99
|
+
"./node_modules/react-keeper/utils/functional.js": { "id": 94 },
|
|
100
|
+
"./node_modules/create-react-class/index.js": { "id": 95 },
|
|
101
|
+
"./node_modules/create-react-class/factory.js": { "id": 96 },
|
|
102
|
+
"./node_modules/fbjs/lib/emptyObject.js": { "id": 97 },
|
|
103
|
+
"./node_modules/fbjs/lib/invariant.js": { "id": 98 },
|
|
104
|
+
"./node_modules/react-keeper/utils/RouteControl.js": { "id": 99 },
|
|
105
|
+
"./node_modules/react-keeper/match/matchPath.js": { "id": 100 },
|
|
106
|
+
"./node_modules/react-keeper/match/compilePattern.js": { "id": 101 },
|
|
107
|
+
"./node_modules/vhistory/createHashHistory.js": { "id": 102 },
|
|
108
|
+
"./node_modules/vhistory/HashProtocol.js": { "id": 103 },
|
|
109
|
+
"./node_modules/vhistory/AsyncUtils.js": { "id": 104 },
|
|
110
|
+
"./node_modules/react-keeper/BrowserRouter.js": { "id": 105 },
|
|
111
|
+
"./node_modules/vhistory/createBrowserHistory.js": { "id": 106 },
|
|
112
|
+
"./node_modules/vhistory/RefreshProtocol.js": { "id": 107 },
|
|
113
|
+
"./node_modules/react-keeper/MemoryRouter.js": { "id": 108 },
|
|
114
|
+
"./node_modules/vhistory/createMemoryHistory.js": { "id": 109 },
|
|
115
|
+
"./node_modules/react-keeper/Route.js": { "id": 110 },
|
|
116
|
+
"./node_modules/react-keeper/middleware/RouteIndex.js": { "id": 111 },
|
|
117
|
+
"./node_modules/react-keeper/middleware/RouteCache.js": { "id": 112 },
|
|
118
|
+
"react-dom": { "id": 113 },
|
|
119
|
+
"./node_modules/react-keeper/utils/CacheOfTagControl.js": { "id": 114 },
|
|
120
|
+
"./node_modules/react-keeper/middleware/RouteFilter.js": { "id": 115 },
|
|
121
|
+
"./node_modules/react-keeper/middleware/RouteRedirect.js": { "id": 116 },
|
|
122
|
+
"./node_modules/react-keeper/middleware/RouteMiss.js": { "id": 117 },
|
|
123
|
+
"./node_modules/react-keeper/CacheLink.js": { "id": 118 },
|
|
124
|
+
"./src/lib-common.js": { "id": 119 },
|
|
125
|
+
"./node_modules/core-js/library/modules/es6.promise.js": { "id": 120 },
|
|
126
|
+
"./node_modules/core-js/library/modules/_an-instance.js": { "id": 121 },
|
|
127
|
+
"./node_modules/core-js/library/modules/_for-of.js": { "id": 122 },
|
|
128
|
+
"./node_modules/core-js/library/modules/_iter-call.js": { "id": 123 },
|
|
129
|
+
"./node_modules/core-js/library/modules/_is-array-iter.js": { "id": 124 },
|
|
130
|
+
"./node_modules/core-js/library/modules/core.get-iterator-method.js": { "id": 125 },
|
|
131
|
+
"./node_modules/core-js/library/modules/_species-constructor.js": { "id": 126 },
|
|
132
|
+
"./node_modules/core-js/library/modules/_invoke.js": { "id": 127 },
|
|
133
|
+
"./node_modules/core-js/library/modules/_microtask.js": { "id": 128 },
|
|
134
|
+
"./node_modules/core-js/library/modules/_perform.js": { "id": 129 },
|
|
135
|
+
"./node_modules/core-js/library/modules/_user-agent.js": { "id": 130 },
|
|
136
|
+
"./node_modules/core-js/library/modules/_promise-resolve.js": { "id": 131 },
|
|
137
|
+
"./node_modules/core-js/library/modules/_redefine-all.js": { "id": 132 },
|
|
138
|
+
"./node_modules/core-js/library/modules/_set-species.js": { "id": 133 },
|
|
139
|
+
"./node_modules/core-js/library/modules/_iter-detect.js": { "id": 134 },
|
|
140
|
+
"./node_modules/core-js/library/modules/_meta.js": { "id": 135 },
|
|
141
|
+
"./node_modules/core-js/library/modules/_enum-keys.js": { "id": 136 },
|
|
142
|
+
"./node_modules/core-js/library/modules/_array-includes.js": { "id": 137 },
|
|
143
|
+
"./node_modules/core-js/library/modules/_to-absolute-index.js": { "id": 138 },
|
|
144
|
+
"./node_modules/core-js/library/modules/_is-array.js": { "id": 139 },
|
|
145
|
+
"./node_modules/core-js/library/modules/_object-dps.js": { "id": 140 },
|
|
146
|
+
"./node_modules/core-js/library/modules/_object-gopn-ext.js": { "id": 141 },
|
|
147
|
+
"./node_modules/prop-types/factoryWithTypeCheckers.js": { "id": 142 },
|
|
148
|
+
"./node_modules/react-is/index.js": { "id": 143 },
|
|
149
|
+
"./node_modules/react-is/cjs/react-is.production.min.js": { "id": 144 },
|
|
150
|
+
"./node_modules/regenerator-runtime/runtime.js": { "id": 145 },
|
|
151
|
+
"./node_modules/babel-runtime/core-js/symbol/iterator.js": { "id": 146 },
|
|
152
|
+
"./node_modules/core-js/library/fn/symbol/iterator.js": { "id": 147 },
|
|
153
|
+
"./node_modules/core-js/library/modules/es6.string.iterator.js": { "id": 148 },
|
|
154
|
+
"./node_modules/core-js/library/modules/_string-at.js": { "id": 149 },
|
|
155
|
+
"./node_modules/core-js/library/modules/_iter-create.js": { "id": 150 },
|
|
156
|
+
"./node_modules/core-js/library/modules/web.dom.iterable.js": { "id": 151 },
|
|
157
|
+
"./node_modules/core-js/library/modules/es6.array.iterator.js": { "id": 152 },
|
|
158
|
+
"./node_modules/core-js/library/modules/_add-to-unscopables.js": { "id": 153 },
|
|
159
|
+
"./node_modules/core-js/library/modules/_iter-step.js": { "id": 154 },
|
|
160
|
+
"./node_modules/babel-runtime/core-js/symbol.js": { "id": 155 },
|
|
161
|
+
"./node_modules/core-js/library/fn/symbol/index.js": { "id": 156 },
|
|
162
|
+
"./node_modules/core-js/library/modules/es6.object.to-string.js": { "id": 157 },
|
|
163
|
+
"./node_modules/core-js/library/modules/es7.symbol.async-iterator.js": { "id": 158 },
|
|
164
|
+
"./node_modules/core-js/library/modules/es7.symbol.observable.js": { "id": 159 },
|
|
165
|
+
"./node_modules/babel-runtime/helpers/inherits.js": { "id": 160 },
|
|
166
|
+
"./node_modules/babel-runtime/core-js/object/set-prototype-of.js": { "id": 161 },
|
|
167
|
+
"./node_modules/core-js/library/fn/object/set-prototype-of.js": { "id": 162 },
|
|
168
|
+
"./node_modules/core-js/library/modules/es6.object.set-prototype-of.js": { "id": 163 },
|
|
169
|
+
"./node_modules/core-js/library/modules/_set-proto.js": { "id": 164 },
|
|
170
|
+
"./node_modules/babel-runtime/core-js/object/create.js": { "id": 165 },
|
|
171
|
+
"./node_modules/core-js/library/fn/object/create.js": { "id": 166 },
|
|
172
|
+
"./node_modules/core-js/library/modules/es6.object.create.js": { "id": 167 },
|
|
173
|
+
"./node_modules/babel-runtime/helpers/classCallCheck.js": { "id": 168 },
|
|
174
|
+
"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js": { "id": 169 },
|
|
175
|
+
"./node_modules/babel-runtime/helpers/createClass.js": { "id": 170 },
|
|
176
|
+
"./node_modules/babel-runtime/helpers/extends.js": { "id": 171 },
|
|
177
|
+
"./node_modules/babel-runtime/helpers/defineProperty.js": { "id": 172 },
|
|
178
|
+
"./node_modules/babel-runtime/helpers/get.js": { "id": 173 },
|
|
179
|
+
"./node_modules/performance-now/lib/performance-now.js": { "id": 176 }
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable import/first */
|
|
3
|
+
|
|
4
|
+
/// <reference types="@qse/edu-scripts/app" />
|
|
5
|
+
|
|
6
|
+
import '@qse/edu-login'
|
|
7
|
+
declare module '@qse/edu-login' {
|
|
8
|
+
interface IConfig {
|
|
9
|
+
// 拓展 config
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IUser {
|
|
13
|
+
// 拓展 config.user
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { defineConfig } = require('@qse/edu-scripts')
|
|
2
|
+
|
|
3
|
+
// if (process.env.NODE_ENV === 'development') {
|
|
4
|
+
// process.env.BROWSERSLIST = 'ie 11'
|
|
5
|
+
// }
|
|
6
|
+
|
|
7
|
+
module.exports = defineConfig({
|
|
8
|
+
webpack: (config) => {
|
|
9
|
+
return config
|
|
10
|
+
},
|
|
11
|
+
devServer: (config) => {
|
|
12
|
+
return config
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import styles from './ModuleFileName.less'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Component } from 'refast'
|
|
4
|
+
import logic from './ModuleLogicName'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} ModuleNameProps
|
|
8
|
+
* @property {string} [name]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @extends {React.Component<ModuleNameProps>}
|
|
13
|
+
*/
|
|
14
|
+
export default class ModuleName extends Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props, logic)
|
|
17
|
+
this.state = {
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
return <div className={styles.ModuleName}></div>
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import styles from './ModuleFileName.less'
|
|
2
|
+
import React, { Component } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface ModuleNameState {}
|
|
5
|
+
export interface ModuleNameProps {}
|
|
6
|
+
export default class ModuleName extends Component<ModuleNameProps, ModuleNameState> {
|
|
7
|
+
render() {
|
|
8
|
+
return <div className={styles.ModuleName}></div>
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styles from './ModuleFileName.less'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {object} ModuleNameProps
|
|
6
|
+
* @property {string} [name]
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @type {React.FC<ModuleNameProps>}
|
|
11
|
+
*/
|
|
12
|
+
const ModuleName = (props) => {
|
|
13
|
+
return <div className={styles.ModuleName}></div>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ModuleName
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Control } from 'react-keeper'
|
|
2
|
+
|
|
3
|
+
const moduleNameRoute = {
|
|
4
|
+
Load: (callback) => {
|
|
5
|
+
const prePath = Control.path
|
|
6
|
+
import(/* webpackChunkName: 'moduleName' */ './ModuleName').then((mod) => {
|
|
7
|
+
callback(Control.path === prePath ? mod.default : null)
|
|
8
|
+
})
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default moduleNameRoute
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"jsx": "preserve",
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"baseUrl": "./",
|
|
10
|
+
"paths": {
|
|
11
|
+
"@/*": ["src/*"]
|
|
12
|
+
},
|
|
13
|
+
"allowJs": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"strict": true,
|
|
19
|
+
"useUnknownInCatchVariables": false,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"downlevelIteration": true,
|
|
22
|
+
"resolveJsonModule": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
|
|
5
|
+
const paths = require('./config/paths');
|
|
6
|
+
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
|
|
11
|
+
const pkg = require('../package.json');
|
|
12
|
+
|
|
13
|
+
const glob = require('globby');
|
|
14
|
+
|
|
15
|
+
const ora = require('ora');
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
prompt
|
|
19
|
+
} = require('inquirer');
|
|
20
|
+
|
|
21
|
+
const open = require('open');
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} msg
|
|
24
|
+
* @param {(spinner:ora.Ora) => void | Promise<void>} callback
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
async function step(msg, callback) {
|
|
29
|
+
const spinner = ora(msg).start();
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
await callback(spinner);
|
|
33
|
+
spinner.succeed();
|
|
34
|
+
} catch (error) {
|
|
35
|
+
spinner.fail();
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = async function autoRefactor() {
|
|
41
|
+
if (await fs.pathExists(paths.public)) {
|
|
42
|
+
console.log(chalk.green('已完成改造,不需要重复执行,如果运行报错请查看文档'));
|
|
43
|
+
console.log(`文档: ${chalk.underline(pkg.homepage)}`);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const appPkg = require(paths.package);
|
|
48
|
+
|
|
49
|
+
const answers = await prompt([{
|
|
50
|
+
type: 'input',
|
|
51
|
+
name: 'name',
|
|
52
|
+
message: '请输入模块名称,要求唯一,不能与其他工程相同',
|
|
53
|
+
default: appPkg.name,
|
|
54
|
+
validate: v => /^[a-z][a-z0-9_-]+$/.test(v) || '请按格式输入 /^[a-z][a-z0-9_-]+$/ 只能使用小写字母、连字符、下划线'
|
|
55
|
+
}, {
|
|
56
|
+
type: 'input',
|
|
57
|
+
name: 'version',
|
|
58
|
+
message: '版本号',
|
|
59
|
+
default: '1.0.0',
|
|
60
|
+
validate: v => /^\d+\.\d+\.\d+$/.test(v) || '请按格式输入 /^\\d+\\.\\d+\\.\\d+$/ 例如: 1.0.0'
|
|
61
|
+
}, {
|
|
62
|
+
type: 'list',
|
|
63
|
+
name: 'mode',
|
|
64
|
+
message: '项目使用的哪种模式',
|
|
65
|
+
choices: [{
|
|
66
|
+
name: '教育子工程模式',
|
|
67
|
+
value: ''
|
|
68
|
+
}, {
|
|
69
|
+
name: '教育主工程模式',
|
|
70
|
+
value: 'main'
|
|
71
|
+
}, {
|
|
72
|
+
name: '独立模式',
|
|
73
|
+
value: 'single'
|
|
74
|
+
}]
|
|
75
|
+
}, {
|
|
76
|
+
type: 'checkbox',
|
|
77
|
+
name: 'deploy',
|
|
78
|
+
message: '项目需要部署到哪里',
|
|
79
|
+
when: ans => ans.mode !== 'single',
|
|
80
|
+
choices: [{
|
|
81
|
+
name: '校端',
|
|
82
|
+
value: '-s'
|
|
83
|
+
}, {
|
|
84
|
+
name: '局端',
|
|
85
|
+
value: '-b'
|
|
86
|
+
}, {
|
|
87
|
+
name: '公文端',
|
|
88
|
+
value: '-d'
|
|
89
|
+
}],
|
|
90
|
+
validate: v => !!v && v.length > 0 || '必须选一个'
|
|
91
|
+
}]);
|
|
92
|
+
appPkg.name = answers.name;
|
|
93
|
+
appPkg.version = answers.version;
|
|
94
|
+
await step('创建 public 文件夹', async () => {
|
|
95
|
+
await fs.mkdir(paths.public);
|
|
96
|
+
});
|
|
97
|
+
await step('移动 js 文件夹', async () => {
|
|
98
|
+
if (await fs.pathExists(path.resolve(paths.src, 'js'))) {
|
|
99
|
+
await fs.move(path.resolve(paths.src, 'js'), path.resolve(paths.public, 'js'));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
await step('移动 html 文件', async () => {
|
|
103
|
+
const HTMLFiles = await glob('*.html', {
|
|
104
|
+
cwd: paths.src
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
for (const file of HTMLFiles) {
|
|
108
|
+
await fs.move(path.resolve(paths.src, file), path.resolve(paths.public, file));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
await step('删除 dll 文件夹', async () => {
|
|
112
|
+
if (await fs.pathExists(path.resolve(paths.src, 'dll'))) {
|
|
113
|
+
await fs.remove(path.resolve(paths.src, 'dll'));
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
await step('删除没用的 babel 和 webpack 配置', async () => {
|
|
117
|
+
const deleteFiles = [...(await glob('{.,*}babel*')), ...(await glob('*webpack*')), ...(await glob('package-lock.json')), paths.nodeModules, paths.sshSftp];
|
|
118
|
+
|
|
119
|
+
for (const filePath of deleteFiles) {
|
|
120
|
+
await fs.remove(filePath);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
await step('设置项目模式', () => {
|
|
124
|
+
if (answers.mode) {
|
|
125
|
+
appPkg.edu = {
|
|
126
|
+
mode: answers.mode
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
await step('修改 package.json 的 scripts', () => {
|
|
131
|
+
const scripts = appPkg.scripts;
|
|
132
|
+
scripts.start = 'edu-scripts start';
|
|
133
|
+
scripts.build = 'edu-scripts build';
|
|
134
|
+
scripts.analyze = 'edu-scripts build --analyze';
|
|
135
|
+
|
|
136
|
+
if (answers.mode !== 'single') {
|
|
137
|
+
scripts.deploy = `edu-scripts deploy ${answers.deploy.join(' ')}`;
|
|
138
|
+
} else {
|
|
139
|
+
scripts.deploy = `edu-scripts deploy`;
|
|
140
|
+
scripts['commit-dist'] = 'edu-scripts commit-dist --rm-local';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
scripts['one-key-deploy'] = 'npm version patch';
|
|
144
|
+
scripts.postversion = 'npm run build && npm run deploy';
|
|
145
|
+
});
|
|
146
|
+
await step('删除 babel/webpack 相关依赖', spinner => {
|
|
147
|
+
const deleteRe = /(babel|autoprefixer|webpack|loader|less|css|sass|hmr|ssh-sftp|regenerator-runtime|nowa)/i;
|
|
148
|
+
const deletePkgs = {
|
|
149
|
+
dependencies: [],
|
|
150
|
+
devDependencies: []
|
|
151
|
+
};
|
|
152
|
+
Object.entries(deletePkgs).forEach(([scope, pkgs]) => {
|
|
153
|
+
for (const key in appPkg[scope]) {
|
|
154
|
+
if (Object.hasOwnProperty.call(appPkg[scope], key)) {
|
|
155
|
+
if (deleteRe.test(key)) {
|
|
156
|
+
pkgs.push(key);
|
|
157
|
+
delete appPkg[scope][key];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
spinner.clear();
|
|
163
|
+
console.log(`删除的pkgs\n${chalk.green(JSON.stringify(deletePkgs, null, 2))}\n`);
|
|
164
|
+
appPkg.devDependencies['@qse/edu-scripts'] = '^' + pkg.version;
|
|
165
|
+
});
|
|
166
|
+
await fs.writeFile(paths.package, JSON.stringify(appPkg, null, 2), 'utf-8');
|
|
167
|
+
open(`${pkg.homepage}#/refactor`);
|
|
168
|
+
console.log(chalk.green(`
|
|
169
|
+
改造还未完成,剩余步骤请查看文档
|
|
170
|
+
${pkg.homepage}#/refactor
|
|
171
|
+
|
|
172
|
+
运行 npm i 安装依赖
|
|
173
|
+
运行 edu-scripts start 启动服务
|
|
174
|
+
`));
|
|
175
|
+
};
|
package/lib/build.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
process.env.NODE_ENV = 'production';
|
|
4
|
+
process.env.BABEL_ENV = 'production';
|
|
5
|
+
process.env.BROWSERSLIST = '>0.25%, not dead, not op_mini all';
|
|
6
|
+
|
|
7
|
+
const webpack = require('webpack');
|
|
8
|
+
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
|
|
11
|
+
const getConfig = require('./utils/getConfig');
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
measureFileSizesBeforeBuild,
|
|
15
|
+
printFileSizesAfterBuild
|
|
16
|
+
} = require('./utils/FileSizeReporter');
|
|
17
|
+
|
|
18
|
+
const paths = require('./config/paths');
|
|
19
|
+
|
|
20
|
+
const fs = require('fs-extra');
|
|
21
|
+
|
|
22
|
+
const appConfig = require('./utils/appConfig');
|
|
23
|
+
|
|
24
|
+
const WARN_AFTER_BUNDLE_GZIP_SIZE = appConfig.single ? 1024 * 1024 : 30 * 1024;
|
|
25
|
+
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
26
|
+
|
|
27
|
+
module.exports = async function build(args) {
|
|
28
|
+
if (args.analyze) {
|
|
29
|
+
process.env.ANALYZE = '1';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (args.outputHtml) {
|
|
33
|
+
process.env.OUTPUT_HTML = '1';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const previousSizeMap = await measureFileSizesBeforeBuild(paths.dist);
|
|
37
|
+
fs.emptyDirSync(paths.dist);
|
|
38
|
+
|
|
39
|
+
if (appConfig.single) {
|
|
40
|
+
fs.copySync(paths.public, paths.resolveApp('dist'));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (appConfig.mainProject && fs.existsSync(paths.static)) {
|
|
44
|
+
fs.copySync(paths.static, paths.resolveApp('dist', 'static'));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
webpack(getConfig(args), (error, stats) => {
|
|
48
|
+
if (error) {
|
|
49
|
+
console.log(chalk.red('编译失败'));
|
|
50
|
+
console.log(chalk.red(error.message || error));
|
|
51
|
+
console.log();
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (stats.compilation.errors.length) {
|
|
56
|
+
console.log(chalk.red('编译失败'));
|
|
57
|
+
console.log(stats.toString({
|
|
58
|
+
all: false,
|
|
59
|
+
errors: true,
|
|
60
|
+
colors: true
|
|
61
|
+
}));
|
|
62
|
+
} // Fail the build if running in a CI server
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if (error || stats.compilation.errors.length) {
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log(stats.toString({
|
|
70
|
+
colors: true,
|
|
71
|
+
preset: 'errors-warnings',
|
|
72
|
+
timings: true
|
|
73
|
+
}));
|
|
74
|
+
console.log();
|
|
75
|
+
console.log('gzip 后文件大小:\n');
|
|
76
|
+
printFileSizesAfterBuild(stats, previousSizeMap, paths.dist, WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_CHUNK_GZIP_SIZE);
|
|
77
|
+
console.log();
|
|
78
|
+
|
|
79
|
+
if (appConfig.single) {
|
|
80
|
+
console.log(`打包完成,可以使用 ${chalk.green('@qse/ssh-sftp')} 自动部署代码到 v1`);
|
|
81
|
+
} else {
|
|
82
|
+
console.log(`打包完成,可以运行 ${chalk.green('npx edu-scripts deploy')} 部署代码到 v1`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
console.log();
|
|
86
|
+
});
|
|
87
|
+
};
|