firebase-tools 10.6.0 → 10.7.0

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.
Files changed (83) hide show
  1. package/lib/command.js +4 -4
  2. package/lib/commands/deploy.js +1 -1
  3. package/lib/commands/emulators-start.js +7 -2
  4. package/lib/commands/ext-configure.js +15 -5
  5. package/lib/commands/ext-export.js +6 -5
  6. package/lib/commands/ext-install.js +28 -44
  7. package/lib/commands/ext-update.js +9 -1
  8. package/lib/commands/functions-delete.js +2 -5
  9. package/lib/commands/hosting-channel-deploy.js +2 -2
  10. package/lib/deploy/database/deploy.js +4 -0
  11. package/lib/deploy/database/index.js +1 -0
  12. package/lib/deploy/extensions/deploy.js +4 -4
  13. package/lib/deploy/extensions/deploymentSummary.js +8 -5
  14. package/lib/deploy/extensions/planner.js +36 -9
  15. package/lib/deploy/extensions/prepare.js +1 -1
  16. package/lib/deploy/extensions/secrets.js +2 -2
  17. package/lib/deploy/extensions/tasks.js +60 -21
  18. package/lib/deploy/functions/backend.js +17 -2
  19. package/lib/deploy/functions/build.js +162 -0
  20. package/lib/deploy/functions/checkIam.js +6 -5
  21. package/lib/deploy/functions/deploy.js +14 -15
  22. package/lib/deploy/functions/ensure.js +4 -4
  23. package/lib/deploy/functions/functionsDeployHelper.js +54 -23
  24. package/lib/deploy/functions/prepare.js +85 -42
  25. package/lib/deploy/functions/prepareFunctionsUpload.js +16 -21
  26. package/lib/deploy/functions/pricing.js +6 -3
  27. package/lib/deploy/functions/prompts.js +1 -7
  28. package/lib/deploy/functions/release/fabricator.js +43 -2
  29. package/lib/deploy/functions/release/index.js +10 -6
  30. package/lib/deploy/functions/release/planner.js +9 -6
  31. package/lib/deploy/functions/release/reporter.js +14 -11
  32. package/lib/deploy/functions/runtimes/discovery/parsing.js +12 -6
  33. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +50 -3
  34. package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +3 -3
  35. package/lib/deploy/functions/runtimes/node/parseTriggers.js +24 -5
  36. package/lib/deploy/functions/runtimes/node/versioning.js +2 -2
  37. package/lib/deploy/functions/services/auth.js +95 -0
  38. package/lib/deploy/functions/services/index.js +41 -21
  39. package/lib/deploy/functions/validate.js +8 -5
  40. package/lib/deploy/hosting/args.js +2 -0
  41. package/lib/deploy/hosting/convertConfig.js +37 -8
  42. package/lib/deploy/hosting/deploy.js +3 -3
  43. package/lib/deploy/hosting/prepare.js +2 -2
  44. package/lib/deploy/hosting/release.js +6 -2
  45. package/lib/deploy/index.js +82 -93
  46. package/lib/deploy/remoteconfig/deploy.js +4 -0
  47. package/lib/deploy/remoteconfig/index.js +3 -1
  48. package/lib/emulator/auth/operations.js +5 -0
  49. package/lib/emulator/auth/utils.js +3 -25
  50. package/lib/emulator/controller.js +5 -5
  51. package/lib/emulator/downloadableEmulators.js +39 -23
  52. package/lib/emulator/extensions/validation.js +2 -2
  53. package/lib/emulator/extensionsEmulator.js +85 -21
  54. package/lib/emulator/functionsEmulator.js +79 -7
  55. package/lib/emulator/functionsEmulatorShared.js +20 -1
  56. package/lib/emulator/registry.js +34 -12
  57. package/lib/emulator/storage/apis/firebase.js +7 -2
  58. package/lib/emulator/storage/apis/gcloud.js +6 -3
  59. package/lib/emulator/storage/files.js +9 -1
  60. package/lib/ensureApiEnabled.js +8 -4
  61. package/lib/extensions/changelog.js +1 -1
  62. package/lib/extensions/emulator/optionsHelper.js +4 -3
  63. package/lib/extensions/emulator/specHelper.js +7 -1
  64. package/lib/extensions/extensionsHelper.js +30 -24
  65. package/lib/extensions/manifest.js +27 -7
  66. package/lib/extensions/paramHelper.js +5 -5
  67. package/lib/extensions/provisioningHelper.js +2 -2
  68. package/lib/extensions/warnings.js +3 -3
  69. package/lib/functions/events/index.js +7 -0
  70. package/lib/functions/events/v1.js +6 -0
  71. package/lib/functions/projectConfig.js +24 -3
  72. package/lib/gcp/cloudfunctions.js +31 -5
  73. package/lib/gcp/cloudfunctionsv2.js +27 -2
  74. package/lib/gcp/identityPlatform.js +44 -0
  75. package/lib/gcp/secretManager.js +1 -1
  76. package/lib/metaprogramming.js +2 -0
  77. package/lib/previews.js +1 -1
  78. package/lib/serve/hosting.js +25 -12
  79. package/lib/serve/index.js +6 -0
  80. package/lib/track.js +15 -21
  81. package/npm-shrinkwrap.json +44 -2
  82. package/package.json +4 -1
  83. package/schema/firebase-config.json +6 -0
package/lib/previews.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.previews = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const configstore_1 = require("./configstore");
6
- exports.previews = Object.assign({ rtdbrules: false, ext: false, extdev: false, extensionsemulator: false, rtdbmanagement: false, functionsv2: false, golang: false, deletegcfartifacts: false, artifactregistry: false, emulatoruisnapshot: false }, configstore_1.configstore.get("previews"));
6
+ exports.previews = Object.assign({ rtdbrules: false, ext: false, extdev: false, extensionsemulator: false, rtdbmanagement: false, functionsv2: false, golang: false, deletegcfartifacts: false, artifactregistry: false, emulatoruisnapshot: false, frameworkawareness: false }, configstore_1.configstore.get("previews"));
7
7
  if (process.env.FIREBASE_CLI_PREVIEWS) {
8
8
  process.env.FIREBASE_CLI_PREVIEWS.split(",").forEach((feature) => {
9
9
  if ((0, lodash_1.has)(exports.previews, feature)) {
@@ -15,6 +15,7 @@ const stream_1 = require("stream");
15
15
  const emulatorLogger_1 = require("../emulator/emulatorLogger");
16
16
  const types_1 = require("../emulator/types");
17
17
  const utils_1 = require("../utils");
18
+ const child_process_1 = require("child_process");
18
19
  const MAX_PORT_ATTEMPTS = 10;
19
20
  let attempts = 0;
20
21
  let destroyServer = undefined;
@@ -31,6 +32,29 @@ function startServer(options, config, port, init) {
31
32
  const morganMiddleware = morgan("combined", {
32
33
  stream: morganStream,
33
34
  });
35
+ const portInUse = () => {
36
+ const message = "Port " + options.port + " is not available.";
37
+ logger.log("WARN", clc.yellow("hosting: ") + message + " Trying another port...");
38
+ if (attempts < MAX_PORT_ATTEMPTS) {
39
+ attempts++;
40
+ startServer(options, config, port + 5, init);
41
+ }
42
+ else {
43
+ logger.log("WARN", message);
44
+ throw new error_1.FirebaseError("Could not find an open port for hosting development server.", {
45
+ exit: 1,
46
+ });
47
+ }
48
+ };
49
+ if (process.platform === "darwin") {
50
+ try {
51
+ (0, child_process_1.execSync)(`lsof -i :${port}`);
52
+ portInUse();
53
+ return;
54
+ }
55
+ catch (e) {
56
+ }
57
+ }
34
58
  const server = superstatic({
35
59
  debug: false,
36
60
  port: port,
@@ -60,18 +84,7 @@ function startServer(options, config, port, init) {
60
84
  destroyServer = (0, utils_1.createDestroyer)(server);
61
85
  server.on("error", (err) => {
62
86
  if (err.code === "EADDRINUSE") {
63
- const message = "Port " + options.port + " is not available.";
64
- logger.log("WARN", clc.yellow("hosting: ") + message + " Trying another port...");
65
- if (attempts < MAX_PORT_ATTEMPTS) {
66
- attempts++;
67
- startServer(options, config, port + 5, init);
68
- }
69
- else {
70
- logger.log("WARN", message);
71
- throw new error_1.FirebaseError("Could not find an open port for hosting development server.", {
72
- exit: 1,
73
- });
74
- }
87
+ portInUse();
75
88
  }
76
89
  else {
77
90
  throw new error_1.FirebaseError("An error occurred while starting the hosting development server:\n\n" + err.toString(), { exit: 1 });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.serve = void 0;
4
4
  const _ = require("lodash");
5
5
  const logger_1 = require("../logger");
6
+ const previews_1 = require("../previews");
6
7
  const { FunctionsServer } = require("./functions");
7
8
  const TARGETS = {
8
9
  hosting: require("./hosting"),
@@ -11,6 +12,11 @@ const TARGETS = {
11
12
  async function serve(options) {
12
13
  const targetNames = options.targets;
13
14
  options.port = parseInt(options.port, 10);
15
+ if (previews_1.previews.frameworkawareness &&
16
+ targetNames.includes("hosting") &&
17
+ [].concat(options.config.get("hosting")).some((it) => it.source)) {
18
+ await require("firebase-frameworks").prepare(targetNames, { project: options.projectId }, options);
19
+ }
14
20
  await Promise.all(_.map(targetNames, (targetName) => {
15
21
  return TARGETS[targetName].start(options);
16
22
  }));
package/lib/track.js CHANGED
@@ -1,31 +1,26 @@
1
1
  "use strict";
2
- var ua = require("universal-analytics");
3
- var _ = require("lodash");
4
- var { configstore } = require("./configstore");
5
- var pkg = require("../package.json");
6
- var uuid = require("uuid");
7
- const { logger } = require("./logger");
8
- var anonId = configstore.get("analytics-uuid");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.track = void 0;
4
+ const ua = require("universal-analytics");
5
+ const uuid_1 = require("uuid");
6
+ const configstore_1 = require("./configstore");
7
+ const pkg = require("../package.json");
8
+ let anonId = configstore_1.configstore.get("analytics-uuid");
9
9
  if (!anonId) {
10
- anonId = uuid.v4();
11
- configstore.set("analytics-uuid", anonId);
10
+ anonId = (0, uuid_1.v4)();
11
+ configstore_1.configstore.set("analytics-uuid", anonId);
12
12
  }
13
- var visitor = ua(process.env.FIREBASE_ANALYTICS_UA || "UA-29174744-3", anonId, {
13
+ const visitor = ua(process.env.FIREBASE_ANALYTICS_UA || "UA-29174744-3", anonId, {
14
14
  strictCidFormat: false,
15
15
  https: true,
16
16
  });
17
17
  visitor.set("cd1", process.platform);
18
18
  visitor.set("cd2", process.version);
19
19
  visitor.set("cd3", process.env.FIREPIT_VERSION || "none");
20
- function track(action, label, duration) {
21
- return new Promise(function (resolve) {
22
- if (!_.isString(action) || !_.isString(label)) {
23
- logger.debug("track received non-string arguments:", action, label);
24
- resolve();
25
- }
26
- duration = duration || 0;
27
- if (configstore.get("tokens") && configstore.get("usage")) {
28
- visitor.event("Firebase CLI " + pkg.version, action, label, duration).send(function () {
20
+ function track(action, label, duration = 0) {
21
+ return new Promise((resolve) => {
22
+ if (configstore_1.configstore.get("tokens") && configstore_1.configstore.get("usage")) {
23
+ visitor.event("Firebase CLI " + pkg.version, action, label, duration).send(() => {
29
24
  resolve();
30
25
  });
31
26
  }
@@ -34,5 +29,4 @@ function track(action, label, duration) {
34
29
  }
35
30
  });
36
31
  }
37
- track.track = track;
38
- module.exports = track;
32
+ exports.track = track;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "firebase-tools",
9
- "version": "10.6.0",
9
+ "version": "10.7.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@google-cloud/pubsub": "^2.18.4",
@@ -30,6 +30,7 @@
30
30
  "exit-code": "^1.0.2",
31
31
  "express": "^4.16.4",
32
32
  "filesize": "^6.1.0",
33
+ "firebase-frameworks": "^0.3.0",
33
34
  "fs-extra": "^5.0.0",
34
35
  "glob": "^7.1.2",
35
36
  "google-auth-library": "^7.11.0",
@@ -114,6 +115,7 @@
114
115
  "@types/tcp-port-used": "^1.0.0",
115
116
  "@types/tmp": "^0.1.0",
116
117
  "@types/triple-beam": "^1.3.0",
118
+ "@types/universal-analytics": "^0.4.5",
117
119
  "@types/unzipper": "^0.10.0",
118
120
  "@types/uuid": "^8.3.1",
119
121
  "@types/ws": "^7.2.3",
@@ -2477,6 +2479,12 @@
2477
2479
  "integrity": "sha512-tl34wMtk3q+fSdRSJ+N83f47IyXLXPPuLjHm7cmAx0fE2Wml2TZCQV3FmQdSR5J6UEGV3qafG054e0cVVFCqPA==",
2478
2480
  "dev": true
2479
2481
  },
2482
+ "node_modules/@types/universal-analytics": {
2483
+ "version": "0.4.5",
2484
+ "resolved": "https://registry.npmjs.org/@types/universal-analytics/-/universal-analytics-0.4.5.tgz",
2485
+ "integrity": "sha512-Opb+Un786PS3te24VtJR/QPmX00P/pXaJQtLQYJklQefP4xP0Ic3mPc2z6SDz97OrITzR+RHTBEwjtNRjZ/nLQ==",
2486
+ "dev": true
2487
+ },
2480
2488
  "node_modules/@types/unzipper": {
2481
2489
  "version": "0.10.0",
2482
2490
  "resolved": "https://registry.npmjs.org/@types/unzipper/-/unzipper-0.10.0.tgz",
@@ -6106,6 +6114,19 @@
6106
6114
  "@firebase/app-types": "0.6.3"
6107
6115
  }
6108
6116
  },
6117
+ "node_modules/firebase-frameworks": {
6118
+ "version": "0.3.0",
6119
+ "resolved": "https://registry.npmjs.org/firebase-frameworks/-/firebase-frameworks-0.3.0.tgz",
6120
+ "integrity": "sha512-Zxtx5WsD8ZZdItIeDjjpM+JgaIWDdwBujmLYLKf2Ou6onyRsd8bNRrnVsqrnq4S3FN9TcNYliXdwMu7AwYdW7Q==",
6121
+ "dependencies": {
6122
+ "tslib": "^2.3.1"
6123
+ }
6124
+ },
6125
+ "node_modules/firebase-frameworks/node_modules/tslib": {
6126
+ "version": "2.3.1",
6127
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
6128
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
6129
+ },
6109
6130
  "node_modules/firebase-functions": {
6110
6131
  "version": "3.18.1",
6111
6132
  "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.18.1.tgz",
@@ -15801,6 +15822,12 @@
15801
15822
  "integrity": "sha512-tl34wMtk3q+fSdRSJ+N83f47IyXLXPPuLjHm7cmAx0fE2Wml2TZCQV3FmQdSR5J6UEGV3qafG054e0cVVFCqPA==",
15802
15823
  "dev": true
15803
15824
  },
15825
+ "@types/universal-analytics": {
15826
+ "version": "0.4.5",
15827
+ "resolved": "https://registry.npmjs.org/@types/universal-analytics/-/universal-analytics-0.4.5.tgz",
15828
+ "integrity": "sha512-Opb+Un786PS3te24VtJR/QPmX00P/pXaJQtLQYJklQefP4xP0Ic3mPc2z6SDz97OrITzR+RHTBEwjtNRjZ/nLQ==",
15829
+ "dev": true
15830
+ },
15804
15831
  "@types/unzipper": {
15805
15832
  "version": "0.10.0",
15806
15833
  "resolved": "https://registry.npmjs.org/@types/unzipper/-/unzipper-0.10.0.tgz",
@@ -18586,6 +18613,21 @@
18586
18613
  }
18587
18614
  }
18588
18615
  },
18616
+ "firebase-frameworks": {
18617
+ "version": "0.3.0",
18618
+ "resolved": "https://registry.npmjs.org/firebase-frameworks/-/firebase-frameworks-0.3.0.tgz",
18619
+ "integrity": "sha512-Zxtx5WsD8ZZdItIeDjjpM+JgaIWDdwBujmLYLKf2Ou6onyRsd8bNRrnVsqrnq4S3FN9TcNYliXdwMu7AwYdW7Q==",
18620
+ "requires": {
18621
+ "tslib": "^2.3.1"
18622
+ },
18623
+ "dependencies": {
18624
+ "tslib": {
18625
+ "version": "2.3.1",
18626
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
18627
+ "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
18628
+ }
18629
+ }
18630
+ },
18589
18631
  "firebase-functions": {
18590
18632
  "version": "3.18.1",
18591
18633
  "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.18.1.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -28,6 +28,7 @@
28
28
  "test:emulator": "./scripts/emulator-tests/run.sh",
29
29
  "test:extensions-deploy": "./scripts/extensions-deploy-tests/run.sh",
30
30
  "test:extensions-emulator": "./scripts/extensions-emulator-tests/run.sh",
31
+ "test:ext-dev-emulator": "./scripts/ext-dev-emulators-tests/run.sh",
31
32
  "test:hosting": "./scripts/hosting-tests/run.sh",
32
33
  "test:triggers-end-to-end": "./scripts/triggers-end-to-end-tests/run.sh",
33
34
  "test:storage-deploy": "./scripts/storage-deploy-tests/run.sh",
@@ -106,6 +107,7 @@
106
107
  "exit-code": "^1.0.2",
107
108
  "express": "^4.16.4",
108
109
  "filesize": "^6.1.0",
110
+ "firebase-frameworks": "^0.3.0",
109
111
  "fs-extra": "^5.0.0",
110
112
  "glob": "^7.1.2",
111
113
  "google-auth-library": "^7.11.0",
@@ -187,6 +189,7 @@
187
189
  "@types/tcp-port-used": "^1.0.0",
188
190
  "@types/tmp": "^0.1.0",
189
191
  "@types/triple-beam": "^1.3.0",
192
+ "@types/universal-analytics": "^0.4.5",
190
193
  "@types/unzipper": "^0.10.0",
191
194
  "@types/uuid": "^8.3.1",
192
195
  "@types/ws": "^7.2.3",
@@ -330,6 +330,9 @@
330
330
  {
331
331
  "additionalProperties": false,
332
332
  "properties": {
333
+ "codebase": {
334
+ "type": "string"
335
+ },
333
336
  "ignore": {
334
337
  "items": {
335
338
  "type": "string"
@@ -381,6 +384,9 @@
381
384
  "items": {
382
385
  "additionalProperties": false,
383
386
  "properties": {
387
+ "codebase": {
388
+ "type": "string"
389
+ },
384
390
  "ignore": {
385
391
  "items": {
386
392
  "type": "string"