Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mpx-ecology/mpx-cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.6.18
Choose a base ref
...
head repository: mpx-ecology/mpx-cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Dec 2, 2022

  1. feat: 依赖&tsconfig

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    0e6ab67 View commit details
  2. fix: mock

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    25a491d View commit details
  3. Copy the full SHA
    a1c23dc View commit details
  4. fix: dep

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    55347de View commit details
  5. feat: jest config reseason

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    9839821 View commit details
  6. fix: up unit

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    d66be01 View commit details
  7. fix: tempalte

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    5435286 View commit details
  8. fix: test

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    c08a6a1 View commit details
  9. fix: e2e tl

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    062b6f6 View commit details
  10. fix: test

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    3500e74 View commit details
  11. fix: sc

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    d9c7cde View commit details
  12. fix: test ts

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    5fa196a View commit details
  13. feat: 注释

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    90f458f View commit details
  14. fix: conflict

    pagnkelly committed Dec 2, 2022
    Copy the full SHA
    0991d56 View commit details
  15. Copy the full SHA
    f080fc2 View commit details
  16. Merge pull request #60 from mpx-ecology/feat-unittest-dep

    Feat unittest dep
    mater1996 authored Dec 2, 2022
    Copy the full SHA
    9349657 View commit details
  17. chore: release v1.6.19

    mater1996 committed Dec 2, 2022
    Copy the full SHA
    14da03d View commit details
  18. fix: eslint

    mater1996 committed Dec 2, 2022
    Copy the full SHA
    4e4caee View commit details
  19. chore: release v1.6.20

    mater1996 committed Dec 2, 2022
    Copy the full SHA
    eca5094 View commit details

Commits on Dec 5, 2022

  1. Copy the full SHA
    5a25304 View commit details
  2. fix: plugin build error

    mater1996 committed Dec 5, 2022
    Copy the full SHA
    d3e6edc View commit details
  3. chore: release v1.6.21

    mater1996 committed Dec 5, 2022
    Copy the full SHA
    701f4e2 View commit details

Commits on Dec 6, 2022

  1. fix: webpack mode (#61)

    mater1996 authored Dec 6, 2022
    Copy the full SHA
    12e5555 View commit details
  2. chore: release v1.6.22

    mater1996 committed Dec 6, 2022
    Copy the full SHA
    453b705 View commit details

Commits on Dec 22, 2022

  1. Copy the full SHA
    9b59a0b View commit details
  2. chore: release v1.6.23

    mater1996 committed Dec 22, 2022
    Copy the full SHA
    fcecccc View commit details
  3. fix: template

    mater1996 committed Dec 22, 2022
    Copy the full SHA
    fc9588c View commit details
  4. chore: release v1.6.24

    mater1996 committed Dec 22, 2022
    Copy the full SHA
    90f2c78 View commit details

Commits on Dec 29, 2022

  1. Copy the full SHA
    505c1f2 View commit details
  2. chore: release v1.6.25

    mater1996 committed Dec 29, 2022
    Copy the full SHA
    6b2aa55 View commit details

Commits on Jan 5, 2023

  1. fix: remove console

    mater1996 committed Jan 5, 2023
    Copy the full SHA
    e4cae1a View commit details
  2. chore: release v1.6.26

    mater1996 committed Jan 5, 2023
    Copy the full SHA
    42ab6a4 View commit details

Commits on Jan 9, 2023

  1. Feature/mpx env (#64)

    * fix: configureWebpack注释格式问题
    
    * fix: remove env from inspect:mp
    
    * fix: inspect:web env not supprot
    
    * fix: define plugin name
    mater1996 authored Jan 9, 2023
    Copy the full SHA
    f10620f View commit details
  2. chore: release v1.6.27

    mater1996 committed Jan 9, 2023
    Copy the full SHA
    92474ee View commit details

Commits on Jan 16, 2023

  1. Copy the full SHA
    f8cdc99 View commit details
  2. chore: release v1.6.28

    mater1996 committed Jan 16, 2023
    Copy the full SHA
    b305600 View commit details

Commits on May 11, 2023

  1. fix: vue-loader

    mater1996 committed May 11, 2023
    Copy the full SHA
    62d9b6d View commit details
  2. chore: release v1.6.29

    mater1996 committed May 11, 2023
    Copy the full SHA
    e6dbf57 View commit details

Commits on May 12, 2023

  1. Copy the full SHA
    9088b46 View commit details
  2. chore: release v1.6.30

    mater1996 committed May 12, 2023
    Copy the full SHA
    0bbdbd3 View commit details

Commits on Jul 18, 2023

  1. Update README.md

    mater1996 authored Jul 18, 2023
    Copy the full SHA
    c56b8b2 View commit details
Showing with 2,945 additions and 517 deletions.
  1. +68 −0 CHANGELOG.md
  2. +10 −2 README.md
  3. +1 −1 lerna.json
  4. +1 −1 package.json
  5. +1 −1 packages/mpx-cli-service/package.json
  6. +2 −0 packages/mpx-cli/bin/mpx.js
  7. +1 −0 packages/mpx-cli/lib/inspect.js
  8. +1 −1 packages/vue-cli-plugin-mpx-cloud-func/package.json
  9. +3 −3 packages/vue-cli-plugin-mpx-e2e-test/generator/index.js
  10. +1 −1 packages/vue-cli-plugin-mpx-e2e-test/generator/template-typescript/e2e/components/list.spec.ts
  11. +1 −1 packages/vue-cli-plugin-mpx-e2e-test/generator/template/e2e/components/list.spec.js
  12. +1 −1 packages/vue-cli-plugin-mpx-e2e-test/package.json
  13. +1 −1 packages/vue-cli-plugin-mpx-eslint/package.json
  14. +14 −6 packages/vue-cli-plugin-mpx-mp/commands/build.js
  15. +12 −5 packages/vue-cli-plugin-mpx-mp/commands/inspect.js
  16. +15 −3 packages/vue-cli-plugin-mpx-mp/commands/serve.js
  17. +31 −5 packages/vue-cli-plugin-mpx-mp/config/base.js
  18. +20 −13 packages/vue-cli-plugin-mpx-mp/config/plugin.js
  19. +34 −23 packages/vue-cli-plugin-mpx-mp/config/target.js
  20. +16 −0 packages/vue-cli-plugin-mpx-mp/index.js
  21. +3 −2 packages/vue-cli-plugin-mpx-mp/package.json
  22. +17 −5 packages/vue-cli-plugin-mpx-mp/utils/symlinkTargetConfig.js
  23. +26 −52 packages/vue-cli-plugin-mpx-mp/utils/webpack.js
  24. +1 −1 packages/vue-cli-plugin-mpx-plugin-mode/generator/template-typescript/src/plugin/components/list.mpx
  25. +10 −10 packages/vue-cli-plugin-mpx-plugin-mode/generator/template/src/miniprogram/app.mpx
  26. +6 −6 packages/vue-cli-plugin-mpx-plugin-mode/generator/template/src/miniprogram/pages/index.mpx
  27. +7 −7 packages/vue-cli-plugin-mpx-plugin-mode/generator/template/src/plugin/components/list.mpx
  28. +1 −1 packages/vue-cli-plugin-mpx-plugin-mode/package.json
  29. +4 −2 packages/vue-cli-plugin-mpx-typescript/generator/template-src/src/components/list.mpx
  30. +1 −2 packages/vue-cli-plugin-mpx-typescript/generator/template-tsconfig/tsconfig.json
  31. +1 −1 packages/vue-cli-plugin-mpx-typescript/package.json
  32. +7 −6 packages/vue-cli-plugin-mpx-unit-test/generator/index.js
  33. +1 −1 packages/vue-cli-plugin-mpx-unit-test/generator/template/test/components/list.spec.js
  34. +8 −1 packages/vue-cli-plugin-mpx-unit-test/package.json
  35. +4 −0 packages/vue-cli-plugin-mpx-web/{config.js → config/index.js}
  36. +1 −1 packages/vue-cli-plugin-mpx-web/index.js
  37. +3 −2 packages/vue-cli-plugin-mpx-web/package.json
  38. +32 −6 packages/vue-cli-plugin-mpx/config/base.js
  39. +34 −2 packages/vue-cli-plugin-mpx/generator/index.js
  40. +4 −2 packages/vue-cli-plugin-mpx/generator/src/template/src/components/list.mpx
  41. +1 −1 packages/vue-cli-plugin-mpx/package.json
  42. +1 −1 packages/vue-cli-plugin-mpx/utils/resolveVueConfigWebpackConfig.js
  43. +2 −2 scripts/test-prompts.js
  44. +1 −0 scripts/test.js
  45. +2,535 −335 yarn.lock
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,74 @@






## 1.6.27 (2023-01-09)

#### :rocket: New Features
* `mpx-cli`, `vue-cli-plugin-mpx-mp`, `vue-cli-plugin-mpx-web`, `vue-cli-plugin-mpx`
* [#64](https://github.com/mpx-ecology/mpx-cli/pull/64) Feature/mpx env ([@mater1996](https://github.com/mater1996))

#### Committers: 1
- Mater ([@mater1996](https://github.com/mater1996))






## 1.6.25 (2022-12-29)

#### :bug: Bug Fix
* `vue-cli-plugin-mpx-mp`
* [#63](https://github.com/mpx-ecology/mpx-cli/pull/63) fix: copy plugin target mode path error ([@mater1996](https://github.com/mater1996))

#### Committers: 1
- Mater ([@mater1996](https://github.com/mater1996))






## 1.6.23 (2022-12-22)

#### :bug: Bug Fix
* `vue-cli-plugin-mpx-mp`, `vue-cli-plugin-mpx-web`, `vue-cli-plugin-mpx`
* [#62](https://github.com/mpx-ecology/mpx-cli/pull/62) Fix: 更改output.path导致linkfile失效。 ([@mater1996](https://github.com/mater1996))

#### Committers: 1
- Mater ([@mater1996](https://github.com/mater1996))



## 1.6.22 (2022-12-06)

#### :bug: Bug Fix
* `vue-cli-plugin-mpx-mp`
* [#61](https://github.com/mpx-ecology/mpx-cli/pull/61) fix: webpack mode ([@mater1996](https://github.com/mater1996))

#### Committers: 1
- Mater ([@mater1996](https://github.com/mater1996))


















## 1.6.17-0 (2022-12-02)

#### :rocket: New Features
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
npm i @mpxjs/cli -g
```

> 如果插件版本是2.x以上,需要前往https://github.com/mpx-ecology/mpx-cli/tree/next 查看文档
## 使用

```sh
@@ -67,6 +69,7 @@ npm run build

--targets 编译到小程序目标(默认值: wx)
--mode 指定环境模式 (默认值:production)
--env 自定义 __mpx_env__
--watch 监听文件变化
--report 生成包分析报告
--open-child-process 开启子进程编译
@@ -95,6 +98,7 @@ mpx-cli-service build:mp --targets=wx,ali
选项:

--targets 编译到小程序目标(默认值: wx)
--env 自定义 __mpx_env__
--open-child-process 开启子进程编译
```

@@ -114,6 +118,7 @@ mpx-cli-service serve:mp --targets=wx,ali
--dest 指定输出目录 (默认值:dist)
--modern 面向现代浏览器带自动回退地构建应用
--target app | lib | wc | wc-async (默认值:app)
--env 自定义 __mpx_env__
--name 库或 Web Components 模式下的名字 (默认值:package.json 中的 "name" 字段或入口文件名)
--no-clean 在构建项目之前不清除目标目录的内容
--report 生成 report.html 以帮助分析包内容
@@ -139,6 +144,7 @@ mpx-cli-service build:web
--host 指定 host (默认值:0.0.0.0)
--port 指定 port (默认值:8080)
--https 使用 https (默认值:false)
--env 自定义 __mpx_env__
```

```sh
@@ -187,8 +193,10 @@ module.exports = {

可根据构建平台和开发环境进行选择性的配置,在构建过程中暴露出来的环境变量包括:

- `MPX_CLI_MODE`: `mp` | `web`
- `NODE_ENV``development` | `production`
- `MPX_CLI_MODE`: 'mp' | 'web'
- `NODE_ENV`:'development' | 'production'
- `MPX_CURRENT_TARGET_MODE`: 'wx' | 'ali' | 'swan' | 'qq' | 'tt' | 'dd'
- `MPX_CURRENT_TARGET_ENV` : 'development' | 'production'

```javascript
// vue.config.js
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -17,5 +17,5 @@
"PR: Underlying Tools": ":hammer: Underlying Tools"
}
},
"version": "1.6.18"
"version": "1.6.30"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -41,5 +41,5 @@
"trailingComma": "none",
"singleQuote": true
},
"version": "1.6.18"
"version": "1.6.30"
}
2 changes: 1 addition & 1 deletion packages/mpx-cli-service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mpxjs/mpx-cli-service",
"version": "1.6.18",
"version": "1.6.30",
"description": "local service for mpx-cli project",
"main": "lib/Service.js",
"bin": {
2 changes: 2 additions & 0 deletions packages/mpx-cli/bin/mpx.js
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ program
.description('inspect the webpack config in a project with mpx-cli-service')
.option('--mode <mode>')
.option('--targets <targets>')
.option('--env <env>', 'custom define __mpx_env__')
.option('-v --verbose', 'Show full function definitions in output')
.action((paths, options) => {
require('../lib/inspect')(paths, options, 'mp')
@@ -72,6 +73,7 @@ program
.command('inspect:web [paths...]')
.description('inspect the webpack config in a project with mpx-cli-service')
.option('--mode <mode>')
.option('--env <env>', 'custom define __mpx_env__')
.option('--rule <ruleName>', 'inspect a specific module rule')
.option('--plugin <pluginName>', 'inspect a specific plugin')
.option('--rules', 'list all module rule names')
1 change: 1 addition & 0 deletions packages/mpx-cli/lib/inspect.js
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ module.exports = function inspect (paths, args, mode) {
`inspect:${mode}`,
...(args.mode ? ['--mode', args.mode] : []),
...(args.targets ? ['--targets', args.targets] : []),
...(args.env ? ['--env', args.env] : []),
...(args.rule ? ['--rule', args.rule] : []),
...(args.plugin ? ['--plugin', args.plugin] : []),
...(args.rules ? ['--rules'] : []),
2 changes: 1 addition & 1 deletion packages/vue-cli-plugin-mpx-cloud-func/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mpxjs/vue-cli-plugin-mpx-cloud-func",
"version": "1.6.18",
"version": "1.6.30",
"description": "mp cloud func plugin for mpx",
"main": "index.js",
"scripts": {
6 changes: 3 additions & 3 deletions packages/vue-cli-plugin-mpx-e2e-test/generator/index.js
Original file line number Diff line number Diff line change
@@ -9,15 +9,15 @@ module.exports = function (api, options = {}) {

api.extendPackage({
devDependencies: {
jest: '^27.4.5',
'@types/jest': '^27.5.1'
jest: '^27.4.5'
}
})

if (needTs) {
api.extendPackage({
devDependencies: {
'ts-jest': '^27.1.2'
'ts-jest': '^27.1.2',
'@types/jest': '^27.5.1'
}
})
}
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ describe('index', () => {
// 断言页面标签
expect(desc.tagName).toBe('view')
// 断言文字内容
expect(await desc.text()).toContain('this is mpx project')
expect(await desc.text()).toContain('手机')
// 保存页面快照
await miniProgram.screenshot({
path: 'e2e/screenshot/homePage.png'
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ describe('index', () => {
// 断言页面标签
expect(desc.tagName).toBe('view')
// 断言文字内容
expect(await desc.text()).toContain('this is mpx project')
expect(await desc.text()).toContain('手机')
// 保存页面快照
await miniProgram.screenshot({
path: 'e2e/screenshot/homePage.png'
2 changes: 1 addition & 1 deletion packages/vue-cli-plugin-mpx-e2e-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mpxjs/vue-cli-plugin-mpx-e2e-test",
"version": "1.6.18",
"version": "1.6.30",
"description": "e2e plugin for mpx",
"main": "index.js",
"scripts": {
2 changes: 1 addition & 1 deletion packages/vue-cli-plugin-mpx-eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mpxjs/vue-cli-plugin-mpx-eslint",
"version": "1.6.18",
"version": "1.6.30",
"description": "eslint plugin for mpx-cli",
"main": "index.js",
"scripts": {
20 changes: 14 additions & 6 deletions packages/vue-cli-plugin-mpx-mp/commands/build.js
Original file line number Diff line number Diff line change
@@ -19,11 +19,13 @@ module.exports = function registerBuildCommand (api, options) {
'--targets': `compile for target platform, support ${MODE.SUPPORT_MODE}`,
'--watch': 'compile in watch mode',
'--report': 'generate report.html to help analyze bundle content',
'--open-child-process': 'open child process'
'--open-child-process': 'open child process',
'--env': 'custom define __mpx_env__'
}
},
function (args, rawArgv) {
const watch = !!args.watch
const customMpxEnv = args.env
const mode = api.service.mode
const targets = getTargets(args, options)
const openChildProcess =
@@ -44,12 +46,12 @@ module.exports = function registerBuildCommand (api, options) {
options,
targets,
(webpackConfig, target) => {
const env = target.env
if (env === 'production' || env === 'development') {
webpackConfig.mode(env)
webpackConfig.plugin('mpx-define-plugin').tap(() => [
const targetEnv = target.env
if (targetEnv === 'production' || targetEnv === 'development') {
webpackConfig.mode(targetEnv === 'production' ? targetEnv : 'none')
webpackConfig.plugin('define').tap((args) => [
{
'process.env.NODE_ENV': `"${env}"`
'process.env.NODE_ENV': `"${targetEnv}"`
}
])
}
@@ -58,6 +60,12 @@ module.exports = function registerBuildCommand (api, options) {
.plugin('bundle-analyzer-plugin')
.use(BundleAnalyzerPlugin, [{}])
}
if (customMpxEnv) {
webpackConfig.plugin('mpx-webpack-plugin').tap((args) => {
args[0].env = customMpxEnv
return args
})
}
// 仅在watch模式下生产sourcemap
// 百度小程序不开启sourcemap,开启会有模板渲染问题
webpackConfig.devtool(
17 changes: 12 additions & 5 deletions packages/vue-cli-plugin-mpx-mp/commands/inspect.js
Original file line number Diff line number Diff line change
@@ -14,19 +14,20 @@ module.exports = function registerInspectCommand (api, options) {
function (args) {
const targets = getTargets(args, options)
const { verbose } = args
const customMpxEnv = args.env

// 小程序业务代码构建配置
const res = resolveWebpackConfigByTargets(
api,
options,
targets,
(webpackConfig, target) => {
const env = target.env
if (env === 'production' || env === 'development') {
webpackConfig.mode(env)
webpackConfig.plugin('mpx-define-plugin').tap((args) => [
const targetEnv = target.env
if (targetEnv === 'production' || targetEnv === 'development') {
webpackConfig.mode(targetEnv === 'production' ? targetEnv : 'none')
webpackConfig.plugin('define').tap((args) => [
{
'process.env.NODE_ENV': `"${env}"`
'process.env.NODE_ENV': `"${targetEnv}"`
}
])
}
@@ -35,6 +36,12 @@ module.exports = function registerInspectCommand (api, options) {
.plugin('bundle-analyzer-plugin')
.use(BundleAnalyzerPlugin, [{}])
}
if (customMpxEnv) {
webpackConfig.plugin('mpx-webpack-plugin').tap((args) => {
args[0].env = customMpxEnv
return args
})
}
}
)
const output = toString(res, { verbose })
18 changes: 15 additions & 3 deletions packages/vue-cli-plugin-mpx-mp/commands/serve.js
Original file line number Diff line number Diff line change
@@ -15,11 +15,14 @@ module.exports = function registerServeCommand (api, options) {
description: 'mp development',
usage: 'mpx-cli-service serve:mp',
options: {
'--targets': `compile for target platform, support ${MODE.SUPPORT_MODE}`
'--targets': `compile for target platform, support ${MODE.SUPPORT_MODE}`,
'--open-child-process': 'open child process',
'--env': 'custom define __mpx_env__'
}
},
function (args, rawArgv) {
const mode = api.service.mode
const customMpxEnv = args.env
const targets = getTargets(args, options)
const openChildProcess =
!!args['open-child-process'] && targets.length > 1
@@ -30,7 +33,10 @@ module.exports = function registerServeCommand (api, options) {
)

if (openChildProcess) {
return runWebpackInChildProcess('serve:mp', rawArgv, { targets, watch: true })
return runWebpackInChildProcess('serve:mp', rawArgv, {
targets,
watch: true
})
}

// 小程序业务代码构建配置
@@ -40,11 +46,17 @@ module.exports = function registerServeCommand (api, options) {
targets,
(webpackConfig) => {
webpackConfig.devtool('source-map')
if (customMpxEnv) {
webpackConfig.plugin('mpx-webpack-plugin').tap((args) => {
args[0].env = customMpxEnv
return args
})
}
}
)
return runWebpack(webpackConfigs, {
watch: true
}).then(res => {
}).then((res) => {
symLinkTargetConfig(api, targets, webpackConfigs)
return res
})
Loading