backend-manager 3.2.121 → 3.2.123

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.2.121",
3
+ "version": "3.2.123",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -99,9 +99,9 @@ Manager.prototype.init = function (exporter, options) {
99
99
  // Load config
100
100
  self.config = merge(
101
101
  // Load basic config
102
- requireJSON5(self.project.backendManagerConfigPath),
102
+ requireJSON5(self.project.backendManagerConfigPath, true),
103
103
  // Load ENV config as a fallback
104
- requireJSON5(path.resolve(self.cwd, '.runtimeconfig.json'), false),
104
+ requireJSON5(path.resolve(self.cwd, '.runtimeconfig.json'), options.projectType === 'firebase'),
105
105
  // Finally, load the functions config
106
106
  self.libraries.functions
107
107
  ? self.libraries.functions.config()
@@ -984,17 +984,21 @@ function resolveProjectPackage() {
984
984
  } catch (e) {}
985
985
  }
986
986
 
987
- function requireJSON5(file, log) {
988
- // Set log
989
- log = typeof log === 'undefined' ? true : log;
987
+ function requireJSON5(file, throwError) {
988
+ // Set throwError
989
+ throwError = typeof throwError === 'undefined' ? true : throwError;
990
990
 
991
991
  // Load JSON5
992
992
  try {
993
993
  return JSON5.parse(jetpack.read(file))
994
994
  } catch (e) {
995
- if (log) {
996
- console.error(`Failed to load JSON at ${file}:`, e);
995
+ // If we're not throwing an error, just return
996
+ if (!throwError) {
997
+ return {};
997
998
  }
999
+
1000
+ // Otherwise, throw the error
1001
+ console.error(`Failed to load JSON at ${file}:`, e);
998
1002
  throw e;
999
1003
  }
1000
1004
  }