其他分享
首页 > 其他分享> > cordova插件根据 不同环境设置不同key

cordova插件根据 不同环境设置不同key

作者:互联网

/* eslint-disable */

/**
 * 根据环境变量初始化一些第三方库需要的key
 */
const { m: target } = require('yargs').argv
const { OPENINSTALL_APPKEY } = require('../configs').appConfigs
const { readFileSync, writeFileSync, removeSync } = require('fs-extra')
const installMissing = require('@quasar/app/lib/mode/install-missing')

// 配置openInstall appKey和scheme
const initOpenInstall = function initOpenInstall() {
  const pkg = JSON.parse(readFileSync('./src-cordova/package.json', 'utf-8'))

  openInstall = pkg.cordova.plugins['cordova-plugin-openinstall']
  openInstall.OPENINSTALL_APPKEY = OPENINSTALL_APPKEY
  openInstall.OPENINSTALL_SCHEME = OPENINSTALL_APPKEY
  writeFileSync('./src-cordova/package.json', JSON.stringify(pkg, null, 2), 'utf-8')

  removeSync('./src-cordova/plugins')
  removeSync('./src-cordova/platforms')

  installMissing('cordova', target)
}

module.exports = function initKeys() {
  if (target) {
    initOpenInstall()
  }
}

 

标签:APPKEY,src,插件,const,require,OPENINSTALL,key,cordova
来源: https://www.cnblogs.com/xtxtx/p/14548727.html