提交 cabc2ad5 编写于 作者: 雪洛's avatar 雪洛

feat(uniCloud): prefer UNI_CLOUD_PROVIDER over UNI_CLOUD_SPACES

上级 7a3d8f9a
...@@ -21,7 +21,7 @@ if (process.env.UNI_INPUT_DIR && process.env.UNI_INPUT_DIR.indexOf('./') === 0) ...@@ -21,7 +21,7 @@ if (process.env.UNI_INPUT_DIR && process.env.UNI_INPUT_DIR.indexOf('./') === 0)
process.env.UNI_INPUT_DIR = process.env.UNI_INPUT_DIR || path.resolve(process.cwd(), defaultInputDir) process.env.UNI_INPUT_DIR = process.env.UNI_INPUT_DIR || path.resolve(process.cwd(), defaultInputDir)
const { const {
getManifestJson, getManifestJson,
isEnableUniPushV1, isEnableUniPushV1,
isEnableUniPushV2, isEnableUniPushV2,
isUniPushOffline isUniPushOffline
...@@ -66,8 +66,6 @@ process.env.VUE_APP_NAME = manifestJsonObj.name ...@@ -66,8 +66,6 @@ process.env.VUE_APP_NAME = manifestJsonObj.name
process.env.UNI_USING_V3_SCOPED = true process.env.UNI_USING_V3_SCOPED = true
process.env.UNI_CLOUD_PROVIDER = JSON.stringify([])
// 导出到小程序插件 // 导出到小程序插件
process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(Object.keys(platformOptions.plugins || {}).map(pluginName => process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(Object.keys(platformOptions.plugins || {}).map(pluginName =>
platformOptions.plugins[pluginName].export)) platformOptions.plugins[pluginName].export))
...@@ -75,7 +73,9 @@ process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(Object.keys(platformOptions.pl ...@@ -75,7 +73,9 @@ process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(Object.keys(platformOptions.pl
const isH5 = !process.env.UNI_SUB_PLATFORM && process.env.UNI_PLATFORM === 'h5' const isH5 = !process.env.UNI_SUB_PLATFORM && process.env.UNI_PLATFORM === 'h5'
const isProduction = process.env.NODE_ENV === 'production' const isProduction = process.env.NODE_ENV === 'production'
if (process.env.UNI_CLOUD_SPACES) { // uniCloud
if (!process.env.UNI_CLOUD_PROVIDER && process.env.UNI_CLOUD_SPACES) {
process.env.UNI_CLOUD_PROVIDER = JSON.stringify([])
try { try {
const spaces = JSON.parse(process.env.UNI_CLOUD_SPACES) const spaces = JSON.parse(process.env.UNI_CLOUD_SPACES)
if (Array.isArray(spaces)) { if (Array.isArray(spaces)) {
...@@ -561,4 +561,4 @@ runByHBuilderX && console.log(uniI18n.__('compiling')) ...@@ -561,4 +561,4 @@ runByHBuilderX && console.log(uniI18n.__('compiling'))
module.exports = { module.exports = {
manifestPlatformOptions: platformOptions manifestPlatformOptions: platformOptions
} }
...@@ -628,12 +628,12 @@ function initUniStatistics (manifestJson) { ...@@ -628,12 +628,12 @@ function initUniStatistics (manifestJson) {
) )
delete manifestJson.uniStatistics delete manifestJson.uniStatistics
} }
if (!process.env.UNI_CLOUD_SPACES) { if (!process.env.UNI_CLOUD_PROVIDER) {
return return
} }
let spaces = [] let spaces = []
try { try {
spaces = JSON.parse(process.env.UNI_CLOUD_SPACES) spaces = JSON.parse(process.env.UNI_CLOUD_PROVIDER)
} catch (e) {} } catch (e) {}
if (!Array.isArray(spaces) || !spaces.length) { if (!Array.isArray(spaces) || !spaces.length) {
return return
...@@ -652,9 +652,9 @@ function initUniStatistics (manifestJson) { ...@@ -652,9 +652,9 @@ function initUniStatistics (manifestJson) {
} }
uniStatistics.uniCloud = { uniStatistics.uniCloud = {
provider: space.provider, provider: space.provider,
spaceId: space.id, spaceId: space.spaceId,
clientSecret: space.clientSecret, clientSecret: space.clientSecret,
endpoint: space.apiEndpoint endpoint: space.endpoint
} }
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册