@qse/edu-scripts 0.0.0-beta.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 +5 -0
- package/README.md +107 -0
- package/app.d.ts +73 -0
- package/babel.config.json +3 -0
- package/docs/.vitepress/config.ts +35 -0
- package/docs/changelog.md +1 -0
- package/docs/debug.md +17 -0
- package/docs/deploy.md +54 -0
- package/docs/faq.md +144 -0
- package/docs/feat.md +167 -0
- package/docs/grayscale.md +31 -0
- package/docs/index.md +15 -0
- package/docs/install.md +1 -0
- package/docs/mode.md +42 -0
- package/docs/override.md +193 -0
- package/docs/refactor-react-16.md +37 -0
- package/docs/refactor.md +67 -0
- package/docs/static.md +24 -0
- package/es/asset/dll/libcommon3-manifest.json +181 -0
- package/es/asset/template/edu-app-env.d.ts.tpl +20 -0
- package/es/asset/template/edu-scripts.override.js.tpl +7 -0
- package/es/asset/template/tailwind.config.js.tpl +11 -0
- package/es/asset/template/tsconfig.json.tpl +24 -0
- package/es/auto-refactor.js +153 -0
- package/es/build.js +58 -0
- package/es/cli.js +65 -0
- package/es/commit-dist.js +83 -0
- package/es/config/paths.js +39 -0
- package/es/config/plugins/mock-server/defineMock.d.ts +6 -0
- package/es/config/plugins/mock-server/defineMock.js +7 -0
- package/es/config/plugins/mock-server/index.js +122 -0
- package/es/config/plugins/postcss-safe-area.js +22 -0
- package/es/config/plugins/ws-utils-createSocketURL.js +98 -0
- package/es/config/webpackConfig.js +418 -0
- package/es/config/webpackDevServerConfig.js +73 -0
- package/es/deploy.js +148 -0
- package/es/generator.js +52 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +7 -0
- package/es/start.js +36 -0
- package/es/utils/FileSizeReporter.js +107 -0
- package/es/utils/appConfig.js +35 -0
- package/es/utils/beforeStart.js +51 -0
- package/es/utils/changeDeployVersion.js +85 -0
- package/es/utils/defineConfig.d.ts +76 -0
- package/es/utils/defineConfig.js +7 -0
- package/es/utils/exec.js +10 -0
- package/es/utils/getConfig.js +23 -0
- package/es/utils/getOverride.js +28 -0
- package/eslint.config.mjs +3 -0
- package/jest.config.mjs +199 -0
- package/package.json +95 -0
- package/src/asset/dll/libcommon3-manifest.json +181 -0
- package/src/asset/template/edu-app-env.d.ts.tpl +20 -0
- package/src/asset/template/edu-scripts.override.js.tpl +7 -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 +170 -0
- package/src/build.js +64 -0
- package/src/cli.js +88 -0
- package/src/commit-dist.js +103 -0
- package/src/config/paths.js +38 -0
- package/src/config/plugins/mock-server/defineMock.ts +12 -0
- package/src/config/plugins/mock-server/index.js +150 -0
- package/src/config/plugins/postcss-safe-area.js +21 -0
- package/src/config/plugins/ws-utils-createSocketURL.js +140 -0
- package/src/config/webpackConfig.js +444 -0
- package/src/config/webpackDevServerConfig.js +83 -0
- package/src/deploy.js +182 -0
- package/src/generator.js +67 -0
- package/src/index.ts +2 -0
- package/src/start.js +37 -0
- package/src/utils/FileSizeReporter.js +148 -0
- package/src/utils/appConfig.js +36 -0
- package/src/utils/beforeStart.js +55 -0
- package/src/utils/changeDeployVersion.js +119 -0
- package/src/utils/defineConfig.ts +81 -0
- package/src/utils/exec.js +7 -0
- package/src/utils/getConfig.js +26 -0
- package/src/utils/getOverride.js +33 -0
- package/tsconfig.json +21 -0
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qse/edu-scripts",
|
|
3
|
+
"version": "0.0.0-beta.0",
|
|
4
|
+
"author": "Kinoko",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"description": "教育工程化基础框架",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=18"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"docs:dev": "vitepress dev docs",
|
|
13
|
+
"docs:build": "vitepress build docs",
|
|
14
|
+
"docs:deploy": "ssh-sftp",
|
|
15
|
+
"build": "father build",
|
|
16
|
+
"deploy": "node scripts/deploy.js",
|
|
17
|
+
"release": "npm run test && npm run build && npm publish && rimraf es",
|
|
18
|
+
"prettier": "prettier -c -w \"src/**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
|
19
|
+
"lint": "eslint --fix src",
|
|
20
|
+
"postversion": "npm run release",
|
|
21
|
+
"test": "jest"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "http://192.168.10.19:3339/qsxxwapdev/edu-scripts/",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"registry": "https://registry.npmjs.org/",
|
|
26
|
+
"access": "public",
|
|
27
|
+
"tag": "beta"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"edu-scripts": "es/cli.js",
|
|
31
|
+
"edu": "es/cli.js"
|
|
32
|
+
},
|
|
33
|
+
"main": "es/index.js",
|
|
34
|
+
"typings": "es/index.d.ts",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@babel/core": "~7.29.0",
|
|
37
|
+
"@qse/ssh-sftp": "^1.2.0",
|
|
38
|
+
"@rspack/core": "^1.7.6",
|
|
39
|
+
"@rspack/dev-server": "^1.2.1",
|
|
40
|
+
"@rspack/plugin-react-refresh": "^1.6.1",
|
|
41
|
+
"@svgr/webpack": "^8.1.0",
|
|
42
|
+
"@swc-node/register": "^1.11.1",
|
|
43
|
+
"@types/express": "^4.17.25",
|
|
44
|
+
"chalk": "^4.1.2",
|
|
45
|
+
"chokidar": "^3.6.0",
|
|
46
|
+
"cookie-parser": "^1.4.7",
|
|
47
|
+
"css-loader": "^6.11.0",
|
|
48
|
+
"cssnano": "^6.1.2",
|
|
49
|
+
"express": "^4.21.2",
|
|
50
|
+
"filesize": "^8.0.7",
|
|
51
|
+
"fs-extra": "^11.3.3",
|
|
52
|
+
"globby": "^16.1.1",
|
|
53
|
+
"gzip-size": "^7.0.0",
|
|
54
|
+
"html-webpack-plugin": "^5.6.6",
|
|
55
|
+
"inquirer": "^13.3.0",
|
|
56
|
+
"less": "^3.13.1",
|
|
57
|
+
"less-loader": "^10.2.0",
|
|
58
|
+
"lodash-es": "^4.17.23",
|
|
59
|
+
"multer": "^2.1.0",
|
|
60
|
+
"ora": "^9.3.0",
|
|
61
|
+
"path-to-regexp": "^6.3.0",
|
|
62
|
+
"postcss": "^8.5.3",
|
|
63
|
+
"postcss-flexbugs-fixes": "^5.0.2",
|
|
64
|
+
"postcss-loader": "^7.3.4",
|
|
65
|
+
"postcss-momentum-scrolling": "^3.14.22",
|
|
66
|
+
"postcss-normalize": "^8.0.1",
|
|
67
|
+
"postcss-preset-env": "^9.6.0",
|
|
68
|
+
"prettier": "^3.8.1",
|
|
69
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
70
|
+
"react-refresh": "^0.14.2",
|
|
71
|
+
"recursive-readdir": "^2.2.3",
|
|
72
|
+
"semver": "^7.7.1",
|
|
73
|
+
"strip-ansi": "^6.0.1",
|
|
74
|
+
"style-loader": "^3.3.4",
|
|
75
|
+
"tailwindcss": "^3.4.19",
|
|
76
|
+
"tmp": "^0.2.3",
|
|
77
|
+
"typescript": "^5.9.3",
|
|
78
|
+
"update-notifier": "^7.3.1",
|
|
79
|
+
"url-loader": "^4.1.1",
|
|
80
|
+
"webpack-bundle-analyzer": "^5.2.0",
|
|
81
|
+
"yargs": "^17.7.2"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@babel/preset-env": "~7.29.0",
|
|
85
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
86
|
+
"@types/fs-extra": "^11.0.4",
|
|
87
|
+
"@types/jest": "^30.0.0",
|
|
88
|
+
"@types/yargs": "^17.0.35",
|
|
89
|
+
"eslint-config-qsb-react": "^2.0.4",
|
|
90
|
+
"father": "^4.5.2",
|
|
91
|
+
"jest": "^30.2.0",
|
|
92
|
+
"rimraf": "^6.1.3",
|
|
93
|
+
"vitepress": "^1.6.4"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -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,20 @@
|
|
|
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
|
+
}
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
interface Window {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -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,170 @@
|
|
|
1
|
+
import fs from 'fs-extra'
|
|
2
|
+
import paths from './config/paths.js'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import chalk from 'chalk'
|
|
5
|
+
import { globby } from 'globby'
|
|
6
|
+
import ora from 'ora'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
import inquirer from 'inquirer'
|
|
9
|
+
|
|
10
|
+
const pkg = fs.readJsonSync(fileURLToPath(import.meta.resolve('../package.json')))
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} msg
|
|
13
|
+
* @param {(spinner:import("ora").Ora) => void | Promise<void>} callback
|
|
14
|
+
*/
|
|
15
|
+
async function step(msg, callback) {
|
|
16
|
+
const spinner = ora(msg).start()
|
|
17
|
+
try {
|
|
18
|
+
await callback(spinner)
|
|
19
|
+
spinner.succeed()
|
|
20
|
+
} catch (error) {
|
|
21
|
+
spinner.fail()
|
|
22
|
+
throw error
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default async function autoRefactor() {
|
|
27
|
+
if (await fs.pathExists(paths.public)) {
|
|
28
|
+
console.log(chalk.green('已完成改造,不需要重复执行,如果运行报错请查看文档'))
|
|
29
|
+
console.log(`文档: ${chalk.underline(pkg.homepage)}`)
|
|
30
|
+
process.exit(0)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const appPkg = fs.readJsonSync(paths.package)
|
|
34
|
+
const answers = await inquirer.prompt([
|
|
35
|
+
{
|
|
36
|
+
type: 'input',
|
|
37
|
+
name: 'name',
|
|
38
|
+
message: '请输入模块名称,要求唯一,不能与其他工程相同',
|
|
39
|
+
default: appPkg.name,
|
|
40
|
+
validate: (v) =>
|
|
41
|
+
/^[a-z][a-z0-9_-]+$/.test(v) ||
|
|
42
|
+
'请按格式输入 /^[a-z][a-z0-9_-]+$/ 只能使用小写字母、连字符、下划线',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'input',
|
|
46
|
+
name: 'version',
|
|
47
|
+
message: '版本号',
|
|
48
|
+
default: '1.0.0',
|
|
49
|
+
validate: (v) =>
|
|
50
|
+
/^\d+\.\d+\.\d+$/.test(v) || '请按格式输入 /^\\d+\\.\\d+\\.\\d+$/ 例如: 1.0.0',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'list',
|
|
54
|
+
name: 'mode',
|
|
55
|
+
message: '项目使用的哪种模式',
|
|
56
|
+
choices: [
|
|
57
|
+
{ name: '教育子工程模式', value: '' },
|
|
58
|
+
{ name: '教育主工程模式', value: 'main' },
|
|
59
|
+
{ name: '独立模式', value: 'single' },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'checkbox',
|
|
64
|
+
name: 'deploy',
|
|
65
|
+
message: '项目需要部署到哪里',
|
|
66
|
+
when: (ans) => ans.mode !== 'single',
|
|
67
|
+
choices: [
|
|
68
|
+
{ name: '校端', value: '-s' },
|
|
69
|
+
{ name: '局端', value: '-b' },
|
|
70
|
+
{ name: '公文端', value: '-d' },
|
|
71
|
+
],
|
|
72
|
+
validate: (v) => (!!v && v.length > 0) || '必须选一个',
|
|
73
|
+
},
|
|
74
|
+
])
|
|
75
|
+
appPkg.name = answers.name
|
|
76
|
+
appPkg.version = answers.version
|
|
77
|
+
|
|
78
|
+
await step('创建 public 文件夹', async () => {
|
|
79
|
+
await fs.mkdir(paths.public)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
await step('移动 js 文件夹', async () => {
|
|
83
|
+
if (await fs.pathExists(path.resolve(paths.src, 'js'))) {
|
|
84
|
+
await fs.move(path.resolve(paths.src, 'js'), path.resolve(paths.public, 'js'))
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
await step('移动 html 文件', async () => {
|
|
89
|
+
const HTMLFiles = await globby('*.html', { cwd: paths.src })
|
|
90
|
+
for (const file of HTMLFiles) {
|
|
91
|
+
await fs.move(path.resolve(paths.src, file), path.resolve(paths.public, file))
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
await step('删除 dll 文件夹', async () => {
|
|
96
|
+
if (await fs.pathExists(path.resolve(paths.src, 'dll'))) {
|
|
97
|
+
await fs.remove(path.resolve(paths.src, 'dll'))
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
await step('删除没用的 babel 和 webpack 配置', async () => {
|
|
102
|
+
const deleteFiles = [
|
|
103
|
+
...(await globby('{.,*}babel*')),
|
|
104
|
+
...(await globby('*webpack*')),
|
|
105
|
+
...(await globby('package-lock.json')),
|
|
106
|
+
paths.nodeModules,
|
|
107
|
+
paths.sshSftp,
|
|
108
|
+
]
|
|
109
|
+
for (const filePath of deleteFiles) {
|
|
110
|
+
await fs.remove(filePath)
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
await step('设置项目模式', () => {
|
|
115
|
+
if (answers.mode) {
|
|
116
|
+
appPkg.edu = { mode: answers.mode }
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
await step('修改 package.json 的 scripts', () => {
|
|
121
|
+
const scripts = appPkg.scripts
|
|
122
|
+
scripts.start = 'edu-scripts start'
|
|
123
|
+
scripts.build = 'edu-scripts build'
|
|
124
|
+
scripts.analyze = 'edu-scripts build --analyze'
|
|
125
|
+
if (answers.mode !== 'single') {
|
|
126
|
+
scripts.deploy = `edu-scripts deploy ${answers.deploy.join(' ')}`
|
|
127
|
+
} else {
|
|
128
|
+
scripts.deploy = `edu-scripts deploy`
|
|
129
|
+
scripts['commit-dist'] = 'edu-scripts commit-dist --rm-local'
|
|
130
|
+
}
|
|
131
|
+
scripts['one-key-deploy'] = 'npm version patch'
|
|
132
|
+
scripts.postversion = 'npm run build && npm run deploy'
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
await step('删除 babel/webpack 相关依赖', (spinner) => {
|
|
136
|
+
const deleteRe =
|
|
137
|
+
/(babel|autoprefixer|webpack|loader|less|css|sass|hmr|ssh-sftp|regenerator-runtime|nowa|prettier)/i
|
|
138
|
+
|
|
139
|
+
const deletePkgs = {
|
|
140
|
+
dependencies: [],
|
|
141
|
+
devDependencies: [],
|
|
142
|
+
}
|
|
143
|
+
Object.entries(deletePkgs).forEach(([scope, pkgs]) => {
|
|
144
|
+
for (const key in appPkg[scope]) {
|
|
145
|
+
if (Object.hasOwnProperty.call(appPkg[scope], key)) {
|
|
146
|
+
if (deleteRe.test(key)) {
|
|
147
|
+
pkgs.push(key)
|
|
148
|
+
delete appPkg[scope][key]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
spinner.clear()
|
|
155
|
+
console.log(`删除的pkgs\n${chalk.green(JSON.stringify(deletePkgs, null, 2))}\n`)
|
|
156
|
+
appPkg.devDependencies['@qse/edu-scripts'] = '^' + pkg.version
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
await fs.writeFile(paths.package, JSON.stringify(appPkg, null, 2), 'utf-8')
|
|
160
|
+
|
|
161
|
+
console.log(
|
|
162
|
+
chalk.green(`
|
|
163
|
+
改造还未完成,剩余步骤请查看文档
|
|
164
|
+
${pkg.homepage}#/refactor
|
|
165
|
+
|
|
166
|
+
运行 npm i 安装依赖
|
|
167
|
+
运行 edu-scripts start 启动服务
|
|
168
|
+
`)
|
|
169
|
+
)
|
|
170
|
+
}
|
package/src/build.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { rspack } from '@rspack/core'
|
|
2
|
+
import chalk from 'chalk'
|
|
3
|
+
import getConfig from './utils/getConfig.js'
|
|
4
|
+
import { measureFileSizesBeforeBuild, printFileSizesAfterBuild } from './utils/FileSizeReporter.js'
|
|
5
|
+
import paths from './config/paths.js'
|
|
6
|
+
import fs from 'fs-extra'
|
|
7
|
+
import appConfig from './utils/appConfig.js'
|
|
8
|
+
|
|
9
|
+
const WARN_AFTER_BUNDLE_GZIP_SIZE = appConfig.single ? 1024 * 1024 : 30 * 1024
|
|
10
|
+
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024
|
|
11
|
+
|
|
12
|
+
export default async function build(args) {
|
|
13
|
+
process.env.NODE_ENV = 'production'
|
|
14
|
+
process.env.BABEL_ENV = 'production'
|
|
15
|
+
process.env.BROWSERSLIST = '>0.2%, iOS>=9, ie 11, chrome>=49, not op_mini all'
|
|
16
|
+
|
|
17
|
+
if (args.analyze) {
|
|
18
|
+
process.env.ANALYZE = '1'
|
|
19
|
+
}
|
|
20
|
+
if (args.outputHtml) {
|
|
21
|
+
process.env.OUTPUT_HTML = '1'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const previousSizeMap = await measureFileSizesBeforeBuild(paths.dist)
|
|
25
|
+
fs.emptyDirSync(paths.dist)
|
|
26
|
+
|
|
27
|
+
if (appConfig.single) {
|
|
28
|
+
fs.copySync(paths.public, paths.resolveApp('dist'))
|
|
29
|
+
}
|
|
30
|
+
if (appConfig.mainProject && fs.existsSync(paths.static)) {
|
|
31
|
+
fs.copySync(paths.static, paths.resolveApp('dist', 'static'))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
rspack(getConfig(args), (error, stats) => {
|
|
35
|
+
if (error) {
|
|
36
|
+
console.log(chalk.red('编译失败'))
|
|
37
|
+
console.log(chalk.red(error.message || error))
|
|
38
|
+
process.exit(1)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (stats.compilation.errors.length) {
|
|
42
|
+
console.log(chalk.red('编译失败'))
|
|
43
|
+
console.log(stats.toString({ all: false, errors: true, colors: true }))
|
|
44
|
+
process.exit(1)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log(stats.toString({ colors: true, preset: 'errors-warnings', timings: true }))
|
|
48
|
+
|
|
49
|
+
printFileSizesAfterBuild(
|
|
50
|
+
stats,
|
|
51
|
+
previousSizeMap,
|
|
52
|
+
paths.dist,
|
|
53
|
+
WARN_AFTER_BUNDLE_GZIP_SIZE,
|
|
54
|
+
WARN_AFTER_CHUNK_GZIP_SIZE
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
if (appConfig.single) {
|
|
58
|
+
console.log(`打包完成,可以使用 ${chalk.green('@qse/ssh-sftp')} 自动部署代码到 v1`)
|
|
59
|
+
} else {
|
|
60
|
+
console.log(`打包完成,可以运行 ${chalk.green('npx edu-scripts deploy')} 部署代码到 v1`)
|
|
61
|
+
}
|
|
62
|
+
console.log()
|
|
63
|
+
})
|
|
64
|
+
}
|