@mpxjs/cli 3.2.0 → 3.3.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/.release-it.js ADDED
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ git: {
3
+ commitMessage: 'chore: release v${version}'
4
+ },
5
+ github: {
6
+ release: true
7
+ },
8
+ npm: {
9
+ skipChecks: true
10
+ },
11
+ plugins: {},
12
+ hooks: {}
13
+ }
package/README.md CHANGED
@@ -1,13 +1,11 @@
1
- ## mpx-cli@next
1
+ ## mpx-cli
2
2
 
3
3
  A cli tool that based on [@vue/cli](https://cli.vuejs.org/) for creating mpx project.
4
4
 
5
- ## Stage: alpha
6
-
7
5
  ## Install
8
6
 
9
7
  ```javascript
10
- npm i @mpxjs/cli@next -g
8
+ npm i @mpxjs/cli -g
11
9
  ```
12
10
 
13
11
  ## Usage
@@ -0,0 +1,206 @@
1
+ jest.mock('inquirer')
2
+
3
+ const path = require('path')
4
+ const fs = require('fs')
5
+ const create = require('@mpxjs/cli/lib/create')
6
+
7
+ test('normal', async () => {
8
+ const cwd = path.resolve(__dirname, '../../test')
9
+ const name = 'test-normal'
10
+ await create(
11
+ name,
12
+ {
13
+ force: true,
14
+ git: false,
15
+ cwd
16
+ },
17
+ {
18
+ srcMode: 'wx',
19
+ appid: 'test',
20
+ description: 'test',
21
+ cross: true,
22
+ plugins: {},
23
+ useConfigFiles: true
24
+ }
25
+ )
26
+
27
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
28
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx')
29
+ })
30
+
31
+ /**
32
+ * 非跨平台项目不生成static/ali目录
33
+ */
34
+ test('normal-nocross', async () => {
35
+ const cwd = path.resolve(__dirname, '../../test')
36
+ const name = 'normal-nocross'
37
+ await create(
38
+ name,
39
+ {
40
+ force: true,
41
+ git: false,
42
+ cwd
43
+ },
44
+ {
45
+ srcMode: 'wx',
46
+ appid: 'test',
47
+ description: 'test',
48
+ cross: false,
49
+ plugins: {},
50
+ useConfigFiles: true
51
+ }
52
+ )
53
+
54
+ const staticAliDir = fs.existsSync(path.resolve(cwd, name, 'static/ali'))
55
+ expect(staticAliDir).toBe(false)
56
+ })
57
+
58
+ test('test-ts', async () => {
59
+ const cwd = path.resolve(__dirname, '../../test')
60
+ const name = 'test-ts'
61
+ await create(
62
+ name,
63
+ {
64
+ force: true,
65
+ git: false,
66
+ cwd
67
+ },
68
+ {
69
+ srcMode: 'wx',
70
+ appid: 'test',
71
+ description: 'test',
72
+ cross: true,
73
+ needTs: true,
74
+ plugins: {},
75
+ useConfigFiles: true
76
+ }
77
+ )
78
+
79
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
80
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-typescript')
81
+ })
82
+
83
+ test('test-cloud-func', async () => {
84
+ const cwd = path.resolve(__dirname, '../../test')
85
+ const name = 'test-cloud-func'
86
+ await create(
87
+ name,
88
+ {
89
+ force: true,
90
+ git: false,
91
+ cwd
92
+ },
93
+ {
94
+ srcMode: 'wx',
95
+ appid: 'test',
96
+ description: 'test',
97
+ cross: true,
98
+ cloudFunc: true,
99
+ plugins: {},
100
+ useConfigFiles: true
101
+ }
102
+ )
103
+
104
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
105
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-cloud-func')
106
+ })
107
+
108
+ test('test-cloud-func', async () => {
109
+ const cwd = path.resolve(__dirname, '../../test')
110
+ const name = 'test-cloud-func'
111
+ await create(
112
+ name,
113
+ {
114
+ force: true,
115
+ git: false,
116
+ cwd
117
+ },
118
+ {
119
+ srcMode: 'wx',
120
+ appid: 'test',
121
+ description: 'test',
122
+ cross: true,
123
+ cloudFunc: true,
124
+ plugins: {},
125
+ useConfigFiles: true
126
+ }
127
+ )
128
+
129
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
130
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-cloud-func')
131
+ })
132
+
133
+ test('test-plugin', async () => {
134
+ const cwd = path.resolve(__dirname, '../../test')
135
+ const name = 'test-plugin'
136
+ await create(
137
+ name,
138
+ {
139
+ force: true,
140
+ git: false,
141
+ cwd
142
+ },
143
+ {
144
+ srcMode: 'wx',
145
+ appid: 'test',
146
+ description: 'test',
147
+ cross: true,
148
+ isPlugin: true,
149
+ plugins: {},
150
+ useConfigFiles: true
151
+ }
152
+ )
153
+
154
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
155
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-plugin-mode')
156
+ })
157
+
158
+ test('test-unit', async () => {
159
+ const cwd = path.resolve(__dirname, '../../test')
160
+ const name = 'test-unit'
161
+ await create(
162
+ name,
163
+ {
164
+ force: true,
165
+ git: false,
166
+ cwd
167
+ },
168
+ {
169
+ srcMode: 'wx',
170
+ appid: 'test',
171
+ description: 'test',
172
+ cross: true,
173
+ needUnitTest: true,
174
+ plugins: {},
175
+ useConfigFiles: true
176
+ }
177
+ )
178
+
179
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
180
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-unit-test')
181
+ })
182
+
183
+ test('test-e2e', async () => {
184
+ const cwd = path.resolve(__dirname, '../../test')
185
+ const name = 'test-e2e'
186
+ await create(
187
+ name,
188
+ {
189
+ force: true,
190
+ git: false,
191
+ cwd
192
+ },
193
+ {
194
+ srcMode: 'wx',
195
+ appid: 'test',
196
+ description: 'test',
197
+ cross: true,
198
+ needE2ETest: true,
199
+ plugins: {},
200
+ useConfigFiles: true
201
+ }
202
+ )
203
+
204
+ const pkg = require(path.resolve(cwd, name, 'package.json'))
205
+ expect(pkg.devDependencies).toHaveProperty('@mpxjs/vue-cli-plugin-mpx-e2e-test')
206
+ })
package/bin/mpx.js CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  const program = require('commander')
3
+ const minimist = require('minimist')
3
4
  const { doVueCli } = require('../utils')
5
+ const { chalk } = require('@vue/cli-shared-utils')
4
6
 
5
7
  program
6
8
  .version(`@mpx/cli ${require('../package').version}`)
@@ -35,9 +37,15 @@ program.command('create <app-name>')
35
37
  .option('-c, --clone', 'Use git clone when fetching remote preset')
36
38
  .option('-x, --proxy <proxyUrl>', 'Use specified proxy when creating project')
37
39
  .option('-b, --bare', 'Scaffold project without beginner instructions')
38
- .option('--skipGetStarted', 'Skip displaying "Get started" instructions')
39
- .action(async () => {
40
- require('../lib/create')()
40
+ .action(async (appName, options) => {
41
+ if (minimist(process.argv.slice(3))._.length > 1) {
42
+ console.log(chalk.yellow('\n Info: You provided more than one argument. The first one will be used as the app\'s name, the rest are ignored.'))
43
+ }
44
+ // --git makes commander to default git to true
45
+ if (process.argv.includes('-g') || process.argv.includes('--git')) {
46
+ options.forceGit = true
47
+ }
48
+ return require('../lib/create')(appName, options)
41
49
  })
42
50
 
43
51
  program
@@ -59,26 +67,14 @@ program
59
67
  })
60
68
 
61
69
  program
62
- .command('inspect:mp [paths...]')
70
+ .command('inspect [paths...]')
63
71
  .description('inspect the webpack config in a project with mpx-cli-service')
64
72
  .option('--mode <mode>')
65
73
  .option('--targets <targets>')
74
+ .option('--env <env>', 'custom define __mpx_env__')
66
75
  .option('-v --verbose', 'Show full function definitions in output')
67
76
  .action((paths, options) => {
68
- require('../lib/inspect')(paths, options, 'mp')
69
- })
70
-
71
- program
72
- .command('inspect:web [paths...]')
73
- .description('inspect the webpack config in a project with mpx-cli-service')
74
- .option('--mode <mode>')
75
- .option('--rule <ruleName>', 'inspect a specific module rule')
76
- .option('--plugin <pluginName>', 'inspect a specific plugin')
77
- .option('--rules', 'list all module rule names')
78
- .option('--plugins', 'list all plugin names')
79
- .option('-v --verbose', 'Show full function definitions in output')
80
- .action((paths, options) => {
81
- require('../lib/inspect')(paths, options, 'web')
77
+ require('../lib/inspect')(paths, options)
82
78
  })
83
79
 
84
80
  program
package/env/index.js ADDED
@@ -0,0 +1,7 @@
1
+ // const path = require('path')
2
+ // const os = require('os')
3
+
4
+ module.exports.resetEnv = function () {
5
+ // process.env.VUE_CLI_CONFIG_PATH = path.join(os.homedir(), '.mpxrc')
6
+ // process.env.VUE_CLI_SERVICE_CONFIG_PATH = './mpx.config.js'
7
+ }
package/lib/create.js CHANGED
@@ -1,19 +1,26 @@
1
- const minimist = require('minimist')
2
1
  const path = require('path')
3
2
  const inquirer = require('inquirer')
4
- const merge = require('lodash.merge')
5
- const { chalk, exit, error, log } = require('@vue/cli-shared-utils')
3
+ const fs = require('fs-extra')
4
+ const validateProjectName = require('validate-npm-package-name')
5
+ const {
6
+ chalk,
7
+ exit,
8
+ error,
9
+ log,
10
+ stopSpinner
11
+ } = require('@vue/cli-shared-utils')
12
+ const Creator = require('@vue/cli/lib/Creator')
6
13
  const loadRemotePreset = require('@vue/cli/lib/util/loadRemotePreset')
7
14
  const loadLocalPreset = require('@vue/cli/lib/util/loadLocalPreset')
8
-
15
+ const { getPromptModules } = require('@vue/cli/lib/util/createTools')
16
+ const { clearConsole } = require('@vue/cli/lib/util/clearConsole')
17
+ const { linkBin } = require('@vue/cli/lib/util/linkBin')
18
+ const merge = require('lodash.merge')
9
19
  const prompts = require('./prompts')
10
- const plugins = require('./plugins')
11
20
  const builtInPreset = require('./preset')
12
21
 
13
- const { regenCmd, doVueCli } = require('../utils')
14
-
15
22
  async function resolvePreset (args = {}) {
16
- const { p, preset, i, inlinePreset, c, clone } = args
23
+ const { p, preset, c, clone } = args
17
24
  let res = {}
18
25
  let cliPreset = {}
19
26
  if (p || preset) {
@@ -34,58 +41,161 @@ async function resolvePreset (args = {}) {
34
41
  throw e
35
42
  }
36
43
  }
37
- } else if (i || inlinePreset) {
38
- // mpx create foo --inlinePreset {...}
39
- cliPreset = i || inlinePreset
40
- try {
41
- res = JSON.parse(cliPreset)
42
- } catch (e) {
43
- error(`CLI inline preset is not valid JSON: ${cliPreset}`)
44
- exit(1)
45
- }
46
44
  }
47
45
  return res
48
46
  }
49
47
 
50
- async function resolvePrompts (name, builtInPreset) {
51
- return new Promise(function (resolve) {
52
- inquirer.prompt(prompts).then((answers) => {
53
- if (answers.needTs) {
54
- Object.assign(builtInPreset.plugins, plugins.tsSupport)
55
- }
56
- if (answers.cloudFunc) {
57
- Object.assign(builtInPreset.plugins, plugins.cloudFunc)
58
- }
59
- if (answers.isPlugin) {
60
- Object.assign(builtInPreset.plugins, plugins.isPlugin)
61
- }
62
- if (answers.transWeb) {
63
- Object.assign(builtInPreset.plugins, plugins.transWeb)
48
+ async function resolvePrompts () {
49
+ return inquirer.prompt(prompts).then((answers) => answers)
50
+ }
51
+
52
+ /**
53
+ * 从vue-cli clone 下来,方便处理creator的创建以及生命周期管理
54
+ * @param {*} projectName
55
+ * @param {*} options
56
+ * @param {*} preset
57
+ * @returns
58
+ */
59
+ async function create (projectName, options, preset = null) {
60
+ // resolve preset
61
+ if (!preset) {
62
+ if (options.preset) {
63
+ preset = await resolvePreset(options)
64
+ } else if (options.inlinePreset) {
65
+ try {
66
+ preset = JSON.parse(options.inlinePreset)
67
+ } catch (error) {
68
+ error(`CLI inline preset is not valid JSON: ${options.inlinePreset}`)
69
+ exit(1)
64
70
  }
65
- // TODO: 添加其他 prompt 插件配置
71
+ } else {
72
+ preset = await resolvePrompts()
73
+ }
74
+ }
75
+ // css preprocessor
76
+ preset.cssPreprocessor = 'stylus'
77
+
78
+ // mpx cli 插件
79
+ preset.plugins = Object.assign(
80
+ {},
81
+ preset.plugins,
82
+ builtInPreset.plugins
83
+ )
66
84
 
67
- // 各插件共享 answers 配置
68
- Object.keys(builtInPreset.plugins).forEach(function (key) {
69
- const plugin = builtInPreset.plugins[key]
70
- Object.assign(plugin, {
71
- ...answers,
72
- name
73
- })
85
+ // 合并问答中的preset
86
+ prompts.forEach(v => {
87
+ if (preset[v.name]) {
88
+ merge(preset, v.preset)
89
+ }
90
+ })
91
+
92
+ // 设置代理
93
+ if (options.proxy) {
94
+ process.env.HTTP_PROXY = options.proxy
95
+ }
96
+
97
+ const cwd = options.cwd || process.cwd()
98
+ const inCurrent = projectName === '.'
99
+ const name = inCurrent ? path.relative('../', cwd) : projectName
100
+ const targetDir = path.resolve(cwd, projectName || '.')
101
+
102
+ const result = validateProjectName(name)
103
+ if (!result.validForNewPackages) {
104
+ console.error(chalk.red(`Invalid project name: "${name}"`))
105
+ result.errors &&
106
+ result.errors.forEach((err) => {
107
+ console.error(chalk.red.dim('Error: ' + err))
108
+ })
109
+ result.warnings &&
110
+ result.warnings.forEach((warn) => {
111
+ console.error(chalk.red.dim('Warning: ' + warn))
74
112
  })
113
+ exit(1)
114
+ }
75
115
 
76
- resolve(builtInPreset)
116
+ if (fs.existsSync(targetDir) && !options.merge) {
117
+ if (options.force) {
118
+ await fs.remove(targetDir)
119
+ } else {
120
+ await clearConsole()
121
+ if (inCurrent) {
122
+ const { ok } = await inquirer.prompt([
123
+ {
124
+ name: 'ok',
125
+ type: 'confirm',
126
+ message: 'Generate project in current directory?'
127
+ }
128
+ ])
129
+ if (!ok) {
130
+ return
131
+ }
132
+ } else {
133
+ const { action } = await inquirer.prompt([
134
+ {
135
+ name: 'action',
136
+ type: 'list',
137
+ message: `Target directory ${chalk.cyan(
138
+ targetDir
139
+ )} already exists. Pick an action:`,
140
+ choices: [
141
+ { name: 'Overwrite', value: 'overwrite' },
142
+ { name: 'Merge', value: 'merge' },
143
+ { name: 'Cancel', value: false }
144
+ ]
145
+ }
146
+ ])
147
+ if (!action) {
148
+ return
149
+ } else if (action === 'overwrite') {
150
+ console.log(`\nRemoving ${chalk.cyan(targetDir)}...`)
151
+ await fs.remove(targetDir)
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ Object.keys(preset.plugins).forEach(function (key) {
158
+ const plugin = preset.plugins[key]
159
+ Object.assign(plugin, {
160
+ srcMode: preset.srcMode,
161
+ appid: preset.appid,
162
+ description: preset.description,
163
+ needE2ETest: preset.needE2ETest,
164
+ needUnitTest: preset.needUnitTest,
165
+ needTs: preset.needTs,
166
+ isPlugin: preset.isPlugin,
167
+ cloudFunc: preset.cloudFunc,
168
+ cross: preset.cross,
169
+ name
77
170
  })
78
171
  })
172
+
173
+ const creator = new Creator(name, targetDir, getPromptModules())
174
+
175
+ if (process.env.VUE_CLI_TEST || process.env.VUE_CLI_DEBUG) {
176
+ // 单测下,link bin文件到源码
177
+ creator.on('creation', ({ event }) => {
178
+ if (event === 'plugins-install') {
179
+ linkBin(
180
+ require.resolve('@mpxjs/mpx-cli-service/bin/mpx-cli-service'),
181
+ path.join(targetDir, 'node_modules', '.bin', 'mpx-cli-service')
182
+ )
183
+ }
184
+ })
185
+ }
186
+
187
+ await creator.create({
188
+ ...options,
189
+ inlinePreset: JSON.stringify(preset)
190
+ })
79
191
  }
80
192
 
81
- module.exports = async function () {
82
- const args = process.argv.slice(2)
83
- const parsedArgs = minimist(args)
84
- const name = args[1]
85
- const cmd = regenCmd(parsedArgs)
86
- const mpxBuiltInPreset = await resolvePrompts(name, builtInPreset)
87
- const cliPreset = await resolvePreset(parsedArgs)
88
- const mergedPreset = merge(mpxBuiltInPreset, cliPreset)
89
- cmd.push('-i', JSON.stringify(mergedPreset))
90
- doVueCli(cmd)
193
+ module.exports = function (...args) {
194
+ return create(...args).catch((err) => {
195
+ stopSpinner(false) // do not persist
196
+ error(err)
197
+ if (!process.env.VUE_CLI_TEST) {
198
+ process.exit(1)
199
+ }
200
+ })
91
201
  }
package/lib/info.js CHANGED
@@ -1,4 +1,4 @@
1
- const chalk = require('chalk')
1
+ const { chalk } = require('@vue/cli-shared-utils')
2
2
 
3
3
  module.exports = function () {
4
4
  console.log(chalk.bold('\nEnvironment Info:'))
package/lib/inspect.js CHANGED
@@ -3,7 +3,7 @@ const path = require('path')
3
3
  const resolve = require('resolve')
4
4
  const { execa } = require('@vue/cli-shared-utils')
5
5
 
6
- module.exports = function inspect (paths, args, mode) {
6
+ module.exports = function inspect (paths, args) {
7
7
  const cwd = process.cwd()
8
8
  let servicePath
9
9
  try {
@@ -21,9 +21,10 @@ module.exports = function inspect (paths, args, mode) {
21
21
  if (fs.existsSync(binPath)) {
22
22
  execa('node', [
23
23
  binPath,
24
- `inspect:${mode}`,
24
+ 'inspect',
25
25
  ...(args.mode ? ['--mode', args.mode] : []),
26
26
  ...(args.targets ? ['--targets', args.targets] : []),
27
+ ...(args.env ? ['--env', args.env] : []),
27
28
  ...(args.rule ? ['--rule', args.rule] : []),
28
29
  ...(args.plugin ? ['--plugin', args.plugin] : []),
29
30
  ...(args.rules ? ['--rules'] : []),
package/lib/preset.js CHANGED
@@ -1,17 +1,17 @@
1
+ /**
2
+ * 默认preset
3
+ */
1
4
  module.exports = {
2
5
  cssPreprocessor: 'stylus',
3
6
  plugins: {
4
7
  '@mpxjs/mpx-cli-service': {
5
- version: '^1.0.0'
8
+ version: '^2.0.0'
6
9
  },
7
10
  '@mpxjs/vue-cli-plugin-mpx': {
8
- version: '^1.0.0'
9
- },
10
- '@mpxjs/vue-cli-plugin-mpx-mp': {
11
- version: '^1.0.0'
11
+ version: '^2.0.0'
12
12
  },
13
13
  '@mpxjs/vue-cli-plugin-mpx-eslint': {
14
- version: '^1.0.0'
14
+ version: '^2.0.0'
15
15
  }
16
16
  }
17
17
  }
package/lib/prompts.js CHANGED
@@ -1,10 +1,12 @@
1
+ const prefix = '@mpxjs/vue-cli-plugin-mpx'
2
+
1
3
  module.exports = [
2
4
  {
3
5
  name: 'srcMode',
4
6
  type: 'list',
5
7
  required: true,
6
8
  message: '请选择小程序项目所属平台(目前仅微信下支持跨平台输出)',
7
- choices: ['wx', 'ali', 'swan', 'qq', 'tt'],
9
+ choices: ['wx', 'ali', 'swan', 'qq', 'tt', 'dd'],
8
10
  default: 'wx'
9
11
  },
10
12
  {
@@ -14,19 +16,19 @@ module.exports = [
14
16
  type: 'confirm',
15
17
  default: true
16
18
  },
17
- {
18
- name: 'transWeb',
19
- when: ({ srcMode, cross }) => srcMode === 'wx' && cross === true,
20
- message: '是否需要支持输出web',
21
- type: 'confirm',
22
- default: false
23
- },
24
19
  {
25
20
  name: 'cloudFunc',
26
21
  when: ({ srcMode, cross }) => srcMode === 'wx' && cross === false,
27
22
  message: '是否需要使用小程序云开发能力',
28
23
  type: 'confirm',
29
- default: false
24
+ default: false,
25
+ preset: {
26
+ plugins: {
27
+ [`${prefix}-cloud-func`]: {
28
+ version: '^2.0.0'
29
+ }
30
+ }
31
+ }
30
32
  },
31
33
  {
32
34
  name: 'isPlugin',
@@ -34,13 +36,53 @@ module.exports = [
34
36
  type: 'confirm',
35
37
  message:
36
38
  '是否是个插件项目?(不清楚请选 No !什么是插件项目请看微信官方文档!)',
37
- default: false
39
+ default: false,
40
+ preset: {
41
+ plugins: {
42
+ [`${prefix}-plugin-mode`]: {
43
+ version: '^2.0.0'
44
+ }
45
+ }
46
+ }
38
47
  },
39
48
  {
40
49
  name: 'needTs',
41
50
  type: 'confirm',
42
51
  message: '是否需要typescript',
43
- default: false
52
+ default: false,
53
+ preset: {
54
+ plugins: {
55
+ [`${prefix}-typescript`]: {
56
+ version: '^2.0.0'
57
+ }
58
+ }
59
+ }
60
+ },
61
+ {
62
+ name: 'needUnitTest',
63
+ message: '是否需要单元测试',
64
+ type: 'confirm',
65
+ default: false,
66
+ preset: {
67
+ plugins: {
68
+ [`${prefix}-unit-test`]: {
69
+ version: '^2.0.0'
70
+ }
71
+ }
72
+ }
73
+ },
74
+ {
75
+ name: 'needE2ETest',
76
+ message: '是否需要自动化测试',
77
+ type: 'confirm',
78
+ default: false,
79
+ preset: {
80
+ plugins: {
81
+ [`${prefix}-e2e-test`]: {
82
+ version: '^2.0.0'
83
+ }
84
+ }
85
+ }
44
86
  },
45
87
  {
46
88
  name: 'description',
package/package.json CHANGED
@@ -1,24 +1,33 @@
1
1
  {
2
- "name": "@mpxjs/cli",
3
- "version": "3.2.0",
4
- "description": "",
2
+ "author": "",
5
3
  "bin": {
6
4
  "mpx": "bin/mpx.js"
7
5
  },
8
- "keywords": [],
9
- "author": "",
10
- "license": "Apache",
11
6
  "dependencies": {
7
+ "@types/inquirer": "^8.1.3",
12
8
  "@vue/cli": "^5.0.0",
13
- "execa": "^4.1.0",
9
+ "commander": "^7.1.0",
10
+ "fs-extra": "^9.1.0",
11
+ "inquirer": "^8.0.0",
14
12
  "lodash.merge": "^4.6.2",
15
- "shelljs": "^0.8.4"
13
+ "minimist": "^1.2.5",
14
+ "resolve": "^1.20.0",
15
+ "shelljs": "^0.8.4",
16
+ "validate-npm-package-name": "^3.0.0"
17
+ },
18
+ "description": "",
19
+ "devDependencies": {
20
+ "cmd-shim": "^4.1.0"
16
21
  },
17
22
  "engines": {
18
23
  "node": ">=8.9"
19
24
  },
25
+ "keywords": [],
26
+ "license": "Apache",
27
+ "name": "@mpxjs/cli",
20
28
  "publishConfig": {
21
- "registry": "https://registry.npmjs.org",
22
- "access": "public"
23
- }
29
+ "access": "public",
30
+ "registry": "https://registry.npmjs.org"
31
+ },
32
+ "version": "3.3.0"
24
33
  }
package/utils/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const execa = require('execa')
1
+ const { execa } = require('@vue/cli-shared-utils')
2
2
  const vueCliBinPath = require.resolve('@vue/cli/bin/vue')
3
3
 
4
4
  module.exports.regenCmd = function regenCmd (parsedArgs) {
package/lib/plugins.js DELETED
@@ -1,27 +0,0 @@
1
- const prefix = '@mpxjs/vue-cli-plugin-mpx'
2
-
3
- const plugins = {
4
- tsSupport: {
5
- [`${prefix}-typescript`]: {
6
- version: '^1.0.0'
7
- }
8
- },
9
- cloudFunc: {
10
- [`${prefix}-cloud-func`]: {
11
- version: '^1.0.0'
12
- }
13
- },
14
- isPlugin: {
15
- [`${prefix}-plugin-mode`]: {
16
- version: '^1.0.0'
17
- }
18
- },
19
- transWeb: {
20
- [`${prefix}-web`]: {
21
- version: '^1.0.0'
22
- }
23
- }
24
- // TODO: 添加其他插件配置
25
- }
26
-
27
- module.exports = plugins