@qse/edu-scripts 2.0.1 → 2.0.2
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 +3 -5
- package/dist/cli.mjs +12 -4
- package/package.json +4 -4
- package/src/config/plugins/mock-server/index.ts +3 -4
- package/src/config/webpackConfig.ts +10 -1
- package/src/utils/beforeStart.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# 教育工程化基础框架
|
|
2
2
|
|
|
3
|
-
svn://192.168.10.168/
|
|
4
|
-
|
|
5
|
-
<Alert>内网里的 @qsb/edu-scripts 已经弃用,请更换成公网的 @qse/edu-scripts </Alert>
|
|
3
|
+
svn://192.168.10.168/qsedu/code/00.common/02.front-end-component/06.edu-scripts/trunk
|
|
6
4
|
|
|
7
5
|
## 运行条件
|
|
8
6
|
|
|
9
|
-
nodejs 版本至少
|
|
7
|
+
nodejs 版本至少 18+
|
|
10
8
|
|
|
11
9
|
## 快速体验
|
|
12
10
|
|
|
@@ -95,7 +93,7 @@ npx edu-scripts g override
|
|
|
95
93
|
根目录生成 `theme.js` 或 `theme.json`
|
|
96
94
|
|
|
97
95
|
```js
|
|
98
|
-
|
|
96
|
+
export default {
|
|
99
97
|
'@primary-color': '#99f',
|
|
100
98
|
}
|
|
101
99
|
```
|
package/dist/cli.mjs
CHANGED
|
@@ -129,7 +129,7 @@ if (!(appConfig.single || appConfig.mainProject)) {
|
|
|
129
129
|
console.log(chalk.bgYellow("教育集成工程不能含有 public/static, 现已自动删除"));
|
|
130
130
|
try {
|
|
131
131
|
fs.rmSync(paths.static, { recursive: true });
|
|
132
|
-
} catch
|
|
132
|
+
} catch {}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
if (!fs.existsSync(paths.public) && !process.argv.includes("auto-refactor")) {
|
|
@@ -180,6 +180,14 @@ const PostcssSafeAreaPlugin = () => {
|
|
|
180
180
|
//#region src/config/webpackConfig.ts
|
|
181
181
|
const require$2 = createRequire(import.meta.url);
|
|
182
182
|
const appPkg$1 = fs.readJsonSync(paths.package);
|
|
183
|
+
const hasJsxRuntime = (() => {
|
|
184
|
+
try {
|
|
185
|
+
require$2.resolve("react/jsx-runtime");
|
|
186
|
+
return appConfig.single;
|
|
187
|
+
} catch {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
})();
|
|
183
191
|
const jsMainPath = appConfig.grayscale ? `${appPkg$1.name}/beta/${appPkg$1.name}` : `${appPkg$1.name}/${appPkg$1.name}`;
|
|
184
192
|
const assetPath = appConfig.grayscale ? `${appPkg$1.name}/beta/${appPkg$1.version}` : `${appPkg$1.name}/${appPkg$1.version}`;
|
|
185
193
|
const cssRegex = /\.css$/;
|
|
@@ -348,7 +356,7 @@ function getWebpackConfig(args, override) {
|
|
|
348
356
|
transform: {
|
|
349
357
|
legacyDecorator: override.decorators,
|
|
350
358
|
react: {
|
|
351
|
-
runtime: "automatic",
|
|
359
|
+
runtime: hasJsxRuntime ? "automatic" : "classic",
|
|
352
360
|
development: isDev,
|
|
353
361
|
refresh: isDev
|
|
354
362
|
}
|
|
@@ -565,9 +573,9 @@ const setupMock = debounce(function setupMock() {
|
|
|
565
573
|
}
|
|
566
574
|
}, 100);
|
|
567
575
|
const getPathReAndKeys = memoize((path) => {
|
|
568
|
-
const keys =
|
|
576
|
+
const { regexp, keys } = pathToRegexp(path);
|
|
569
577
|
return {
|
|
570
|
-
re:
|
|
578
|
+
re: regexp,
|
|
571
579
|
keys
|
|
572
580
|
};
|
|
573
581
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qse/edu-scripts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"author": "Kinoko",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"docs:build": "vitepress build docs",
|
|
15
15
|
"docs:deploy": "ssh-sftp",
|
|
16
16
|
"build": "tsdown",
|
|
17
|
-
"deploy": "node scripts/deploy.js",
|
|
18
|
-
"release": "npm run test && npm run build && npm publish && rimraf dist",
|
|
17
|
+
"deploy": "node scripts/deploy.js && rimraf .vitepress/dist",
|
|
18
|
+
"release": "npm run lint && npm run test && npm run build && npm publish && rimraf dist",
|
|
19
19
|
"prettier": "prettier -c -w \"src/**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
|
20
|
-
"lint": "eslint --fix src",
|
|
20
|
+
"lint": "eslint --fix src && tsc --noEmit",
|
|
21
21
|
"postversion": "npm run release",
|
|
22
22
|
"test": "jest"
|
|
23
23
|
},
|
|
@@ -7,7 +7,7 @@ import fs from 'fs-extra'
|
|
|
7
7
|
import express from 'express'
|
|
8
8
|
import cookieParser from 'cookie-parser'
|
|
9
9
|
import multer from 'multer'
|
|
10
|
-
import { pathToRegexp
|
|
10
|
+
import { pathToRegexp } from 'path-to-regexp'
|
|
11
11
|
import { createRequire } from 'node:module'
|
|
12
12
|
import { resolveModule } from '@/utils/resolveModule'
|
|
13
13
|
const require = createRequire(import.meta.url)
|
|
@@ -44,9 +44,8 @@ const setupMock = debounce(function setupMock() {
|
|
|
44
44
|
}, 100)
|
|
45
45
|
|
|
46
46
|
const getPathReAndKeys = memoize((path: string) => {
|
|
47
|
-
const keys
|
|
48
|
-
|
|
49
|
-
return { re, keys }
|
|
47
|
+
const { regexp, keys } = pathToRegexp(path)
|
|
48
|
+
return { re: regexp, keys }
|
|
50
49
|
})
|
|
51
50
|
|
|
52
51
|
function decodeParam(val: string) {
|
|
@@ -16,6 +16,15 @@ import PostcssSafeAreaPlugin from './plugins/postcss-safe-area'
|
|
|
16
16
|
const require = createRequire(import.meta.url)
|
|
17
17
|
const appPkg = fs.readJsonSync(paths.package) as { name: string; version: string }
|
|
18
18
|
|
|
19
|
+
const hasJsxRuntime = (() => {
|
|
20
|
+
try {
|
|
21
|
+
require.resolve('react/jsx-runtime')
|
|
22
|
+
return appConfig.single
|
|
23
|
+
} catch {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
})()
|
|
27
|
+
|
|
19
28
|
const jsMainPath = appConfig.grayscale
|
|
20
29
|
? `${appPkg.name}/beta/${appPkg.name}`
|
|
21
30
|
: `${appPkg.name}/${appPkg.name}`
|
|
@@ -249,7 +258,7 @@ export default function getWebpackConfig(args: any, override: CustomConfiguratio
|
|
|
249
258
|
transform: {
|
|
250
259
|
legacyDecorator: override.decorators,
|
|
251
260
|
react: {
|
|
252
|
-
runtime: 'automatic',
|
|
261
|
+
runtime: hasJsxRuntime ? 'automatic' : 'classic',
|
|
253
262
|
development: isDev,
|
|
254
263
|
refresh: isDev,
|
|
255
264
|
},
|
package/src/utils/beforeStart.ts
CHANGED