generator.js 4.0 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1
module.exports = (api, options, rootOptions) => {
fxy060608's avatar
fxy060608 已提交
2
  const mainVersion = require('./package.json').version
fxy060608's avatar
fxy060608 已提交
3
  const version = '^' + mainVersion
fxy060608's avatar
fxy060608 已提交
4 5 6 7 8
  api.extendPackage(pkg => {
    delete pkg.postcss
    delete pkg.browserslist
    return {
      scripts: {
fxy060608's avatar
fxy060608 已提交
9 10 11
        info: 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js',
        serve: 'npm run dev:h5',
        build: 'npm run build:h5',
fxy060608's avatar
fxy060608 已提交
12
        'serve:quickapp-native': 'node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js',
fxy060608's avatar
fxy060608 已提交
13 14 15 16 17
        'dev:h5': 'cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve',
        'dev:mp-qq': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch',
        'dev:mp-weixin': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch',
        'dev:mp-baidu': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch',
        'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch',
fxy060608's avatar
fxy060608 已提交
18
        'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch',
fxy060608's avatar
fxy060608 已提交
19 20
        'dev:quickapp-native': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch',
        'dev:quickapp-webview': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch',
fxy060608's avatar
fxy060608 已提交
21 22 23 24 25
        'build:h5': 'cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build',
        'build:mp-qq': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build',
        'build:mp-weixin': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build',
        'build:mp-baidu': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build',
        'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build',
fxy060608's avatar
fxy060608 已提交
26
        'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build',
fxy060608's avatar
fxy060608 已提交
27 28
        'build:quickapp-native': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build',
        'build:quickapp-webview': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build',
fxy060608's avatar
fxy060608 已提交
29
        'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom',
fxy060608's avatar
fxy060608 已提交
30
        'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom',
fxy060608's avatar
fxy060608 已提交
31
        'test:h5': 'cross-env UNI_PLATFORM=h5 jest -i',
fxy060608's avatar
fxy060608 已提交
32
        'test:ios': 'cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i',
fxy060608's avatar
fxy060608 已提交
33
        'test:android': 'cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i',
fxy060608's avatar
fxy060608 已提交
34 35
        'test:mp-weixin': 'cross-env UNI_PLATFORM=mp-weixin jest -i',
        'test:mp-baidu': 'cross-env UNI_PLATFORM=mp-baidu jest -i'
fxy060608's avatar
fxy060608 已提交
36 37
      },
      'uni-app': {
fxy060608's avatar
fxy060608 已提交
38
        scripts: {}
fxy060608's avatar
fxy060608 已提交
39 40
      },
      dependencies: {
fxy060608's avatar
fxy060608 已提交
41 42 43 44 45 46 47
        '@dcloudio/uni-app-plus': version,
        '@dcloudio/uni-h5': version,
        '@dcloudio/uni-mp-qq': version,
        '@dcloudio/uni-mp-weixin': version,
        '@dcloudio/uni-mp-baidu': version,
        '@dcloudio/uni-mp-alipay': version,
        '@dcloudio/uni-mp-toutiao': version,
fxy060608's avatar
fxy060608 已提交
48 49
        '@dcloudio/uni-quickapp-webview': version,
        '@dcloudio/uni-quickapp-native': version,
fxy060608's avatar
fxy060608 已提交
50
        '@dcloudio/uni-stat': version,
fxy060608's avatar
fxy060608 已提交
51
        flyio: '^0.6.2',
fxy060608's avatar
fxy060608 已提交
52
        vuex: '^3.2.0'
fxy060608's avatar
fxy060608 已提交
53
      },
fxy060608's avatar
fxy060608 已提交
54
      devDependencies: {
fxy060608's avatar
fxy060608 已提交
55
        '@dcloudio/uni-automator': version,
fxy060608's avatar
fxy060608 已提交
56
        '@dcloudio/uni-cli-shared': version,
fxy060608's avatar
fxy060608 已提交
57
        '@dcloudio/uni-migration': version,
fxy060608's avatar
fxy060608 已提交
58
        '@dcloudio/uni-template-compiler': version,
fxy060608's avatar
fxy060608 已提交
59 60 61
        '@dcloudio/vue-cli-plugin-hbuilderx': version,
        '@dcloudio/vue-cli-plugin-uni': version,
        '@dcloudio/vue-cli-plugin-uni-optimize': version,
fxy060608's avatar
fxy060608 已提交
62 63
        '@dcloudio/webpack-uni-mp-loader': version,
        '@dcloudio/webpack-uni-pages-loader': version,
fxy060608's avatar
fxy060608 已提交
64
        'babel-plugin-import': '^1.11.0',
fxy060608's avatar
fxy060608 已提交
65 66
        'cross-env': '^7.0.2',
        jest: '^25.4.0'
fxy060608's avatar
fxy060608 已提交
67 68
      },
      browserslist: [
fxy060608's avatar
fxy060608 已提交
69
        'Android >= 4',
fxy060608's avatar
fxy060608 已提交
70 71 72 73 74
        'ios >= 8'
      ]
    }
  })
}