backend-manager 3.2.119 → 3.2.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli/cli.js +17 -0
- package/src/manager/index.js +14 -14
package/package.json
CHANGED
package/src/cli/cli.js
CHANGED
|
@@ -419,6 +419,23 @@ Main.prototype.setup = async function () {
|
|
|
419
419
|
return !!pass;
|
|
420
420
|
}, fix_runtimeConfig);
|
|
421
421
|
|
|
422
|
+
// await self.test('using proper env', async function () {
|
|
423
|
+
// let runtimeconfig = JSON.parse(jetpack.read(`${self.firebaseProjectPath}/functions/.runtimeconfig.json`) || '{}');
|
|
424
|
+
// let ogPaths = getObjectPaths(runtimeconfigTemplate).split('\n');
|
|
425
|
+
// let pass = true;
|
|
426
|
+
|
|
427
|
+
// for (var i = 0, l = ogPaths.length; i < l; i++) {
|
|
428
|
+
// let item = ogPaths[i];
|
|
429
|
+
// if (!item) {continue}
|
|
430
|
+
// pass = _.get(runtimeconfig, item, undefined);
|
|
431
|
+
// if (typeof pass === 'undefined') {
|
|
432
|
+
// break;
|
|
433
|
+
// }
|
|
434
|
+
// }
|
|
435
|
+
|
|
436
|
+
// return !!pass;
|
|
437
|
+
// }, fix_runtimeConfig);
|
|
438
|
+
|
|
422
439
|
await self.test('using proper backend-manager-config.json', async function () {
|
|
423
440
|
const bemConfig = JSON.parse(self.bemConfigJSON);
|
|
424
441
|
|
package/src/manager/index.js
CHANGED
|
@@ -31,6 +31,7 @@ function Manager(exporter, options) {
|
|
|
31
31
|
// Setup EventEmitter
|
|
32
32
|
EventEmitter.call(self);
|
|
33
33
|
|
|
34
|
+
// Return
|
|
34
35
|
return self;
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -97,8 +98,11 @@ Manager.prototype.init = function (exporter, options) {
|
|
|
97
98
|
|
|
98
99
|
// Load config
|
|
99
100
|
self.config = merge(
|
|
101
|
+
// Load basic config
|
|
100
102
|
requireJSON5(self.project.backendManagerConfigPath),
|
|
101
|
-
|
|
103
|
+
// Load ENV config as a fallback
|
|
104
|
+
requireJSON5(path.resolve(self.cwd, '.runtimeconfig.json'), false),
|
|
105
|
+
// Finally, load the functions config
|
|
102
106
|
self.libraries.functions
|
|
103
107
|
? self.libraries.functions.config()
|
|
104
108
|
: {},
|
|
@@ -980,22 +984,18 @@ function resolveProjectPackage() {
|
|
|
980
984
|
} catch (e) {}
|
|
981
985
|
}
|
|
982
986
|
|
|
983
|
-
function requireJSON5(
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
} catch (e) {
|
|
987
|
-
console.error(`Failed to load JSON at ${p}:`, e)
|
|
988
|
-
throw e;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
987
|
+
function requireJSON5(file, log) {
|
|
988
|
+
// Set log
|
|
989
|
+
log = typeof log === 'undefined' ? true : log;
|
|
991
990
|
|
|
992
|
-
|
|
991
|
+
// Load JSON5
|
|
993
992
|
try {
|
|
994
|
-
|
|
995
|
-
console.log('=====+++', require(path.resolve(cwd, '.runtimeconfig.json')));
|
|
996
|
-
return require(path.resolve(cwd, '.runtimeconfig.json'));
|
|
993
|
+
return JSON5.parse(jetpack.read(file))
|
|
997
994
|
} catch (e) {
|
|
998
|
-
|
|
995
|
+
if (log) {
|
|
996
|
+
console.error(`Failed to load JSON at ${file}:`, e);
|
|
997
|
+
}
|
|
998
|
+
throw e;
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
|