firebase-tools 11.4.0 → 11.5.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 (188) hide show
  1. package/README.md +8 -15
  2. package/lib/accountImporter.js +1 -1
  3. package/lib/auth.js +3 -4
  4. package/lib/bin/firebase.js +4 -4
  5. package/lib/command.js +3 -3
  6. package/lib/commands/apps-android-sha-create.js +1 -1
  7. package/lib/commands/apps-android-sha-delete.js +1 -1
  8. package/lib/commands/apps-create.js +1 -1
  9. package/lib/commands/apps-list.js +1 -1
  10. package/lib/commands/auth-export.js +1 -1
  11. package/lib/commands/auth-import.js +1 -1
  12. package/lib/commands/database-instances-list.js +1 -1
  13. package/lib/commands/database-push.js +1 -1
  14. package/lib/commands/database-remove.js +1 -1
  15. package/lib/commands/database-set.js +1 -1
  16. package/lib/commands/database-update.js +1 -1
  17. package/lib/commands/emulators-start.js +1 -1
  18. package/lib/commands/ext-dev-deprecate.js +1 -1
  19. package/lib/commands/ext-dev-emulators-exec.js +1 -1
  20. package/lib/commands/ext-dev-emulators-start.js +1 -1
  21. package/lib/commands/ext-dev-extension-delete.js +1 -1
  22. package/lib/commands/ext-dev-list.js +1 -1
  23. package/lib/commands/ext-dev-publish.js +1 -1
  24. package/lib/commands/ext-dev-register.js +1 -1
  25. package/lib/commands/ext-dev-undeprecate.js +1 -1
  26. package/lib/commands/ext-dev-unpublish.js +1 -1
  27. package/lib/commands/ext-dev-usage.js +1 -1
  28. package/lib/commands/ext-info.js +1 -1
  29. package/lib/commands/ext-install.js +2 -2
  30. package/lib/commands/ext-update.js +1 -1
  31. package/lib/commands/ext.js +1 -1
  32. package/lib/commands/firestore-delete.js +2 -2
  33. package/lib/commands/firestore-indexes-list.js +3 -3
  34. package/lib/commands/functions-config-clone.js +1 -1
  35. package/lib/commands/functions-config-export.js +1 -1
  36. package/lib/commands/functions-config-set.js +1 -1
  37. package/lib/commands/functions-config-unset.js +1 -1
  38. package/lib/commands/functions-delete.js +1 -1
  39. package/lib/commands/functions-secrets-set.js +1 -1
  40. package/lib/commands/help.js +1 -1
  41. package/lib/commands/hosting-channel-create.js +5 -5
  42. package/lib/commands/hosting-channel-delete.js +3 -3
  43. package/lib/commands/hosting-channel-deploy.js +6 -6
  44. package/lib/commands/hosting-channel-list.js +2 -2
  45. package/lib/commands/hosting-channel-open.js +2 -2
  46. package/lib/commands/hosting-clone.js +13 -8
  47. package/lib/commands/hosting-disable.js +1 -1
  48. package/lib/commands/hosting-sites-create.js +4 -4
  49. package/lib/commands/hosting-sites-delete.js +4 -4
  50. package/lib/commands/hosting-sites-list.js +2 -2
  51. package/lib/commands/init.js +5 -5
  52. package/lib/commands/login-add.js +1 -1
  53. package/lib/commands/login-ci.js +4 -2
  54. package/lib/commands/login-list.js +1 -1
  55. package/lib/commands/login-use.js +1 -1
  56. package/lib/commands/login.js +1 -1
  57. package/lib/commands/logout.js +1 -1
  58. package/lib/commands/open.js +3 -3
  59. package/lib/commands/projects-list.js +2 -2
  60. package/lib/commands/serve.js +1 -1
  61. package/lib/commands/target-apply.js +1 -1
  62. package/lib/commands/target-clear.js +1 -1
  63. package/lib/commands/target-remove.js +1 -1
  64. package/lib/commands/target.js +1 -1
  65. package/lib/commands/use.js +7 -7
  66. package/lib/config.js +1 -1
  67. package/lib/deploy/database/prepare.js +3 -3
  68. package/lib/deploy/database/release.js +3 -3
  69. package/lib/deploy/extensions/deploymentSummary.js +1 -1
  70. package/lib/deploy/extensions/errors.js +1 -1
  71. package/lib/deploy/extensions/secrets.js +1 -1
  72. package/lib/deploy/extensions/tasks.js +2 -2
  73. package/lib/deploy/firestore/deploy.js +2 -2
  74. package/lib/deploy/firestore/prepare.js +2 -2
  75. package/lib/deploy/functions/backend.js +7 -5
  76. package/lib/deploy/functions/build.js +110 -95
  77. package/lib/deploy/functions/checkIam.js +3 -3
  78. package/lib/deploy/functions/containerCleaner.js +2 -2
  79. package/lib/deploy/functions/deploy.js +2 -2
  80. package/lib/deploy/functions/ensure.js +2 -2
  81. package/lib/deploy/functions/params.js +5 -2
  82. package/lib/deploy/functions/prepare.js +4 -4
  83. package/lib/deploy/functions/prepareFunctionsUpload.js +2 -2
  84. package/lib/deploy/functions/pricing.js +3 -2
  85. package/lib/deploy/functions/prompts.js +2 -2
  86. package/lib/deploy/functions/release/fabricator.js +10 -9
  87. package/lib/deploy/functions/release/index.js +1 -1
  88. package/lib/deploy/functions/release/reporter.js +1 -1
  89. package/lib/deploy/functions/runtimes/discovery/parsing.js +19 -8
  90. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +112 -107
  91. package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
  92. package/lib/deploy/functions/runtimes/node/parseTriggers.js +54 -26
  93. package/lib/deploy/functions/runtimes/node/versioning.js +4 -4
  94. package/lib/deploy/functions/services/storage.js +6 -0
  95. package/lib/deploy/functions/validate.js +1 -1
  96. package/lib/deploy/hosting/convertConfig.js +13 -2
  97. package/lib/deploy/hosting/deploy.js +11 -10
  98. package/lib/deploy/hosting/uploader.js +2 -2
  99. package/lib/deploy/hosting/validate.js +2 -2
  100. package/lib/deploy/index.js +7 -7
  101. package/lib/deploy/lifecycleHooks.js +5 -2
  102. package/lib/deploy/storage/prepare.js +5 -3
  103. package/lib/deploy/storage/release.js +7 -6
  104. package/lib/emulator/commandUtils.js +1 -1
  105. package/lib/emulator/controller.js +1 -1
  106. package/lib/emulator/databaseEmulator.js +1 -1
  107. package/lib/emulator/downloadableEmulators.js +1 -1
  108. package/lib/emulator/emulatorLogger.js +1 -1
  109. package/lib/emulator/extensionsEmulator.js +2 -2
  110. package/lib/emulator/firestoreEmulator.js +1 -1
  111. package/lib/emulator/functionsEmulator.js +22 -10
  112. package/lib/emulator/functionsEmulatorShared.js +6 -11
  113. package/lib/emulator/loggingEmulator.js +2 -2
  114. package/lib/emulator/storage/apis/firebase.js +13 -1
  115. package/lib/emulator/storage/apis/gcloud.js +15 -8
  116. package/lib/emulator/storage/files.js +26 -24
  117. package/lib/emulator/storage/metadata.js +6 -6
  118. package/lib/emulator/storage/multipart.js +4 -3
  119. package/lib/emulator/storage/persistence.js +26 -12
  120. package/lib/emulator/storage/rules/runtime.js +1 -1
  121. package/lib/emulator/storage/rules/utils.js +4 -2
  122. package/lib/emulator/types.js +1 -0
  123. package/lib/ensureApiEnabled.js +7 -7
  124. package/lib/extensions/askUserForConsent.js +1 -1
  125. package/lib/extensions/askUserForEventsConfig.js +1 -1
  126. package/lib/extensions/askUserForParam.js +1 -1
  127. package/lib/extensions/changelog.js +2 -2
  128. package/lib/extensions/checkProjectBilling.js +2 -2
  129. package/lib/extensions/displayExtensionInfo.js +2 -102
  130. package/lib/extensions/emulator/triggerHelper.js +2 -2
  131. package/lib/extensions/extensionsApi.js +1 -1
  132. package/lib/extensions/extensionsHelper.js +1 -1
  133. package/lib/extensions/listExtensions.js +1 -1
  134. package/lib/extensions/manifest.js +1 -1
  135. package/lib/extensions/metricsUtils.js +1 -1
  136. package/lib/extensions/paramHelper.js +1 -1
  137. package/lib/extensions/updateHelper.js +3 -9
  138. package/lib/extensions/warnings.js +2 -2
  139. package/lib/fetchMOTD.js +1 -1
  140. package/lib/firestore/delete.js +1 -1
  141. package/lib/firestore/indexes.js +2 -2
  142. package/lib/firestore/validator.js +1 -1
  143. package/lib/functional.js +16 -1
  144. package/lib/functions/env.js +3 -3
  145. package/lib/functions/runtimeConfigExport.js +1 -1
  146. package/lib/functionsConfig.js +1 -1
  147. package/lib/functionsConfigClone.js +1 -1
  148. package/lib/functionsShellCommandAction.js +1 -1
  149. package/lib/gcp/cloudfunctions.js +24 -11
  150. package/lib/gcp/cloudfunctionsv2.js +48 -24
  151. package/lib/gcp/cloudscheduler.js +58 -22
  152. package/lib/gcp/cloudtasks.js +21 -4
  153. package/lib/gcp/proto.js +18 -6
  154. package/lib/gcp/resourceManager.js +25 -3
  155. package/lib/gcp/serviceusage.js +2 -2
  156. package/lib/handlePreviewToggles.js +4 -4
  157. package/lib/hosting/implicitInit.js +1 -1
  158. package/lib/hosting/normalizedHostingConfigs.js +3 -3
  159. package/lib/index.js +3 -3
  160. package/lib/init/features/database.js +1 -1
  161. package/lib/init/features/emulators.js +1 -1
  162. package/lib/init/features/firestore/index.js +2 -2
  163. package/lib/init/features/firestore/indexes.js +1 -1
  164. package/lib/init/features/firestore/rules.js +1 -1
  165. package/lib/init/features/functions/golang.js +1 -1
  166. package/lib/init/features/functions/index.js +8 -1
  167. package/lib/init/features/hosting/github.js +9 -9
  168. package/lib/init/features/hosting/index.js +1 -1
  169. package/lib/init/features/project.js +1 -1
  170. package/lib/init/features/remoteconfig.js +1 -1
  171. package/lib/init/features/storage.js +1 -1
  172. package/lib/init/index.js +1 -1
  173. package/lib/logError.js +3 -3
  174. package/lib/management/projects.js +1 -1
  175. package/lib/parseBoltRules.js +1 -1
  176. package/lib/previews.js +1 -1
  177. package/lib/profileReport.js +2 -2
  178. package/lib/projectUtils.js +1 -1
  179. package/lib/rc.js +1 -1
  180. package/lib/requireAuth.js +5 -1
  181. package/lib/requireDatabaseInstance.js +2 -2
  182. package/lib/requirePermissions.js +2 -2
  183. package/lib/rulesDeploy.js +49 -13
  184. package/lib/serve/hosting.js +2 -1
  185. package/lib/utils.js +10 -10
  186. package/npm-shrinkwrap.json +26 -295
  187. package/package.json +8 -5
  188. package/templates/hosting/init.js +6 -2
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const cli_color_1 = require("cli-color");
4
+ const colorette_1 = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const error_1 = require("../error");
7
7
  const api_1 = require("../hosting/api");
@@ -40,7 +40,7 @@ exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
40
40
  }
41
41
  channelId = (0, api_1.normalizeName)(channelId);
42
42
  if (channelId.toLowerCase().trim() === "live") {
43
- throw new error_1.FirebaseError(`Cannot deploy to the ${(0, cli_color_1.bold)("live")} channel using this command. Please use ${(0, cli_color_1.bold)((0, cli_color_1.yellow)("firebase deploy"))} instead.`);
43
+ throw new error_1.FirebaseError(`Cannot deploy to the ${(0, colorette_1.bold)("live")} channel using this command. Please use ${(0, colorette_1.bold)((0, colorette_1.yellow)("firebase deploy"))} instead.`);
44
44
  }
45
45
  if (options.only) {
46
46
  options.only = options.only
@@ -77,7 +77,7 @@ exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
77
77
  else {
78
78
  chan = await (0, api_1.createChannel)(projectId, site, channelId, expireTTL);
79
79
  logger_1.logger.debug("[hosting] created new channnel for site", site, chan);
80
- (0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, cli_color_1.bold)(channelId)} has been created on site ${(0, cli_color_1.bold)(site)}.`);
80
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, colorette_1.bold)(channelId)} has been created on site ${(0, colorette_1.bold)(site)}.`);
81
81
  }
82
82
  siteInfo.url = chan.url;
83
83
  siteInfo.expireTime = chan.expireTime;
@@ -105,7 +105,7 @@ exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
105
105
  deploys[d.target || d.site] = d;
106
106
  let expires = "";
107
107
  if (d.expireTime) {
108
- expires = `[expires ${(0, cli_color_1.bold)((0, utils_1.datetimeString)(new Date(d.expireTime)))}]`;
108
+ expires = `[expires ${(0, colorette_1.bold)((0, utils_1.datetimeString)(new Date(d.expireTime)))}]`;
109
109
  }
110
110
  const versionPrefix = `sites/${d.site}/versions/`;
111
111
  const versionName = versionNames.find((v) => {
@@ -114,9 +114,9 @@ exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
114
114
  let version = "";
115
115
  if (versionName) {
116
116
  d.version = versionName.replace(versionPrefix, "");
117
- version = ` [version ${(0, cli_color_1.bold)(d.version)}]`;
117
+ version = ` [version ${(0, colorette_1.bold)(d.version)}]`;
118
118
  }
119
- (0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel URL (${(0, cli_color_1.bold)(d.site || d.target)}): ${d.url} ${expires}${version}`);
119
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel URL (${(0, colorette_1.bold)(d.site || d.target || "")}): ${d.url} ${expires}${version}`);
120
120
  });
121
121
  return deploys;
122
122
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const cli_color_1 = require("cli-color");
4
+ const colorette_1 = require("colorette");
5
5
  const Table = require("cli-table");
6
6
  const api_1 = require("../hosting/api");
7
7
  const command_1 = require("../command");
@@ -33,7 +33,7 @@ exports.command = new command_1.Command("hosting:channel:list")
33
33
  ]);
34
34
  }
35
35
  logger_1.logger.info();
36
- logger_1.logger.info(`Channels for site ${(0, cli_color_1.bold)(siteId)}`);
36
+ logger_1.logger.info(`Channels for site ${(0, colorette_1.bold)(siteId)}`);
37
37
  logger_1.logger.info();
38
38
  logger_1.logger.info(table.toString());
39
39
  return { channels };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const lodash_1 = require("lodash");
5
- const cli_color_1 = require("cli-color");
5
+ const colorette_1 = require("colorette");
6
6
  const open = require("open");
7
7
  const command_1 = require("../command");
8
8
  const error_1 = require("../error");
@@ -38,7 +38,7 @@ exports.command = new command_1.Command("hosting:channel:open [channelId]")
38
38
  channelId = (0, api_1.normalizeName)(channelId);
39
39
  const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
40
40
  if (!channel) {
41
- throw new error_1.FirebaseError(`Could not find the channel ${(0, cli_color_1.bold)(channelId)} for site ${(0, cli_color_1.bold)(siteId)}.`);
41
+ throw new error_1.FirebaseError(`Could not find the channel ${(0, colorette_1.bold)(channelId)} for site ${(0, colorette_1.bold)(siteId)}.`);
42
42
  }
43
43
  (0, utils_1.logLabeledBullet)("hosting:channel", channel.url);
44
44
  if (!options.nonInteractive) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const cli_color_1 = require("cli-color");
4
+ const colorette_1 = require("colorette");
5
5
  const ora = require("ora");
6
6
  const command_1 = require("../command");
7
7
  const error_1 = require("../error");
@@ -12,6 +12,11 @@ const { marked } = require("marked");
12
12
  const logger_1 = require("../logger");
13
13
  exports.command = new command_1.Command("hosting:clone <source> <targetChannel>")
14
14
  .description("clone a version from one site to another")
15
+ .help(`<source> and <targetChannel> accept the following format: <siteId>:<channelId>
16
+
17
+ For example, to copy the content for a site \`my-site\` from a preview channel \`staging\` to a \`live\` channel, the command would look be:
18
+
19
+ firebase hosting:clone my-site:foo my-site:live`)
15
20
  .before(requireAuth_1.requireAuth)
16
21
  .action(async (source = "", targetChannel = "") => {
17
22
  var _a, _b, _c, _d;
@@ -41,21 +46,21 @@ exports.command = new command_1.Command("hosting:clone <source> <targetChannel>"
41
46
  if (!sourceVersionName) {
42
47
  const sChannel = await (0, api_1.getChannel)("-", sourceSiteId, sourceChannelId);
43
48
  if (!sChannel) {
44
- throw new error_1.FirebaseError(`Could not find the channel ${(0, cli_color_1.bold)(sourceChannelId)} for site ${(0, cli_color_1.bold)(sourceSiteId)}.`);
49
+ throw new error_1.FirebaseError(`Could not find the channel ${(0, colorette_1.bold)(sourceChannelId)} for site ${(0, colorette_1.bold)(sourceSiteId)}.`);
45
50
  }
46
51
  sourceVersionName = (_b = (_a = sChannel.release) === null || _a === void 0 ? void 0 : _a.version) === null || _b === void 0 ? void 0 : _b.name;
47
52
  if (!sourceVersionName) {
48
- throw new error_1.FirebaseError(`Could not find a version on the channel ${(0, cli_color_1.bold)(sourceChannelId)} for site ${(0, cli_color_1.bold)(sourceSiteId)}.`);
53
+ throw new error_1.FirebaseError(`Could not find a version on the channel ${(0, colorette_1.bold)(sourceChannelId)} for site ${(0, colorette_1.bold)(sourceSiteId)}.`);
49
54
  }
50
55
  }
51
56
  let tChannel = await (0, api_1.getChannel)("-", targetSiteId, targetChannelId);
52
57
  if (!tChannel) {
53
- utils.logBullet(`could not find channel ${(0, cli_color_1.bold)(targetChannelId)} in site ${(0, cli_color_1.bold)(targetSiteId)}, creating it...`);
58
+ utils.logBullet(`could not find channel ${(0, colorette_1.bold)(targetChannelId)} in site ${(0, colorette_1.bold)(targetSiteId)}, creating it...`);
54
59
  try {
55
60
  tChannel = await (0, api_1.createChannel)("-", targetSiteId, targetChannelId);
56
61
  }
57
62
  catch (e) {
58
- throw new error_1.FirebaseError(`Could not create the channel ${(0, cli_color_1.bold)(targetChannelId)} for site ${(0, cli_color_1.bold)(targetSiteId)}.`, { original: e });
63
+ throw new error_1.FirebaseError(`Could not create the channel ${(0, colorette_1.bold)(targetChannelId)} for site ${(0, colorette_1.bold)(targetSiteId)}.`, { original: e });
59
64
  }
60
65
  utils.logSuccess(`Created new channel ${targetChannelId}`);
61
66
  try {
@@ -69,7 +74,7 @@ exports.command = new command_1.Command("hosting:clone <source> <targetChannel>"
69
74
  }
70
75
  const currentTargetVersionName = (_d = (_c = tChannel.release) === null || _c === void 0 ? void 0 : _c.version) === null || _d === void 0 ? void 0 : _d.name;
71
76
  if (equalSiteIds && sourceVersionName === currentTargetVersionName) {
72
- utils.logSuccess(`Channels ${(0, cli_color_1.bold)(sourceChannelId)} and ${(0, cli_color_1.bold)(targetChannel)} are serving identical versions. No need to clone.`);
77
+ utils.logSuccess(`Channels ${(0, colorette_1.bold)(sourceChannelId)} and ${(0, colorette_1.bold)(targetChannel)} are serving identical versions. No need to clone.`);
73
78
  return;
74
79
  }
75
80
  let targetVersionName = sourceVersionName;
@@ -78,7 +83,7 @@ exports.command = new command_1.Command("hosting:clone <source> <targetChannel>"
78
83
  if (!equalSiteIds) {
79
84
  const targetVersion = await (0, api_1.cloneVersion)(targetSiteId, sourceVersionName, true);
80
85
  if (!targetVersion) {
81
- throw new error_1.FirebaseError(`Could not clone the version ${(0, cli_color_1.bold)(sourceVersion)} for site ${(0, cli_color_1.bold)(targetSiteId)}.`);
86
+ throw new error_1.FirebaseError(`Could not clone the version ${(0, colorette_1.bold)(sourceVersion)} for site ${(0, colorette_1.bold)(targetSiteId)}.`);
82
87
  }
83
88
  targetVersionName = targetVersion.name;
84
89
  }
@@ -89,7 +94,7 @@ exports.command = new command_1.Command("hosting:clone <source> <targetChannel>"
89
94
  throw err;
90
95
  }
91
96
  spinner.succeed();
92
- utils.logSuccess(`Site ${(0, cli_color_1.bold)(sourceSiteId)} ${sourceChannelId ? "channel" : "version"} ${(0, cli_color_1.bold)(sourceChannelId || sourceVersion)} has been cloned to site ${(0, cli_color_1.bold)(targetSiteId)} channel ${(0, cli_color_1.bold)(targetChannelId)}.`);
97
+ utils.logSuccess(`Site ${(0, colorette_1.bold)(sourceSiteId)} ${sourceChannelId ? "channel" : "version"} ${(0, colorette_1.bold)(sourceChannelId || sourceVersion)} has been cloned to site ${(0, colorette_1.bold)(targetSiteId)} channel ${(0, colorette_1.bold)(targetChannelId)}.`);
93
98
  utils.logSuccess(`Channel URL (${targetChannelId}): ${tChannel.url}`);
94
99
  });
95
100
  function parseProjectId(name) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const apiv2_1 = require("../apiv2");
6
6
  const command_1 = require("../command");
7
7
  const api_1 = require("../api");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const cli_color_1 = require("cli-color");
4
+ const colorette_1 = require("colorette");
5
5
  const utils_1 = require("../utils");
6
6
  const command_1 = require("../command");
7
7
  const api_1 = require("../hosting/api");
@@ -37,14 +37,14 @@ exports.command = new command_1.Command("hosting:sites:create [siteId]")
37
37
  }
38
38
  catch (e) {
39
39
  if (e.status === 409) {
40
- throw new error_1.FirebaseError(`Site ${(0, cli_color_1.bold)(siteId)} already exists in project ${(0, cli_color_1.bold)(projectId)}.`, { original: e });
40
+ throw new error_1.FirebaseError(`Site ${(0, colorette_1.bold)(siteId)} already exists in project ${(0, colorette_1.bold)(projectId)}.`, { original: e });
41
41
  }
42
42
  throw e;
43
43
  }
44
44
  logger_1.logger.info();
45
- (0, utils_1.logLabeledSuccess)(LOG_TAG, `Site ${(0, cli_color_1.bold)(siteId)} has been created in project ${(0, cli_color_1.bold)(projectId)}.`);
45
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Site ${(0, colorette_1.bold)(siteId)} has been created in project ${(0, colorette_1.bold)(projectId)}.`);
46
46
  if (appId) {
47
- (0, utils_1.logLabeledSuccess)(LOG_TAG, `Site ${(0, cli_color_1.bold)(siteId)} has been linked to web app ${(0, cli_color_1.bold)(appId)}`);
47
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Site ${(0, colorette_1.bold)(siteId)} has been linked to web app ${(0, colorette_1.bold)(appId)}`);
48
48
  }
49
49
  (0, utils_1.logLabeledSuccess)(LOG_TAG, `Site URL: ${site.defaultUrl}`);
50
50
  logger_1.logger.info();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const cli_color_1 = require("cli-color");
4
+ const colorette_1 = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const utils_1 = require("../utils");
7
7
  const api_1 = require("../hosting/api");
@@ -22,12 +22,12 @@ exports.command = new command_1.Command("hosting:sites:delete <siteId>")
22
22
  if (!siteId) {
23
23
  throw new error_1.FirebaseError("siteId is required");
24
24
  }
25
- logger_1.logger.info(`Deleting a site is a permanent action. If you delete a site, Firebase doesn't maintain records of deployed files or deployment history, and the site ${(0, cli_color_1.underline)(siteId)} cannot be reactivated by you or anyone else.`);
25
+ logger_1.logger.info(`Deleting a site is a permanent action. If you delete a site, Firebase doesn't maintain records of deployed files or deployment history, and the site ${(0, colorette_1.underline)(siteId)} cannot be reactivated by you or anyone else.`);
26
26
  logger_1.logger.info();
27
27
  const confirmed = await (0, prompt_1.promptOnce)({
28
28
  name: "force",
29
29
  type: "confirm",
30
- message: `Are you sure you want to delete the Hosting site ${(0, cli_color_1.underline)(siteId)} for project ${(0, cli_color_1.underline)(projectId)}? `,
30
+ message: `Are you sure you want to delete the Hosting site ${(0, colorette_1.underline)(siteId)} for project ${(0, colorette_1.underline)(projectId)}? `,
31
31
  default: false,
32
32
  }, options);
33
33
  if (!confirmed) {
@@ -35,5 +35,5 @@ exports.command = new command_1.Command("hosting:sites:delete <siteId>")
35
35
  }
36
36
  await (0, api_1.getSite)(projectId, siteId);
37
37
  await (0, api_1.deleteSite)(projectId, siteId);
38
- (0, utils_1.logLabeledSuccess)(LOG_TAG, `Successfully deleted site ${(0, cli_color_1.bold)(siteId)} from project ${(0, cli_color_1.bold)(projectId)}`);
38
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Successfully deleted site ${(0, colorette_1.bold)(siteId)} from project ${(0, colorette_1.bold)(projectId)}`);
39
39
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const cli_color_1 = require("cli-color");
4
+ const colorette_1 = require("colorette");
5
5
  const Table = require("cli-table");
6
6
  const command_1 = require("../command");
7
7
  const api_1 = require("../hosting/api");
@@ -21,7 +21,7 @@ exports.command = new command_1.Command("hosting:sites:list")
21
21
  table.push([siteId, site.defaultUrl, site.appId || "--"]);
22
22
  }
23
23
  logger_1.logger.info();
24
- logger_1.logger.info(`Sites for project ${(0, cli_color_1.bold)(projectId)}`);
24
+ logger_1.logger.info(`Sites for project ${(0, colorette_1.bold)(projectId)}`);
25
25
  logger_1.logger.info();
26
26
  logger_1.logger.info(table.toString());
27
27
  return { sites };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const fs = require("fs");
6
6
  const os = require("os");
7
7
  const path = require("path");
@@ -100,11 +100,11 @@ exports.command = new command_1.Command("init [feature]")
100
100
  if (warnings.length) {
101
101
  warningText =
102
102
  "\nBefore we get started, keep in mind:\n\n " +
103
- clc.yellow.bold("* ") +
104
- warnings.join("\n " + clc.yellow.bold("* ")) +
103
+ clc.yellow(clc.bold("* ")) +
104
+ warnings.join("\n " + clc.yellow(clc.bold("* "))) +
105
105
  "\n";
106
106
  }
107
- logger_1.logger.info(clc.yellow.bold(BANNER_TEXT) +
107
+ logger_1.logger.info(clc.yellow(clc.bold(BANNER_TEXT)) +
108
108
  "\nYou're about to initialize a Firebase project in this directory:\n\n " +
109
109
  clc.bold(config.projectDir) +
110
110
  "\n" +
@@ -150,7 +150,7 @@ exports.command = new command_1.Command("init [feature]")
150
150
  var _a;
151
151
  if (!setup.features || ((_a = setup.features) === null || _a === void 0 ? void 0 : _a.length) === 0) {
152
152
  return utils.reject("Must select at least one feature. Use " +
153
- clc.bold.underline("SPACEBAR") +
153
+ clc.bold(clc.underline("SPACEBAR")) +
154
154
  " to select features, or specify a feature by running " +
155
155
  clc.bold("firebase init [feature_name]"));
156
156
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const logger_1 = require("../logger");
7
7
  const utils = require("../utils");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const error_1 = require("../error");
7
7
  const logger_1 = require("../logger");
@@ -14,10 +14,12 @@ exports.command = new command_1.Command("login:ci")
14
14
  if (options.nonInteractive) {
15
15
  throw new error_1.FirebaseError("Cannot run login:ci in non-interactive mode.");
16
16
  }
17
+ utils.logWarning("Authenticating with a `login:ci` token is deprecated and will be removed in a future major version of `firebase-tools`. " +
18
+ "Instead, use a service account key with `GOOGLE_APPLICATION_CREDENTIALS`: https://cloud.google.com/docs/authentication/getting-started");
17
19
  const userCredentials = await auth.loginGoogle(options.localhost);
18
20
  logger_1.logger.info();
19
21
  utils.logSuccess("Success! Use this token to login on a CI server:\n\n" +
20
- clc.bold(userCredentials.tokens.refresh_token) +
22
+ clc.bold(userCredentials.tokens.refresh_token || "") +
21
23
  '\n\nExample: firebase deploy --token "$FIREBASE_TOKEN"\n');
22
24
  return userCredentials;
23
25
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const logger_1 = require("../logger");
7
7
  const utils = require("../utils");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const utils = require("../utils");
7
7
  const auth = require("../auth");
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const _ = require("lodash");
5
- const clc = require("cli-color");
5
+ const clc = require("colorette");
6
6
  const command_1 = require("../command");
7
7
  const logger_1 = require("../logger");
8
8
  const configstore_1 = require("../configstore");
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const command_1 = require("../command");
5
5
  const logger_1 = require("../logger");
6
- const clc = require("cli-color");
6
+ const clc = require("colorette");
7
7
  const utils = require("../utils");
8
8
  const auth = require("../auth");
9
9
  const prompt_1 = require("../prompt");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const open = require("open");
6
6
  const error_1 = require("../error");
7
7
  const api = require("../api");
@@ -79,10 +79,10 @@ exports.command = new command_1.Command("open [link]")
79
79
  throw new error_1.FirebaseError(`Unable to determine URL for link: ${link}`);
80
80
  }
81
81
  if (link.arg !== linkName) {
82
- logger_1.logger.info(`${clc.bold.cyan("Tip:")} You can also run ${clc.bold.underline(`firebase open ${link.arg}`)}`);
82
+ logger_1.logger.info(`${clc.bold(clc.cyan("Tip:"))} You can also run ${clc.bold(clc.underline(`firebase open ${link.arg}`))}`);
83
83
  logger_1.logger.info();
84
84
  }
85
85
  logger_1.logger.info(`Opening ${clc.bold(link.name)} link in your default browser:`);
86
- logger_1.logger.info(clc.bold.underline(url));
86
+ logger_1.logger.info(clc.bold(clc.underline(url)));
87
87
  open(url);
88
88
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const ora = require("ora");
6
6
  const Table = require("cli-table");
7
7
  const command_1 = require("../command");
@@ -22,7 +22,7 @@ function logProjectsList(projects, currentProjectId) {
22
22
  const table = new Table({ head: tableHead, style: { head: ["green"] } });
23
23
  projects.forEach(({ projectId, projectNumber, displayName, resources }) => {
24
24
  if (projectId === currentProjectId) {
25
- projectId = clc.cyan.bold(`${projectId} (current)`);
25
+ projectId = clc.cyan(clc.bold(`${projectId} (current)`));
26
26
  }
27
27
  table.push([
28
28
  displayName || NOT_SPECIFIED,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const logger_1 = require("../logger");
7
7
  const utils = require("../utils");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const logger_1 = require("../logger");
7
7
  const requireConfig_1 = require("../requireConfig");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const requireConfig_1 = require("../requireConfig");
7
7
  const utils = require("../utils");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const requireConfig_1 = require("../requireConfig");
7
7
  const utils = require("../utils");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const logger_1 = require("../logger");
7
7
  const requireConfig_1 = require("../requireConfig");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const command_1 = require("../command");
6
6
  const projects_1 = require("../management/projects");
7
7
  const logger_1 = require("../logger");
@@ -11,12 +11,12 @@ const command_2 = require("../command");
11
11
  const utils = require("../utils");
12
12
  function listAliases(options) {
13
13
  if (options.rc.hasProjects) {
14
- logger_1.logger.info("Project aliases for", clc.bold(options.projectRoot) + ":");
14
+ logger_1.logger.info("Project aliases for", clc.bold(options.projectRoot || "") + ":");
15
15
  logger_1.logger.info();
16
16
  for (const [alias, projectId] of Object.entries(options.rc.projects)) {
17
17
  const listing = alias + " (" + projectId + ")";
18
18
  if (options.project === projectId || options.projectAlias === alias) {
19
- logger_1.logger.info(clc.cyan.bold("* " + listing));
19
+ logger_1.logger.info(clc.cyan(clc.bold("* " + listing)));
20
20
  }
21
21
  else {
22
22
  logger_1.logger.info(" " + listing);
@@ -121,8 +121,8 @@ exports.command = new command_1.Command("use [alias_or_project_id]")
121
121
  options.rc.addProjectAlias(results.alias, results.project);
122
122
  utils.makeActiveProject(options.projectRoot, results.alias);
123
123
  logger_1.logger.info();
124
- logger_1.logger.info("Created alias", clc.bold(results.alias), "for", results.project + ".");
125
- logger_1.logger.info("Now using alias", clc.bold(results.alias) + " (" + results.project + ")");
124
+ logger_1.logger.info("Created alias", clc.bold(results.alias || ""), "for", results.project + ".");
125
+ logger_1.logger.info("Now using alias", clc.bold(results.alias || "") + " (" + results.project + ")");
126
126
  });
127
127
  });
128
128
  }
@@ -143,10 +143,10 @@ exports.command = new command_1.Command("use [alias_or_project_id]")
143
143
  return utils.reject("No active project");
144
144
  }
145
145
  if (options.projectAlias) {
146
- logger_1.logger.info("Active Project:", clc.bold.cyan(options.projectAlias + " (" + options.project + ")"));
146
+ logger_1.logger.info("Active Project:", clc.bold(clc.cyan(options.projectAlias + " (" + options.project + ")")));
147
147
  }
148
148
  else if (options.project) {
149
- logger_1.logger.info("Active Project:", clc.bold.cyan(options.project));
149
+ logger_1.logger.info("Active Project:", clc.bold(clc.cyan(options.project)));
150
150
  }
151
151
  else {
152
152
  let msg = "No project is currently active";
package/lib/config.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Config = void 0;
4
4
  const _ = require("lodash");
5
- const clc = require("cli-color");
5
+ const clc = require("colorette");
6
6
  const fs = require("fs-extra");
7
7
  const path = require("path");
8
8
  const cjson = require("cjson");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prepare = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const path = require("path");
6
6
  const error_1 = require("../../error");
7
7
  const parseBoltRules_1 = require("../../parseBoltRules");
@@ -39,12 +39,12 @@ function prepare(context, options) {
39
39
  deploys: deploys,
40
40
  ruleFiles: ruleFiles,
41
41
  };
42
- utils.logBullet(clc.bold.cyan("database: ") + "checking rules syntax...");
42
+ utils.logBullet(clc.bold(clc.cyan("database: ")) + "checking rules syntax...");
43
43
  return Promise.all(deploys.map((deploy) => {
44
44
  return rtdb
45
45
  .updateRules(context.projectId, deploy.instance, ruleFiles[deploy.rules], { dryRun: true })
46
46
  .then(() => {
47
- utils.logSuccess(clc.bold.green("database: ") +
47
+ utils.logSuccess(clc.bold(clc.green("database: ")) +
48
48
  "rules syntax for database " +
49
49
  clc.bold(deploy.instance) +
50
50
  " is valid");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.release = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const rtdb = require("../../rtdb");
6
6
  const utils = require("../../utils");
7
7
  function release(context) {
@@ -13,14 +13,14 @@ function release(context) {
13
13
  }
14
14
  const deploys = context.database.deploys;
15
15
  const ruleFiles = context.database.ruleFiles;
16
- utils.logBullet(clc.bold.cyan("database: ") + "releasing rules...");
16
+ utils.logBullet(clc.bold(clc.cyan("database: ")) + "releasing rules...");
17
17
  return Promise.all(deploys.map((deploy) => {
18
18
  return rtdb
19
19
  .updateRules(context.projectId, deploy.instance, ruleFiles[deploy.rules], {
20
20
  dryRun: false,
21
21
  })
22
22
  .then(() => {
23
- utils.logSuccess(clc.bold.green("database: ") +
23
+ utils.logSuccess(clc.bold(clc.green("database: ")) +
24
24
  "rules for database " +
25
25
  clc.bold(deploy.instance) +
26
26
  " released successfully");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deletesSummary = exports.configuresSummary = exports.updatesSummary = exports.createsSummary = exports.humanReadable = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const refs = require("../../extensions/refs");
6
6
  const humanReadable = (dep) => `${clc.bold(dep.instanceId)} (${dep.ref ? `${refs.toExtensionVersionRef(dep.ref)}` : `Installed from local source`})`;
7
7
  exports.humanReadable = humanReadable;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ErrorHandler = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const logger_1 = require("../../logger");
6
6
  class ErrorHandler {
7
7
  constructor() {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkSpecForSecrets = exports.handleSecretParams = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const secretUtils = require("../../extensions/secretsUtils");
6
6
  const secretManager = require("../../gcp/secretManager");
7
7
  const planner_1 = require("./planner");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deleteExtensionInstanceTask = exports.configureExtensionInstanceTask = exports.updateExtensionInstanceTask = exports.createExtensionInstanceTask = exports.extensionsDeploymentHandler = void 0;
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const error_1 = require("../../error");
6
6
  const extensionsApi = require("../../extensions/extensionsApi");
7
7
  const extensionsHelper_1 = require("../../extensions/extensionsHelper");
@@ -146,5 +146,5 @@ function deleteExtensionInstanceTask(projectId, instanceSpec) {
146
146
  exports.deleteExtensionInstanceTask = deleteExtensionInstanceTask;
147
147
  function printSuccess(instanceId, type, validateOnly) {
148
148
  const action = validateOnly ? `validated ${type} for` : `${type}d`;
149
- utils.logSuccess(clc.bold.green("extensions") + ` Successfully ${action} ${instanceId}`);
149
+ utils.logSuccess(clc.bold(clc.green("extensions")) + ` Successfully ${action} ${instanceId}`);
150
150
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _ = require("lodash");
4
- const clc = require("cli-color");
4
+ const clc = require("colorette");
5
5
  const error_1 = require("../../error");
6
6
  const indexes_1 = require("../../firestore/indexes");
7
7
  const logger_1 = require("../../logger");
@@ -30,7 +30,7 @@ async function deployIndexes(context, options) {
30
30
  }
31
31
  const fieldOverrides = indexesSrc.fieldOverrides || [];
32
32
  await new indexes_1.FirestoreIndexes().deploy(options, indexes, fieldOverrides);
33
- utils.logSuccess(`${clc.bold.green("firestore:")} deployed indexes in ${clc.bold(indexesFileName)} successfully`);
33
+ utils.logSuccess(`${clc.bold(clc.green("firestore:"))} deployed indexes in ${clc.bold(indexesFileName)} successfully`);
34
34
  }
35
35
  async function default_1(context, options) {
36
36
  await Promise.all([deployRules(context), deployIndexes(context, options)]);