@rife/cli 0.0.6-beta.1 → 0.0.6-beta.3
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/pnpmfile.js +11 -2
- package/dist/sync.js +1 -0
- package/dist/sync.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -15
- package/src/cli.ts +19 -19
- package/src/index.ts +3 -3
- package/src/logger.ts +34 -34
- package/src/plugin/commander.ts +44 -44
- package/src/plugin/compiler/swc.ts +55 -55
- package/src/plugin/compiler/tsc.ts +101 -101
- package/src/plugin/release.ts +32 -32
- package/src/pnpmfile.ts +147 -121
- package/src/runner.ts +88 -88
- package/src/sync.ts +63 -62
- package/src/test/pnpmfile.test.ts +223 -223
- package/dist/compiler.js +0 -82
- package/dist/compiler.js.map +0 -1
- package/dist/plugin/package copy.js +0 -32
- package/dist/plugin/package copy.js.map +0 -1
- package/dist/plugin.js +0 -161
- package/dist/plugin.js.map +0 -1
- package/dist/swc.js +0 -78
- package/dist/swc.js.map +0 -1
- package/dist/tsc.js +0 -94
- package/dist/tsc.js.map +0 -1
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { compareObject, parseVersion, testCompareObject, testReadPackage } from '../pnpmfile';
|
|
4
|
-
|
|
5
|
-
describe('解析版本号', () => {
|
|
6
|
-
test('范围版本号', () => {
|
|
7
|
-
expect(parseVersion('^1.0.0')).toBe('001.000.000.000');
|
|
8
|
-
expect(parseVersion('1.10.0')).toBe('001.010.000.000');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('beta 版本号', () => {
|
|
12
|
-
expect(parseVersion('1.0.0-beta.1')).toBe('001.000.000.001');
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('直接依赖提升', () => {
|
|
17
|
-
test('提升 dependencies', () => {
|
|
18
|
-
const root = {
|
|
19
|
-
name: '@rife/root',
|
|
20
|
-
dependencies: {
|
|
21
|
-
'@rife/a': 'workspace:*',
|
|
22
|
-
root: '^1.0.0',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const a = {
|
|
26
|
-
name: '@rife/a',
|
|
27
|
-
dependencies: {
|
|
28
|
-
a1: '^1.0.0',
|
|
29
|
-
},
|
|
30
|
-
rife: {
|
|
31
|
-
hostDependencies: {
|
|
32
|
-
a1: true,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const z = {
|
|
37
|
-
name: '@rife/root',
|
|
38
|
-
dependencies: {
|
|
39
|
-
'@rife/a': 'workspace:*',
|
|
40
|
-
root: '^1.0.0',
|
|
41
|
-
a1: '^1.0.0',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('提升 devDependencies', () => {
|
|
48
|
-
const root = {
|
|
49
|
-
name: '@rife/root',
|
|
50
|
-
dependencies: {
|
|
51
|
-
'@rife/a': 'workspace:*',
|
|
52
|
-
root: '^1.0.0',
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
const a = {
|
|
56
|
-
name: '@rife/a',
|
|
57
|
-
devDependencies: {
|
|
58
|
-
a1: '^1.0.0',
|
|
59
|
-
},
|
|
60
|
-
rife: {
|
|
61
|
-
hostDependencies: {
|
|
62
|
-
a1: true,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
const z = {
|
|
67
|
-
name: '@rife/root',
|
|
68
|
-
dependencies: {
|
|
69
|
-
'@rife/a': 'workspace:*',
|
|
70
|
-
root: '^1.0.0',
|
|
71
|
-
},
|
|
72
|
-
devDependencies: {
|
|
73
|
-
a1: '^1.0.0',
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('同时提升 dependencies 和 devDependencies', () => {
|
|
80
|
-
const root = {
|
|
81
|
-
name: '@rife/root',
|
|
82
|
-
dependencies: {
|
|
83
|
-
'@rife/a': 'workspace:*',
|
|
84
|
-
root: '^1.0.0',
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
const a = {
|
|
88
|
-
name: '@rife/a',
|
|
89
|
-
dependencies: {
|
|
90
|
-
a1: '^1.0.0',
|
|
91
|
-
},
|
|
92
|
-
devDependencies: {
|
|
93
|
-
a2: '^1.0.0',
|
|
94
|
-
},
|
|
95
|
-
rife: {
|
|
96
|
-
hostDependencies: {
|
|
97
|
-
a1: true,
|
|
98
|
-
a2: true,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
const z = {
|
|
103
|
-
name: '@rife/root',
|
|
104
|
-
dependencies: {
|
|
105
|
-
'@rife/a': 'workspace:*',
|
|
106
|
-
root: '^1.0.0',
|
|
107
|
-
a1: '^1.0.0',
|
|
108
|
-
},
|
|
109
|
-
devDependencies: {
|
|
110
|
-
a2: '^1.0.0',
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
test('提升不能覆盖现有版本号', () => {
|
|
117
|
-
const root = {
|
|
118
|
-
name: '@rife/root',
|
|
119
|
-
dependencies: {
|
|
120
|
-
'@rife/a': 'workspace:*',
|
|
121
|
-
root: '^1.0.0',
|
|
122
|
-
a1: '^1.0.0',
|
|
123
|
-
},
|
|
124
|
-
devDependencies: {
|
|
125
|
-
a2: '^1.0.0',
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
const a = {
|
|
129
|
-
name: '@rife/a',
|
|
130
|
-
dependencies: {
|
|
131
|
-
a1: '^1.0.1',
|
|
132
|
-
},
|
|
133
|
-
devDependencies: {
|
|
134
|
-
a2: '^1.0.1',
|
|
135
|
-
},
|
|
136
|
-
rife: {
|
|
137
|
-
hostDependencies: {
|
|
138
|
-
a1: true,
|
|
139
|
-
a2: true,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
const z = {
|
|
144
|
-
name: '@rife/root',
|
|
145
|
-
dependencies: {
|
|
146
|
-
'@rife/a': 'workspace:*',
|
|
147
|
-
root: '^1.0.0',
|
|
148
|
-
a1: '^1.0.0',
|
|
149
|
-
},
|
|
150
|
-
devDependencies: {
|
|
151
|
-
a2: '^1.0.0',
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
describe('依赖同一个依赖的多个版本', () => {
|
|
159
|
-
test('总是提升最新版本', () => {
|
|
160
|
-
const root = {
|
|
161
|
-
name: '@rife/root',
|
|
162
|
-
dependencies: {
|
|
163
|
-
'@rife/a': 'workspace:*',
|
|
164
|
-
root: '^1.0.0',
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
const a = {
|
|
168
|
-
name: '@rife/a',
|
|
169
|
-
dependencies: {
|
|
170
|
-
a1: '^1.0.0',
|
|
171
|
-
},
|
|
172
|
-
rife: {
|
|
173
|
-
hostDependencies: {
|
|
174
|
-
a1: true,
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
const b = {
|
|
179
|
-
name: '@rife/b',
|
|
180
|
-
dependencies: {
|
|
181
|
-
a1: '^1.0.1',
|
|
182
|
-
b1: '^1.0.0',
|
|
183
|
-
},
|
|
184
|
-
rife: {
|
|
185
|
-
hostDependencies: {
|
|
186
|
-
a1: true,
|
|
187
|
-
b1: true,
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
const z = {
|
|
192
|
-
name: '@rife/root',
|
|
193
|
-
dependencies: {
|
|
194
|
-
'@rife/a': 'workspace:*',
|
|
195
|
-
root: '^1.0.0',
|
|
196
|
-
a1: '^1.0.1',
|
|
197
|
-
b1: '^1.0.0',
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
expect(testReadPackage([root, a, b])).toStrictEqual(z);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
describe('比较差异', () => {
|
|
205
|
-
test('相同', () => {
|
|
206
|
-
expect(testCompareObject({}, {})).toStrictEqual({ more: [], less: [] });
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('多了', () => {
|
|
210
|
-
expect(testCompareObject({ a: 1 }, {})).toStrictEqual({ more: [{ name: 'a', version: 1 }], less: [] });
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
test('少了', () => {
|
|
214
|
-
expect(testCompareObject({}, { a: 1 })).toStrictEqual({ more: [], less: [{ name: 'a', version: 1 }] });
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
test('差异', () => {
|
|
218
|
-
expect(testCompareObject({ b: 2 }, { a: 1 })).toStrictEqual({
|
|
219
|
-
more: [{ name: 'b', version: 2 }],
|
|
220
|
-
less: [{ name: 'a', version: 1 }],
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
});
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { compareObject, parseVersion, testCompareObject, testReadPackage } from '../pnpmfile';
|
|
4
|
+
|
|
5
|
+
describe('解析版本号', () => {
|
|
6
|
+
test('范围版本号', () => {
|
|
7
|
+
expect(parseVersion('^1.0.0')).toBe('001.000.000.000');
|
|
8
|
+
expect(parseVersion('1.10.0')).toBe('001.010.000.000');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('beta 版本号', () => {
|
|
12
|
+
expect(parseVersion('1.0.0-beta.1')).toBe('001.000.000.001');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('直接依赖提升', () => {
|
|
17
|
+
test('提升 dependencies', () => {
|
|
18
|
+
const root = {
|
|
19
|
+
name: '@rife/root',
|
|
20
|
+
dependencies: {
|
|
21
|
+
'@rife/a': 'workspace:*',
|
|
22
|
+
root: '^1.0.0',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const a = {
|
|
26
|
+
name: '@rife/a',
|
|
27
|
+
dependencies: {
|
|
28
|
+
a1: '^1.0.0',
|
|
29
|
+
},
|
|
30
|
+
rife: {
|
|
31
|
+
hostDependencies: {
|
|
32
|
+
a1: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const z = {
|
|
37
|
+
name: '@rife/root',
|
|
38
|
+
dependencies: {
|
|
39
|
+
'@rife/a': 'workspace:*',
|
|
40
|
+
root: '^1.0.0',
|
|
41
|
+
a1: '^1.0.0',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('提升 devDependencies', () => {
|
|
48
|
+
const root = {
|
|
49
|
+
name: '@rife/root',
|
|
50
|
+
dependencies: {
|
|
51
|
+
'@rife/a': 'workspace:*',
|
|
52
|
+
root: '^1.0.0',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const a = {
|
|
56
|
+
name: '@rife/a',
|
|
57
|
+
devDependencies: {
|
|
58
|
+
a1: '^1.0.0',
|
|
59
|
+
},
|
|
60
|
+
rife: {
|
|
61
|
+
hostDependencies: {
|
|
62
|
+
a1: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const z = {
|
|
67
|
+
name: '@rife/root',
|
|
68
|
+
dependencies: {
|
|
69
|
+
'@rife/a': 'workspace:*',
|
|
70
|
+
root: '^1.0.0',
|
|
71
|
+
},
|
|
72
|
+
devDependencies: {
|
|
73
|
+
a1: '^1.0.0',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('同时提升 dependencies 和 devDependencies', () => {
|
|
80
|
+
const root = {
|
|
81
|
+
name: '@rife/root',
|
|
82
|
+
dependencies: {
|
|
83
|
+
'@rife/a': 'workspace:*',
|
|
84
|
+
root: '^1.0.0',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
const a = {
|
|
88
|
+
name: '@rife/a',
|
|
89
|
+
dependencies: {
|
|
90
|
+
a1: '^1.0.0',
|
|
91
|
+
},
|
|
92
|
+
devDependencies: {
|
|
93
|
+
a2: '^1.0.0',
|
|
94
|
+
},
|
|
95
|
+
rife: {
|
|
96
|
+
hostDependencies: {
|
|
97
|
+
a1: true,
|
|
98
|
+
a2: true,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const z = {
|
|
103
|
+
name: '@rife/root',
|
|
104
|
+
dependencies: {
|
|
105
|
+
'@rife/a': 'workspace:*',
|
|
106
|
+
root: '^1.0.0',
|
|
107
|
+
a1: '^1.0.0',
|
|
108
|
+
},
|
|
109
|
+
devDependencies: {
|
|
110
|
+
a2: '^1.0.0',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('提升不能覆盖现有版本号', () => {
|
|
117
|
+
const root = {
|
|
118
|
+
name: '@rife/root',
|
|
119
|
+
dependencies: {
|
|
120
|
+
'@rife/a': 'workspace:*',
|
|
121
|
+
root: '^1.0.0',
|
|
122
|
+
a1: '^1.0.0',
|
|
123
|
+
},
|
|
124
|
+
devDependencies: {
|
|
125
|
+
a2: '^1.0.0',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
const a = {
|
|
129
|
+
name: '@rife/a',
|
|
130
|
+
dependencies: {
|
|
131
|
+
a1: '^1.0.1',
|
|
132
|
+
},
|
|
133
|
+
devDependencies: {
|
|
134
|
+
a2: '^1.0.1',
|
|
135
|
+
},
|
|
136
|
+
rife: {
|
|
137
|
+
hostDependencies: {
|
|
138
|
+
a1: true,
|
|
139
|
+
a2: true,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
const z = {
|
|
144
|
+
name: '@rife/root',
|
|
145
|
+
dependencies: {
|
|
146
|
+
'@rife/a': 'workspace:*',
|
|
147
|
+
root: '^1.0.0',
|
|
148
|
+
a1: '^1.0.0',
|
|
149
|
+
},
|
|
150
|
+
devDependencies: {
|
|
151
|
+
a2: '^1.0.0',
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
expect(testReadPackage([root, a])).toStrictEqual(z);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe('依赖同一个依赖的多个版本', () => {
|
|
159
|
+
test('总是提升最新版本', () => {
|
|
160
|
+
const root = {
|
|
161
|
+
name: '@rife/root',
|
|
162
|
+
dependencies: {
|
|
163
|
+
'@rife/a': 'workspace:*',
|
|
164
|
+
root: '^1.0.0',
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
const a = {
|
|
168
|
+
name: '@rife/a',
|
|
169
|
+
dependencies: {
|
|
170
|
+
a1: '^1.0.0',
|
|
171
|
+
},
|
|
172
|
+
rife: {
|
|
173
|
+
hostDependencies: {
|
|
174
|
+
a1: true,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
const b = {
|
|
179
|
+
name: '@rife/b',
|
|
180
|
+
dependencies: {
|
|
181
|
+
a1: '^1.0.1',
|
|
182
|
+
b1: '^1.0.0',
|
|
183
|
+
},
|
|
184
|
+
rife: {
|
|
185
|
+
hostDependencies: {
|
|
186
|
+
a1: true,
|
|
187
|
+
b1: true,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
const z = {
|
|
192
|
+
name: '@rife/root',
|
|
193
|
+
dependencies: {
|
|
194
|
+
'@rife/a': 'workspace:*',
|
|
195
|
+
root: '^1.0.0',
|
|
196
|
+
a1: '^1.0.1',
|
|
197
|
+
b1: '^1.0.0',
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
expect(testReadPackage([root, a, b])).toStrictEqual(z);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
describe('比较差异', () => {
|
|
205
|
+
test('相同', () => {
|
|
206
|
+
expect(testCompareObject({}, {})).toStrictEqual({ more: [], less: [] });
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test('多了', () => {
|
|
210
|
+
expect(testCompareObject({ a: 1 }, {})).toStrictEqual({ more: [{ name: 'a', version: 1 }], less: [] });
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('少了', () => {
|
|
214
|
+
expect(testCompareObject({}, { a: 1 })).toStrictEqual({ more: [], less: [{ name: 'a', version: 1 }] });
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('差异', () => {
|
|
218
|
+
expect(testCompareObject({ b: 2 }, { a: 1 })).toStrictEqual({
|
|
219
|
+
more: [{ name: 'b', version: 2 }],
|
|
220
|
+
less: [{ name: 'a', version: 1 }],
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
});
|
package/dist/compiler.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compileTs = compileTs;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
const utils_1 = require("consola/utils");
|
|
7
|
-
const swc_1 = require("./swc");
|
|
8
|
-
const tsc_1 = require("./tsc");
|
|
9
|
-
const clear = () => {
|
|
10
|
-
console.clear();
|
|
11
|
-
process.stdout.write('\x1b[3J');
|
|
12
|
-
};
|
|
13
|
-
async function compileTs(runner, tsxConfig, { watch } = { watch: false }) {
|
|
14
|
-
const { logger, fs } = runner;
|
|
15
|
-
const log = logger.withTag(compileTs.name);
|
|
16
|
-
log.debug('tsxConfig %j', tsxConfig);
|
|
17
|
-
if (tsxConfig.clean) {
|
|
18
|
-
log.info('清空目录 %s', tsxConfig.outDir);
|
|
19
|
-
await fs.emptyDir(tsxConfig.outDir);
|
|
20
|
-
}
|
|
21
|
-
if (tsxConfig.type === 'tsc') {
|
|
22
|
-
(0, tsc_1.tsc)(tsxConfig);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (tsxConfig.type === 'swc') {
|
|
26
|
-
const formatDiagnostic = (diagnostics) => {
|
|
27
|
-
const ts = require('typescript');
|
|
28
|
-
return diagnostics
|
|
29
|
-
.map(diagnostic => {
|
|
30
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
|
31
|
-
if (diagnostic.file) {
|
|
32
|
-
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
33
|
-
return `${utils_1.colors.blue(diagnostic.file.fileName)} ${utils_1.colors.yellow(`(${line + 1},${character + 1})`)}: ${utils_1.colors.white(message)}`;
|
|
34
|
-
}
|
|
35
|
-
return message;
|
|
36
|
-
})
|
|
37
|
-
.join('\n');
|
|
38
|
-
};
|
|
39
|
-
(0, swc_1.swc)({
|
|
40
|
-
...tsxConfig,
|
|
41
|
-
watch,
|
|
42
|
-
onComplieSuccess: ({ watch, first, duration }) => {
|
|
43
|
-
if (watch && !first) {
|
|
44
|
-
// watch 模式下,第二次编译清空一下屏幕
|
|
45
|
-
clear();
|
|
46
|
-
console.log(`${utils_1.colors.bgBlue(' 项目名称 ')} ${runner.package.name} \n`);
|
|
47
|
-
}
|
|
48
|
-
log.success(`编译成功,耗时 ${duration.toFixed(2)} ms`);
|
|
49
|
-
runner.compiler.hook.tsxSuccess.promise();
|
|
50
|
-
},
|
|
51
|
-
onComplieFail: ({ watch, first, duration, reasons }) => {
|
|
52
|
-
if (watch && !first) {
|
|
53
|
-
// watch 模式下,第二次编译清空一下屏幕
|
|
54
|
-
clear();
|
|
55
|
-
console.log(`${utils_1.colors.bgBlue(' 项目名称 ')} ${runner.package.name} \n`);
|
|
56
|
-
}
|
|
57
|
-
const message = [...reasons.entries()]
|
|
58
|
-
.map(([key, value]) => {
|
|
59
|
-
const index = value.indexOf(key);
|
|
60
|
-
if (index > -1) {
|
|
61
|
-
return value.replace(key, path_1.default.resolve(key));
|
|
62
|
-
}
|
|
63
|
-
return `${value}`;
|
|
64
|
-
})
|
|
65
|
-
.join('\n');
|
|
66
|
-
log.error(`编译失败,耗时 ${duration.toFixed(2)} ms\n\n%s`, message);
|
|
67
|
-
},
|
|
68
|
-
onTypeCheckFinish: ({ diagnostics, duration }) => {
|
|
69
|
-
if (diagnostics.length) {
|
|
70
|
-
log.error(`类型检查失败,耗时 ${duration.toFixed(2)} ms\n\n%s`, formatDiagnostic(diagnostics));
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
log.success(`类型检查成功,耗时 ${duration.toFixed(2)} ms`);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
log.error(`compiler type '${tsxConfig.type}' 不存在`);
|
|
80
|
-
process.exit(1);
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=compiler.js.map
|
package/dist/compiler.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":";;AAgCA,8BAoEC;;AApGD,wDAAwB;AAExB,yCAAuC;AAKvC,+BAA4B;AAC5B,+BAA4B;AAmB5B,MAAM,KAAK,GAAG,GAAG,EAAE;IACf,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC,CAAC;AAEK,KAAK,UAAU,SAAS,CAAC,MAAc,EAAE,SAAoB,EAAE,EAAE,KAAK,KAAyB,EAAE,KA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,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;oBACjD,CAAC;oBACD,OAAO,GAAG,KAAK,EAAE,CAAC;gBACtB,CAAC,CAAC;qBACD,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChB,GAAG,CAAC,KAAK,CAAC,WAAW,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAClE,CAAC;YACD,iBAAiB,EAAE,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;gBAC7C,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;oBACrB,GAAG,CAAC,KAAK,CAAC,aAAa,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC1F,CAAC;qBAAM,CAAC;oBACJ,GAAG,CAAC,OAAO,CAAC,aAAa,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACvD,CAAC;YACL,CAAC;SACJ,CAAC,CAAC;QACH,OAAO;IACX,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,kBAAkB,SAAS,CAAC,IAAI,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pluginPackage = pluginPackage;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
function pluginPackage() {
|
|
7
|
-
const plugin = {
|
|
8
|
-
name: pluginPackage.name,
|
|
9
|
-
apply: runner => {
|
|
10
|
-
const { logger, hook, fs } = runner;
|
|
11
|
-
const log = logger.withTag(pluginPackage.name);
|
|
12
|
-
hook.loadPackage.tapPromise(pluginPackage.name, async () => {
|
|
13
|
-
const fileName = 'package.json';
|
|
14
|
-
const filePath = path_1.default.resolve(fileName);
|
|
15
|
-
if (!fs.existsSync(filePath)) {
|
|
16
|
-
log.error(`找不到文件 ${fileName}`);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const data = require(filePath);
|
|
21
|
-
runner.package = data;
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
log.error(`读取文件失败`, e.message);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
return plugin;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=package%20copy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package copy.js","sourceRoot":"","sources":["../../src/plugin/package copy.ts"],"names":[],"mappings":";;AAOA,sCAwBC;;AA9BD,wDAAwB;AAMxB,SAAgB,aAAa;IACzB,MAAM,MAAM,GAAW;QACnB,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,KAAK,EAAE,MAAM,CAAC,EAAE;YACZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;YACpC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;gBACvD,MAAM,QAAQ,GAAG,cAAc,CAAC;gBAChC,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC3B,GAAG,CAAC,KAAK,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC;oBAC/B,OAAO,CA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