@deot/dev-tester 2.6.2 → 2.8.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/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/package.json +7 -7
- package/shared.config.ts +39 -37
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,7 @@ const getOptions = async () => {
|
|
|
45
45
|
source: (_, input) => {
|
|
46
46
|
input = input || "";
|
|
47
47
|
return new Promise(($resolve) => {
|
|
48
|
-
|
|
48
|
+
const filter = input ? packages$.filter((item) => item.includes(input)) : packages$;
|
|
49
49
|
$resolve(filter);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -62,7 +62,7 @@ const getOptions = async () => {
|
|
|
62
62
|
const subpackages = [ALL_PACKAGE, ...subpackagesMap[answers.packageFolderName]];
|
|
63
63
|
input = input || "";
|
|
64
64
|
return new Promise(($resolve) => {
|
|
65
|
-
|
|
65
|
+
const filter = input ? subpackages.filter((item) => item.includes(input)) : subpackages;
|
|
66
66
|
$resolve(filter);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
@@ -84,7 +84,7 @@ const getOptions = async () => {
|
|
|
84
84
|
}
|
|
85
85
|
];
|
|
86
86
|
registerPrompt("autocomplete", autocomplete);
|
|
87
|
-
|
|
87
|
+
const result = await prompt(question);
|
|
88
88
|
result.packageFolderName = result.packageFolderName == ALL_PACKAGE ? void 0 : result.packageFolderName;
|
|
89
89
|
result.subpackageFolderName = result.subpackageFolderName == ALL_PACKAGE ? void 0 : result.subpackageFolderName;
|
|
90
90
|
result.watch = result.watch || isDev;
|
|
@@ -142,7 +142,7 @@ const run = (options) => devShared.Utils.autoCatch(async () => {
|
|
|
142
142
|
const isReactPackage = typeof reactPackage === "string" && (packageName === locals.packageName || packageName === `${locals.packageName}-*` || reactPackage === "*" || reactPackage.split(",").includes(packageName));
|
|
143
143
|
options.useVue = !!isVuePackage;
|
|
144
144
|
options.useReact = !!isReactPackage;
|
|
145
|
-
|
|
145
|
+
const options$ = {
|
|
146
146
|
environment,
|
|
147
147
|
coverage: {
|
|
148
148
|
enabled: !!coverage
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const getOptions = async () => {
|
|
|
21
21
|
source: (_, input) => {
|
|
22
22
|
input = input || "";
|
|
23
23
|
return new Promise(($resolve) => {
|
|
24
|
-
|
|
24
|
+
const filter = input ? packages$.filter((item) => item.includes(input)) : packages$;
|
|
25
25
|
$resolve(filter);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -38,7 +38,7 @@ const getOptions = async () => {
|
|
|
38
38
|
const subpackages = [ALL_PACKAGE, ...subpackagesMap[answers.packageFolderName]];
|
|
39
39
|
input = input || "";
|
|
40
40
|
return new Promise(($resolve) => {
|
|
41
|
-
|
|
41
|
+
const filter = input ? subpackages.filter((item) => item.includes(input)) : subpackages;
|
|
42
42
|
$resolve(filter);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -60,7 +60,7 @@ const getOptions = async () => {
|
|
|
60
60
|
}
|
|
61
61
|
];
|
|
62
62
|
registerPrompt("autocomplete", autocomplete);
|
|
63
|
-
|
|
63
|
+
const result = await prompt(question);
|
|
64
64
|
result.packageFolderName = result.packageFolderName == ALL_PACKAGE ? void 0 : result.packageFolderName;
|
|
65
65
|
result.subpackageFolderName = result.subpackageFolderName == ALL_PACKAGE ? void 0 : result.subpackageFolderName;
|
|
66
66
|
result.watch = result.watch || isDev;
|
|
@@ -118,7 +118,7 @@ const run = (options) => Utils.autoCatch(async () => {
|
|
|
118
118
|
const isReactPackage = typeof reactPackage === "string" && (packageName === locals.packageName || packageName === `${locals.packageName}-*` || reactPackage === "*" || reactPackage.split(",").includes(packageName));
|
|
119
119
|
options.useVue = !!isVuePackage;
|
|
120
120
|
options.useReact = !!isReactPackage;
|
|
121
|
-
|
|
121
|
+
const options$ = {
|
|
122
122
|
environment,
|
|
123
123
|
coverage: {
|
|
124
124
|
enabled: !!coverage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/dev-tester",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@deot/dev-react": "^2.
|
|
24
|
-
"@deot/dev-shared": "^2.
|
|
25
|
-
"@deot/dev-vue": "^2.
|
|
26
|
-
"@vitest/coverage-istanbul": "^0.
|
|
23
|
+
"@deot/dev-react": "^2.8.0",
|
|
24
|
+
"@deot/dev-shared": "^2.8.0",
|
|
25
|
+
"@deot/dev-vue": "^2.8.0",
|
|
26
|
+
"@vitest/coverage-istanbul": "^1.0.4",
|
|
27
27
|
"cross-env": "^7.0.3",
|
|
28
28
|
"inquirer": "^9.2.12",
|
|
29
29
|
"inquirer-autocomplete-prompt": "^3.0.1",
|
|
30
|
-
"jsdom": "^
|
|
31
|
-
"vitest": "^0.
|
|
30
|
+
"jsdom": "^23.0.1",
|
|
31
|
+
"vitest": "^1.0.4"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/shared.config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
|
-
import { createRequire } from
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
3
|
import { defineConfig, configDefaults, mergeConfig } from 'vitest/config';
|
|
4
4
|
import type { UserConfig } from 'vite';
|
|
5
5
|
|
|
@@ -11,8 +11,8 @@ import react from '@vitejs/plugin-react-swc';
|
|
|
11
11
|
* https://github.com/vuejs/core/issues/8303
|
|
12
12
|
* to fix error: ReferenceError: __name is not defined
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const __defProp = Object.defineProperty;
|
|
15
|
+
const __name = (target: any, value: any) => __defProp(target, 'name', { value, configurable: true });
|
|
16
16
|
globalThis.__name = globalThis.__name || __name;
|
|
17
17
|
|
|
18
18
|
// 当库里同时含有vue和react,vue的jsx要含前缀vue
|
|
@@ -22,10 +22,10 @@ const getViteConfig = () => {
|
|
|
22
22
|
if (useVue && useReact) {
|
|
23
23
|
return defineConfig({ plugins: [vue(), vueJSX({ include: /\.vue\.[jt]sx$/ }), react()] });
|
|
24
24
|
}
|
|
25
|
-
return useVue
|
|
26
|
-
? defineConfig({ plugins: [vue(), vueJSX()] })
|
|
25
|
+
return useVue
|
|
26
|
+
? defineConfig({ plugins: [vue(), vueJSX()] })
|
|
27
27
|
: useReact
|
|
28
|
-
? defineConfig({ plugins: [react()] })
|
|
28
|
+
? defineConfig({ plugins: [react()] })
|
|
29
29
|
: {};
|
|
30
30
|
};
|
|
31
31
|
const cwd = process.cwd();
|
|
@@ -41,16 +41,16 @@ const TEST_PATTEN = `**/*.{test,spec}.[jt]s?(x)`;
|
|
|
41
41
|
const COLLECT_PATTEN = `**/*.{[jt]s?(x),vue}`;
|
|
42
42
|
|
|
43
43
|
if (workspace) {
|
|
44
|
-
|
|
44
|
+
const prefixDir = `${workspace}/${packageFolderName || '*'}`;
|
|
45
45
|
tests.push(`${prefixDir}/__tests__/${TEST_PATTEN}`);
|
|
46
46
|
collects.push(`${prefixDir}/src/${COLLECT_PATTEN}`);
|
|
47
47
|
|
|
48
48
|
if (packageFolderName === '*') {
|
|
49
49
|
Object.keys(subpackagesMap).forEach((packageFolderName$: string) => {
|
|
50
|
-
|
|
50
|
+
const subpackages = subpackagesMap[packageFolderName$];
|
|
51
51
|
if (subpackages.length) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const prefixDir$ = `${workspace}/${packageFolderName$}`;
|
|
53
|
+
const subpackagesPatten = `{${subpackages.join(',')},}`;
|
|
54
54
|
|
|
55
55
|
tests.push(`${prefixDir$}/${subpackagesPatten}/__tests__/${TEST_PATTEN}`);
|
|
56
56
|
collects.push(`${prefixDir$}/${subpackagesPatten}/${COLLECT_PATTEN}`);
|
|
@@ -65,8 +65,8 @@ if (workspace) {
|
|
|
65
65
|
tests.push(`${prefixDir}/${subpackageFolderName}/__tests__/${TEST_PATTEN}`);
|
|
66
66
|
collects.push(`${prefixDir}/${subpackageFolderName}/${COLLECT_PATTEN}`);
|
|
67
67
|
} else {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const subpackages = subpackagesMap[packageFolderName];
|
|
69
|
+
const subpackagesPatten = `{${subpackages.join(',')},}`;
|
|
70
70
|
tests.push(`${prefixDir}/${subpackagesPatten}/__tests__/${TEST_PATTEN}`);
|
|
71
71
|
collects.push(`${prefixDir}/${subpackagesPatten}/${COLLECT_PATTEN}`);
|
|
72
72
|
collects.push(`${prefixDir}/index*.ts`);
|
|
@@ -86,27 +86,27 @@ const name = getPackageName('index');
|
|
|
86
86
|
export default mergeConfig(getViteConfig(), defineConfig({
|
|
87
87
|
resolve: workspace
|
|
88
88
|
? {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
alias: [
|
|
90
|
+
{
|
|
91
|
+
find: new RegExp(`^${name}$`),
|
|
92
|
+
replacement: replacement('index')
|
|
93
|
+
},
|
|
94
|
+
...Object.keys(subpackagesMap).reduce((pre, cur: string) => {
|
|
95
|
+
if (subpackagesMap[cur].length) {
|
|
96
|
+
pre.push({
|
|
97
|
+
find: new RegExp(`^${getPackageName(cur)}$`),
|
|
98
|
+
replacement: replacement(cur, true)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return pre;
|
|
102
|
+
}, [] as any),
|
|
103
|
+
{
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
find: new RegExp(`^${name}-(.*?)$`),
|
|
106
|
+
replacement: replacement('$1')
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
110
|
: {},
|
|
111
111
|
test: {
|
|
112
112
|
globals: true,
|
|
@@ -115,10 +115,13 @@ export default mergeConfig(getViteConfig(), defineConfig({
|
|
|
115
115
|
enabled: true,
|
|
116
116
|
provider: 'istanbul',
|
|
117
117
|
reporter: ['text', 'html'],
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
all: false,
|
|
119
|
+
thresholds: {
|
|
120
|
+
branches: 85,
|
|
121
|
+
statements: 95,
|
|
122
|
+
functions: 95,
|
|
123
|
+
lines: 95
|
|
124
|
+
},
|
|
122
125
|
include: collects,
|
|
123
126
|
exclude: [
|
|
124
127
|
`**/examples/**`,
|
|
@@ -127,4 +130,3 @@ export default mergeConfig(getViteConfig(), defineConfig({
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}) as UserConfig);
|
|
130
|
-
|