firebase-tools 12.5.1 → 12.5.3

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.
@@ -38,6 +38,8 @@ async function prepare(context, options, payload) {
38
38
  if (!(await prompt.confirm({
39
39
  message: `Do you wish to continue deploying these extension instances?`,
40
40
  default: false,
41
+ nonInteractive: options.nonInteractive,
42
+ force: options.force,
41
43
  }))) {
42
44
  throw new error_1.FirebaseError("Deployment cancelled");
43
45
  }
@@ -58,6 +60,8 @@ async function prepare(context, options, payload) {
58
60
  if (!(await prompt.confirm({
59
61
  message: `Do you wish to continue deploying these extension instances?`,
60
62
  default: true,
63
+ nonInteractive: options.nonInteractive,
64
+ force: options.force,
61
65
  }))) {
62
66
  throw new error_1.FirebaseError("Deployment cancelled");
63
67
  }
@@ -82,6 +86,8 @@ async function prepare(context, options, payload) {
82
86
  .map((i) => i.instanceId)
83
87
  .join(", ")}?`,
84
88
  default: false,
89
+ nonInteractive: options.nonInteractive,
90
+ force: options.force,
85
91
  }))) {
86
92
  payload.instancesToDelete = [];
87
93
  }
@@ -130,7 +130,7 @@ function of(...endpoints) {
130
130
  for (const endpoint of endpoints) {
131
131
  bkend.endpoints[endpoint.region] = bkend.endpoints[endpoint.region] || {};
132
132
  if (bkend.endpoints[endpoint.region][endpoint.id]) {
133
- throw new Error("Trying to create a backend with the same endpiont twice");
133
+ throw new Error("Trying to create a backend with the same endpoint twice");
134
134
  }
135
135
  bkend.endpoints[endpoint.region][endpoint.id] = endpoint;
136
136
  }
@@ -95,18 +95,17 @@ class Fabricator {
95
95
  deployResults.push(result);
96
96
  };
97
97
  const upserts = [];
98
- const scraperV1 = new sourceTokenScraper_1.SourceTokenScraper();
99
- const scraperV2 = new sourceTokenScraper_1.SourceTokenScraper();
98
+ const scraper = new sourceTokenScraper_1.SourceTokenScraper();
100
99
  for (const endpoint of changes.endpointsToCreate) {
101
100
  this.logOpStart("creating", endpoint);
102
- upserts.push(handle("create", endpoint, () => this.createEndpoint(endpoint, scraperV1, scraperV2)));
101
+ upserts.push(handle("create", endpoint, () => this.createEndpoint(endpoint, scraper)));
103
102
  }
104
103
  for (const endpoint of changes.endpointsToSkip) {
105
104
  utils.logSuccess(this.getLogSuccessMessage("skip", endpoint));
106
105
  }
107
106
  for (const update of changes.endpointsToUpdate) {
108
107
  this.logOpStart("updating", update.endpoint);
109
- upserts.push(handle("update", update.endpoint, () => this.updateEndpoint(update, scraperV1, scraperV2)));
108
+ upserts.push(handle("update", update.endpoint, () => this.updateEndpoint(update, scraper)));
110
109
  }
111
110
  await utils.allSettled(upserts);
112
111
  if (deployResults.find((r) => r.error)) {
@@ -127,31 +126,31 @@ class Fabricator {
127
126
  await utils.allSettled(deletes);
128
127
  return deployResults;
129
128
  }
130
- async createEndpoint(endpoint, scraperV1, scraperV2) {
129
+ async createEndpoint(endpoint, scraper) {
131
130
  endpoint.labels = Object.assign(Object.assign({}, endpoint.labels), deploymentTool.labels());
132
131
  if (endpoint.platform === "gcfv1") {
133
- await this.createV1Function(endpoint, scraperV1);
132
+ await this.createV1Function(endpoint, scraper);
134
133
  }
135
134
  else if (endpoint.platform === "gcfv2") {
136
- await this.createV2Function(endpoint, scraperV2);
135
+ await this.createV2Function(endpoint);
137
136
  }
138
137
  else {
139
138
  (0, functional_1.assertExhaustive)(endpoint.platform);
140
139
  }
141
140
  await this.setTrigger(endpoint);
142
141
  }
143
- async updateEndpoint(update, scraperV1, scraperV2) {
142
+ async updateEndpoint(update, scraper) {
144
143
  update.endpoint.labels = Object.assign(Object.assign({}, update.endpoint.labels), deploymentTool.labels());
145
144
  if (update.deleteAndRecreate) {
146
145
  await this.deleteEndpoint(update.deleteAndRecreate);
147
- await this.createEndpoint(update.endpoint, scraperV1, scraperV2);
146
+ await this.createEndpoint(update.endpoint, scraper);
148
147
  return;
149
148
  }
150
149
  if (update.endpoint.platform === "gcfv1") {
151
- await this.updateV1Function(update.endpoint, scraperV1);
150
+ await this.updateV1Function(update.endpoint, scraper);
152
151
  }
153
152
  else if (update.endpoint.platform === "gcfv2") {
154
- await this.updateV2Function(update.endpoint, scraperV2);
153
+ await this.updateV2Function(update.endpoint);
155
154
  }
156
155
  else {
157
156
  (0, functional_1.assertExhaustive)(update.endpoint.platform);
@@ -222,7 +221,7 @@ class Fabricator {
222
221
  .catch(rethrowAs(endpoint, "set invoker"));
223
222
  }
224
223
  }
225
- async createV2Function(endpoint, scraper) {
224
+ async createV2Function(endpoint) {
226
225
  var _a, _b, _c, _d, _e;
227
226
  const storageSource = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.storage;
228
227
  if (!storageSource) {
@@ -276,9 +275,8 @@ class Fabricator {
276
275
  while (!resultFunction) {
277
276
  resultFunction = await this.functionExecutor
278
277
  .run(async () => {
279
- apiFunction.buildConfig.sourceToken = await scraper.getToken();
280
278
  const op = await gcfV2.createFunction(apiFunction);
281
- return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `create-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name, onPoll: scraper.poller }));
279
+ return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `create-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name }));
282
280
  })
283
281
  .catch(async (err) => {
284
282
  if (err.code === CLOUD_RUN_RESOURCE_EXHAUSTED_CODE) {
@@ -368,7 +366,7 @@ class Fabricator {
368
366
  .catch(rethrowAs(endpoint, "set invoker"));
369
367
  }
370
368
  }
371
- async updateV2Function(endpoint, scraper) {
369
+ async updateV2Function(endpoint) {
372
370
  var _a, _b, _c, _d;
373
371
  const storageSource = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.storage;
374
372
  if (!storageSource) {
@@ -381,9 +379,8 @@ class Fabricator {
381
379
  }
382
380
  const resultFunction = await this.functionExecutor
383
381
  .run(async () => {
384
- apiFunction.buildConfig.sourceToken = await scraper.getToken();
385
382
  const op = await gcfV2.updateFunction(apiFunction);
386
- return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `update-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name, onPoll: scraper.poller }));
383
+ return await poller.pollOperation(Object.assign(Object.assign({}, gcfV2PollerOptions), { pollerName: `update-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`, operationResourceName: op.name }));
387
384
  }, { retryCodes: [...executor_1.DEFAULT_RETRY_CODES, CLOUD_RUN_RESOURCE_EXHAUSTED_CODE] })
388
385
  .catch(rethrowAs(endpoint, "update"));
389
386
  endpoint.uri = (_c = resultFunction.serviceConfig) === null || _c === void 0 ? void 0 : _c.uri;
@@ -5,9 +5,8 @@ const error_1 = require("../../../error");
5
5
  const functional_1 = require("../../../functional");
6
6
  const logger_1 = require("../../../logger");
7
7
  class SourceTokenScraper {
8
- constructor(validDurationMs = 1500000, fetchTimeoutMs = 180000) {
8
+ constructor(validDurationMs = 1500000) {
9
9
  this.tokenValidDurationMs = validDurationMs;
10
- this.fetchTimeoutMs = fetchTimeoutMs;
11
10
  this.promise = new Promise((resolve) => (this.resolve = resolve));
12
11
  this.fetchState = "NONE";
13
12
  }
@@ -17,13 +16,7 @@ class SourceTokenScraper {
17
16
  return undefined;
18
17
  }
19
18
  else if (this.fetchState === "FETCHING") {
20
- const timeout = new Promise((resolve) => {
21
- setTimeout(() => {
22
- this.fetchState = "NONE";
23
- resolve(undefined);
24
- }, this.fetchTimeoutMs);
25
- });
26
- return Promise.race([this.promise, timeout]);
19
+ return this.promise;
27
20
  }
28
21
  else if (this.fetchState === "VALID") {
29
22
  if (this.isTokenExpired()) {
@@ -333,7 +333,7 @@ async function stop(targetName) {
333
333
  const emulator = get(targetName);
334
334
  return new Promise((resolve, reject) => {
335
335
  const logger = emulatorLogger_1.EmulatorLogger.forEmulator(emulator.name);
336
- if (emulator.instance) {
336
+ if (emulator.instance && emulator.instance.kill(0)) {
337
337
  const killTimeout = setTimeout(() => {
338
338
  const pid = emulator.instance ? emulator.instance.pid : -1;
339
339
  const errorMsg = constants_1.Constants.description(emulator.name) + ": Unable to terminate process (PID=" + pid + ")";
@@ -16,7 +16,7 @@ marked_1.marked.setOptions({
16
16
  renderer: new TerminalRenderer(),
17
17
  });
18
18
  const EXTENSIONS_CHANGELOG = "CHANGELOG.md";
19
- const VERSION_LINE_REGEX = /##.*(\d+\.\d+\.\d+(?:-((\d+|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(\d+|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?).*/;
19
+ const VERSION_LINE_REGEX = /##.+?(\d+\.\d+\.\d+(?:-((\d+|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(\d+|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?).*/;
20
20
  async function getReleaseNotesForUpdate(args) {
21
21
  const releaseNotes = {};
22
22
  const filter = `id<="${args.toVersion}" AND id>"${args.fromVersion}"`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "12.5.1",
3
+ "version": "12.5.3",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -184,7 +184,6 @@ let runtimeBinsPath = path.join(homePath, ".cache", "firebase", "runtime");
184
184
  const npmArgs = [
185
185
  `--script-shell=${runtimeBinsPath}/shell${isWindows ? ".bat" : ""}`,
186
186
  `--globalconfig=${path.join(runtimeBinsPath, "npmrc")}`,
187
- `--userconfig=${path.join(runtimeBinsPath, "npmrc")}`,
188
187
  `--scripts-prepend-node-path=auto`
189
188
  ];
190
189
 
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
14
  "chalk": "^2.4.2",
15
- "npm": "^9.8.0",
15
+ "npm": "^8.19.0",
16
16
  "shelljs": "^0.8.3",
17
17
  "shx": "^0.3.2",
18
18
  "user-home": "^2.0.0"