@mpxjs/mpx-cli-service 1.6.29 → 2.0.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.
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { semver, error } = require('@vue/cli-shared-utils')
4
- const filterPluginsByPlatform = require('../utils/filterPlugins')
5
4
  const requiredVersion = require('../package.json').engines.node
5
+ const filterPluginsByPlatform = require('../utils/filterPlugins')
6
6
 
7
7
  if (!semver.satisfies(process.version, requiredVersion, { includePrerelease: true })) {
8
8
  error(
@@ -13,6 +13,7 @@ if (!semver.satisfies(process.version, requiredVersion, { includePrerelease: tru
13
13
  }
14
14
 
15
15
  const Service = require('../lib/Service')
16
+ const { parseTarget } = require('@mpxjs/vue-cli-plugin-mpx/utils')
16
17
  const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd())
17
18
  const rawArgv = process.argv.slice(2)
18
19
  const args = require('minimist')(rawArgv, {
@@ -34,6 +35,8 @@ const args = require('minimist')(rawArgv, {
34
35
  const command = args._[0]
35
36
  process.env.MPX_CLI_MODE = command.split(':')[1] || 'mp'
36
37
 
38
+ const { env } = parseTarget(args.target)
39
+
37
40
  const setPluginsToSkip = service.setPluginsToSkip.bind(service)
38
41
  service.setPluginsToSkip = function (args) {
39
42
  setPluginsToSkip(args, rawArgv)
@@ -52,7 +55,8 @@ service.setPluginsToSkip = function (args) {
52
55
  })
53
56
  }
54
57
 
55
- service.run(command, args, rawArgv).catch(err => {
58
+ // 优先wx:production 然后是 --mode=production
59
+ service.run(command, { ...args, mode: env || args.mode }, rawArgv).catch((err) => {
56
60
  error(err)
57
61
  process.exit(1)
58
62
  })
package/lib/Service.js CHANGED
@@ -1,3 +1,5 @@
1
1
  const Service = require('@vue/cli-service')
2
2
 
3
+ process.env.CI = 't'
4
+
3
5
  module.exports = Service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/mpx-cli-service",
3
- "version": "1.6.29",
3
+ "version": "2.0.0",
4
4
  "description": "local service for mpx-cli project",
5
5
  "main": "lib/Service.js",
6
6
  "bin": {
@@ -8,7 +8,8 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@vue/cli-service": "^5.0.0",
11
- "@vue/cli-shared-utils": "^5.0.4"
11
+ "@vue/cli-shared-utils": "^5.0.4",
12
+ "minimist": "^1.2.5"
12
13
  },
13
14
  "scripts": {
14
15
  "test": "echo \"Error: no test specified\" && exit 1"