backend-manager 3.2.120 → 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/manager/index.js +14 -12
package/package.json
CHANGED
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,20 +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
|
-
return
|
|
993
|
+
return JSON5.parse(jetpack.read(file))
|
|
995
994
|
} catch (e) {
|
|
996
|
-
|
|
995
|
+
if (log) {
|
|
996
|
+
console.error(`Failed to load JSON at ${file}:`, e);
|
|
997
|
+
}
|
|
998
|
+
throw e;
|
|
997
999
|
}
|
|
998
1000
|
}
|
|
999
1001
|
|