backend-manager 3.2.133 → 3.2.135

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.133",
3
+ "version": "3.2.135",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -14,6 +14,8 @@ const util = require('util');
14
14
  const core = './functions/core';
15
15
  const wrappers = './functions/wrappers';
16
16
 
17
+ const BEM_CONFIG_TEMPLATE_PATH = path.resolve(__dirname, '../../templates/backend-manager-config.json');
18
+
17
19
  function Manager(exporter, options) {
18
20
  const self = this;
19
21
 
@@ -99,7 +101,7 @@ Manager.prototype.init = function (exporter, options) {
99
101
  // Load config
100
102
  self.config = merge(
101
103
  // Load basic config
102
- requireJSON5(self.project.backendManagerConfigPath, true),
104
+ merge({}, requireJSON5(BEM_CONFIG_TEMPLATE_PATH, true), requireJSON5(self.project.backendManagerConfigPath, true)),
103
105
  // Load ENV config as a fallback
104
106
  requireJSON5(path.resolve(self.cwd, '.runtimeconfig.json'), options.projectType === 'firebase'),
105
107
  // Finally, load the functions config
@@ -109,7 +111,7 @@ Manager.prototype.init = function (exporter, options) {
109
111
  );
110
112
 
111
113
  // Saved config
112
- const appId = get(self.config, 'app.id');
114
+ const appId = self.config?.app?.id;
113
115
 
114
116
  // Init assistant
115
117
  self.assistant = self.Assistant().init(undefined, options.assistant);
@@ -132,7 +134,7 @@ Manager.prototype.init = function (exporter, options) {
132
134
  const semverMajor = require('semver/functions/major')
133
135
  const semverCoerce = require('semver/functions/coerce')
134
136
  const semverUsing = semverMajor(semverCoerce(process.versions.node));
135
- const semverRequired = semverMajor(semverCoerce(get(self.package, 'engines.node', '0.0.0')));
137
+ const semverRequired = semverMajor(semverCoerce(self.package?.engines?.node || '0.0.0'));
136
138
 
137
139
  // Fix firebase-tools overwriting console.log
138
140
  // https://stackoverflow.com/questions/56026747/firebase-console-log-on-localhost
@@ -169,7 +171,7 @@ Manager.prototype.init = function (exporter, options) {
169
171
  // Setup sentry
170
172
  if (self.options.sentry) {
171
173
  const sentryRelease = `${appId || self.project.projectId}@${self.package.version}`;
172
- const sentryDSN = get(self.config, 'sentry.dsn', '');
174
+ const sentryDSN = self.config?.sentry?.dsn || '';
173
175
  // console.log('Sentry', sentryRelease, sentryDSN);
174
176
 
175
177
  self.libraries.sentry = require('@sentry/node');
@@ -204,7 +206,6 @@ Manager.prototype.init = function (exporter, options) {
204
206
  databaseURL: self.project.databaseURL || `https://${self.project.projectId}.firebaseio.com`,
205
207
  }, options.uniqueAppName);
206
208
 
207
- // const loadedProjectId = get(self.libraries.initializedAdmin, 'options_.credential.projectId', null);
208
209
  const loadedProjectId = serviceAccount.project_id;
209
210
  if (!loadedProjectId || !loadedProjectId.includes(appId)) {
210
211
  self.assistant.error(`Loaded app may have wrong service account: ${loadedProjectId} =/= ${appId}`);