@mpxjs/cli 3.3.4 → 3.4.1
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/__tests__/preset.spec.js +74 -0
- package/lib/create.js +1 -0
- package/lib/prompts.js +28 -0
- package/package.json +2 -1
package/__tests__/preset.spec.js
CHANGED
|
@@ -228,3 +228,77 @@ test('test-e2e', async () => {
|
|
|
228
228
|
const pkg = require(path.resolve(cwd, name, 'package.json'))
|
|
229
229
|
expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-e2e-test')
|
|
230
230
|
})
|
|
231
|
+
|
|
232
|
+
test('test-unocss', async () => {
|
|
233
|
+
const cwd = path.resolve(__dirname, '../../test')
|
|
234
|
+
const name = 'test-unocss'
|
|
235
|
+
await create(
|
|
236
|
+
name,
|
|
237
|
+
{
|
|
238
|
+
force: true,
|
|
239
|
+
git: false,
|
|
240
|
+
cwd
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
srcMode: 'wx',
|
|
244
|
+
appid: 'test',
|
|
245
|
+
description: 'test',
|
|
246
|
+
cross: true,
|
|
247
|
+
needUtilityFirstCSS: true,
|
|
248
|
+
plugins: {},
|
|
249
|
+
useConfigFiles: true
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
const pkg = require(path.resolve(cwd, name, 'package.json'))
|
|
254
|
+
expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-utility-first-css')
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
test('test-typescript', async () => {
|
|
258
|
+
const cwd = path.resolve(__dirname, '../../test')
|
|
259
|
+
const name = 'test-typescript'
|
|
260
|
+
await create(
|
|
261
|
+
name,
|
|
262
|
+
{
|
|
263
|
+
force: true,
|
|
264
|
+
git: false,
|
|
265
|
+
cwd
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
srcMode: 'wx',
|
|
269
|
+
appid: 'test',
|
|
270
|
+
description: 'test',
|
|
271
|
+
cross: true,
|
|
272
|
+
needTs: true,
|
|
273
|
+
plugins: {},
|
|
274
|
+
useConfigFiles: true
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
const pkg = require(path.resolve(cwd, name, 'package.json'))
|
|
279
|
+
expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-typescript')
|
|
280
|
+
})
|
|
281
|
+
test('test-ssr', async () => {
|
|
282
|
+
const cwd = path.resolve(__dirname, '../../test')
|
|
283
|
+
const name = 'test-ssr'
|
|
284
|
+
await create(
|
|
285
|
+
name,
|
|
286
|
+
{
|
|
287
|
+
force: true,
|
|
288
|
+
git: false,
|
|
289
|
+
cwd
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
srcMode: 'wx',
|
|
293
|
+
appid: 'test',
|
|
294
|
+
description: 'test',
|
|
295
|
+
cross: true,
|
|
296
|
+
needSSR: true,
|
|
297
|
+
plugins: {},
|
|
298
|
+
useConfigFiles: true
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
const pkg = require(path.resolve(cwd, name, 'package.json'))
|
|
303
|
+
expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-ssr')
|
|
304
|
+
})
|
package/lib/create.js
CHANGED
package/lib/prompts.js
CHANGED
|
@@ -16,6 +16,20 @@ module.exports = [
|
|
|
16
16
|
type: 'confirm',
|
|
17
17
|
default: true
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
name: 'needSSR',
|
|
21
|
+
when: ({ srcMode }) => srcMode === 'wx',
|
|
22
|
+
message: '是否需要 web ssr',
|
|
23
|
+
type: 'confirm',
|
|
24
|
+
default: false,
|
|
25
|
+
preset: {
|
|
26
|
+
plugins: {
|
|
27
|
+
[`${prefix}-ssr`]: {
|
|
28
|
+
version: '^2.0.0'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
19
33
|
{
|
|
20
34
|
name: 'cloudFunc',
|
|
21
35
|
when: ({ srcMode, cross }) => srcMode === 'wx' && cross === false,
|
|
@@ -58,6 +72,20 @@ module.exports = [
|
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
74
|
},
|
|
75
|
+
|
|
76
|
+
{
|
|
77
|
+
name: 'needUtilityFirstCSS',
|
|
78
|
+
type: 'confirm',
|
|
79
|
+
message: '是否需要使用原子类',
|
|
80
|
+
default: false,
|
|
81
|
+
preset: {
|
|
82
|
+
plugins: {
|
|
83
|
+
[`${prefix}-utility-first-css`]: {
|
|
84
|
+
version: '^2.0.0'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
61
89
|
{
|
|
62
90
|
name: 'needUnitTest',
|
|
63
91
|
message: '是否需要单元测试',
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@types/inquirer": "^8.1.3",
|
|
8
8
|
"@vue/cli": "^5.0.0",
|
|
9
|
+
"@vue/cli-shared-utils": "^5.0.4",
|
|
9
10
|
"commander": "^7.1.0",
|
|
10
11
|
"fs-extra": "^9.1.0",
|
|
11
12
|
"inquirer": "^8.0.0",
|
|
@@ -29,5 +30,5 @@
|
|
|
29
30
|
"access": "public",
|
|
30
31
|
"registry": "https://registry.npmjs.org"
|
|
31
32
|
},
|
|
32
|
-
"version": "3.
|
|
33
|
+
"version": "3.4.1"
|
|
33
34
|
}
|