generator.js 3.1 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 9 10 11 12 13 14 15 16
  api.extendPackage(pkg => {
    delete pkg.postcss
    delete pkg.browserslist
    return {
      scripts: {
        'info': 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js',
        'serve': 'npm run dev:h5',
        'build': 'npm run build:h5',
        '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 已提交
17 18
        'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch',
        'dev:mp-360': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch',
fxy060608's avatar
fxy060608 已提交
19 20 21 22 23
        '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 已提交
24 25
        'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build',
        'build:mp-360': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build',
fxy060608's avatar
fxy060608 已提交
26 27 28 29 30 31 32
        'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom',
        'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom'
      },
      'uni-app': {
        'scripts': {}
      },
      dependencies: {
fxy060608's avatar
fxy060608 已提交
33 34 35 36 37 38 39 40
        '@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,
        '@dcloudio/uni-stat': version,
fxy060608's avatar
fxy060608 已提交
41 42 43 44
        'flyio': '^0.6.2',
        'vuex': '^3.0.1'
      },
      devDependencies: {
fxy060608's avatar
fxy060608 已提交
45 46
        '@dcloudio/uni-cli-shared': version,
        '@dcloudio/uni-migration': version,
fxy060608's avatar
fxy060608 已提交
47
        '@dcloudio/uni-template-compiler': version,
fxy060608's avatar
fxy060608 已提交
48 49 50
        '@dcloudio/vue-cli-plugin-hbuilderx': version,
        '@dcloudio/vue-cli-plugin-uni': version,
        '@dcloudio/vue-cli-plugin-uni-optimize': version,
fxy060608's avatar
fxy060608 已提交
51 52
        '@dcloudio/webpack-uni-mp-loader': version,
        '@dcloudio/webpack-uni-pages-loader': version,
fxy060608's avatar
fxy060608 已提交
53 54
        'babel-plugin-import': '^1.11.0',
        'cross-env': '^7.0.2'
fxy060608's avatar
fxy060608 已提交
55 56
      },
      browserslist: [
fxy060608's avatar
fxy060608 已提交
57
        'Android >= 4',
fxy060608's avatar
fxy060608 已提交
58 59 60 61 62
        'ios >= 8'
      ]
    }
  })
}