firebase-tools 10.0.0 → 10.1.2

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 (244) hide show
  1. package/lib/accountExporter.js +9 -8
  2. package/lib/accountImporter.js +10 -8
  3. package/lib/api.js +1 -0
  4. package/lib/apiv2.js +2 -2
  5. package/lib/appdistribution/client.js +1 -1
  6. package/lib/appdistribution/options-parser-util.js +1 -1
  7. package/lib/auth.js +2 -2
  8. package/lib/bin/firebase.js +1 -1
  9. package/lib/command.js +26 -26
  10. package/lib/commands/appdistribution-distribute.js +4 -4
  11. package/lib/commands/appdistribution-testers-add.js +2 -2
  12. package/lib/commands/appdistribution-testers-remove.js +2 -2
  13. package/lib/commands/apps-android-sha-create.js +2 -2
  14. package/lib/commands/apps-android-sha-delete.js +2 -2
  15. package/lib/commands/apps-android-sha-list.js +2 -2
  16. package/lib/commands/apps-create.js +9 -9
  17. package/lib/commands/apps-list.js +3 -3
  18. package/lib/commands/apps-sdkconfig.js +8 -8
  19. package/lib/commands/auth-export.js +26 -25
  20. package/lib/commands/auth-import.js +88 -78
  21. package/lib/commands/database-get.js +1 -1
  22. package/lib/commands/database-instances-create.js +4 -4
  23. package/lib/commands/database-instances-list.js +4 -4
  24. package/lib/commands/database-profile.js +1 -1
  25. package/lib/commands/database-push.js +1 -1
  26. package/lib/commands/database-remove.js +2 -2
  27. package/lib/commands/database-set.js +2 -2
  28. package/lib/commands/database-settings-get.js +1 -1
  29. package/lib/commands/database-settings-set.js +1 -1
  30. package/lib/commands/database-update.js +2 -2
  31. package/lib/commands/ext-configure.js +3 -3
  32. package/lib/commands/ext-dev-deprecate.js +4 -4
  33. package/lib/commands/ext-dev-extension-delete.js +3 -3
  34. package/lib/commands/ext-dev-init.js +4 -4
  35. package/lib/commands/ext-dev-list.js +1 -1
  36. package/lib/commands/ext-dev-publish.js +4 -4
  37. package/lib/commands/ext-dev-register.js +6 -6
  38. package/lib/commands/ext-dev-undeprecate.js +4 -4
  39. package/lib/commands/ext-dev-unpublish.js +3 -3
  40. package/lib/commands/ext-dev-usage.js +145 -0
  41. package/lib/commands/ext-export.js +8 -8
  42. package/lib/commands/ext-info.js +5 -5
  43. package/lib/commands/ext-install.js +27 -23
  44. package/lib/commands/ext-list.js +2 -2
  45. package/lib/commands/ext-sources-create.js +2 -2
  46. package/lib/commands/ext-uninstall.js +4 -4
  47. package/lib/commands/ext-update.js +18 -18
  48. package/lib/commands/ext.js +3 -3
  49. package/lib/commands/firestore-delete.js +1 -1
  50. package/lib/commands/functions-config-clone.js +22 -23
  51. package/lib/commands/functions-config-export.js +11 -11
  52. package/lib/commands/functions-config-get.js +22 -22
  53. package/lib/commands/functions-config-set.js +24 -22
  54. package/lib/commands/functions-config-unset.js +20 -22
  55. package/lib/commands/functions-delete.js +3 -3
  56. package/lib/commands/functions-deletegcfartifacts.js +4 -4
  57. package/lib/commands/functions-list.js +1 -1
  58. package/lib/commands/functions-log.js +1 -1
  59. package/lib/commands/help.js +12 -12
  60. package/lib/commands/hosting-channel-create.js +13 -13
  61. package/lib/commands/hosting-channel-delete.js +10 -10
  62. package/lib/commands/hosting-channel-deploy.js +18 -18
  63. package/lib/commands/hosting-channel-list.js +5 -5
  64. package/lib/commands/hosting-channel-open.js +9 -9
  65. package/lib/commands/hosting-clone.js +16 -16
  66. package/lib/commands/hosting-disable.js +1 -1
  67. package/lib/commands/hosting-sites-create.js +7 -7
  68. package/lib/commands/hosting-sites-delete.js +7 -7
  69. package/lib/commands/hosting-sites-get.js +2 -2
  70. package/lib/commands/hosting-sites-list.js +3 -3
  71. package/lib/commands/index.js +1 -0
  72. package/lib/commands/login-ci.js +10 -10
  73. package/lib/commands/login.js +2 -2
  74. package/lib/commands/logout.js +1 -1
  75. package/lib/commands/open.js +1 -1
  76. package/lib/commands/projects-addfirebase.js +2 -2
  77. package/lib/commands/projects-create.js +2 -2
  78. package/lib/commands/projects-list.js +1 -1
  79. package/lib/commands/remoteconfig-get.js +3 -3
  80. package/lib/commands/remoteconfig-rollback.js +3 -3
  81. package/lib/commands/remoteconfig-versions-list.js +7 -2
  82. package/lib/commands/setup-emulators-database.js +8 -7
  83. package/lib/commands/setup-emulators-firestore.js +8 -7
  84. package/lib/commands/setup-emulators-pubsub.js +5 -4
  85. package/lib/commands/setup-emulators-storage.js +4 -3
  86. package/lib/commands/setup-emulators-ui.js +8 -7
  87. package/lib/commands/target-apply.js +17 -16
  88. package/lib/commands/target-clear.js +11 -10
  89. package/lib/commands/target-remove.js +10 -9
  90. package/lib/commands/target.js +20 -20
  91. package/lib/config.js +6 -6
  92. package/lib/database/api.js +2 -2
  93. package/lib/defaultCredentials.js +3 -3
  94. package/lib/deploy/extensions/deploy.js +4 -4
  95. package/lib/deploy/extensions/deploymentSummary.js +5 -4
  96. package/lib/deploy/extensions/index.js +1 -0
  97. package/lib/deploy/extensions/params.js +1 -1
  98. package/lib/deploy/extensions/planner.js +3 -3
  99. package/lib/deploy/extensions/prepare.js +9 -9
  100. package/lib/deploy/extensions/release.js +1 -1
  101. package/lib/deploy/extensions/secrets.js +7 -7
  102. package/lib/deploy/extensions/validate.js +2 -2
  103. package/lib/deploy/functions/backend.js +6 -4
  104. package/lib/deploy/functions/checkIam.js +7 -7
  105. package/lib/deploy/functions/containerCleaner.js +3 -3
  106. package/lib/deploy/functions/deploy.js +4 -4
  107. package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
  108. package/lib/deploy/functions/index.js +1 -0
  109. package/lib/deploy/functions/prepare.js +27 -21
  110. package/lib/deploy/functions/prompts.js +5 -5
  111. package/lib/deploy/functions/release/executor.js +4 -1
  112. package/lib/deploy/functions/release/fabricator.js +5 -5
  113. package/lib/deploy/functions/release/index.js +2 -2
  114. package/lib/deploy/functions/release/planner.js +6 -6
  115. package/lib/deploy/functions/release/reporter.js +8 -4
  116. package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
  117. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
  118. package/lib/deploy/functions/runtimes/golang/index.js +11 -14
  119. package/lib/deploy/functions/runtimes/index.js +6 -10
  120. package/lib/deploy/functions/runtimes/node/index.js +6 -10
  121. package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
  122. package/lib/deploy/functions/runtimes/node/validate.js +2 -1
  123. package/lib/deploy/functions/services/storage.js +1 -1
  124. package/lib/deploy/functions/triggerRegionHelper.js +1 -1
  125. package/lib/deploy/functions/validate.js +4 -3
  126. package/lib/deploy/hosting/deploy.js +7 -7
  127. package/lib/deploy/hosting/uploader.js +1 -1
  128. package/lib/deploy/hosting/validate.js +3 -3
  129. package/lib/deploy/remoteconfig/prepare.js +3 -3
  130. package/lib/deploy/remoteconfig/release.js +3 -3
  131. package/lib/deploy/storage/deploy.js +1 -1
  132. package/lib/deploy/storage/release.js +2 -2
  133. package/lib/detectProjectRoot.js +5 -5
  134. package/lib/emulator/auth/apiSpec.js +13 -7
  135. package/lib/emulator/auth/handlers.js +3 -3
  136. package/lib/emulator/auth/index.js +1 -1
  137. package/lib/emulator/auth/operations.js +256 -248
  138. package/lib/emulator/auth/server.js +11 -8
  139. package/lib/emulator/auth/state.js +12 -12
  140. package/lib/emulator/commandUtils.js +5 -5
  141. package/lib/emulator/controller.js +16 -11
  142. package/lib/emulator/downloadableEmulators.js +10 -9
  143. package/lib/emulator/emulatorLogger.js +1 -1
  144. package/lib/emulator/functionsEmulator.js +107 -74
  145. package/lib/emulator/functionsEmulatorRuntime.js +36 -21
  146. package/lib/emulator/functionsEmulatorShell.js +3 -2
  147. package/lib/emulator/functionsRuntimeWorker.js +1 -1
  148. package/lib/emulator/hubExport.js +2 -2
  149. package/lib/emulator/storage/apis/firebase.js +2 -2
  150. package/lib/emulator/storage/apis/gcloud.js +2 -2
  151. package/lib/emulator/storage/cloudFunctions.js +1 -1
  152. package/lib/emulator/storage/files.js +14 -14
  153. package/lib/emulator/storage/index.js +2 -2
  154. package/lib/emulator/storage/metadata.js +7 -6
  155. package/lib/emulator/storage/rules/runtime.js +10 -9
  156. package/lib/emulator/storage/server.js +2 -2
  157. package/lib/ensureApiEnabled.js +7 -7
  158. package/lib/error.js +3 -3
  159. package/lib/extensions/askUserForConsent.js +3 -4
  160. package/lib/extensions/askUserForParam.js +11 -11
  161. package/lib/extensions/billingMigrationHelper.js +2 -2
  162. package/lib/extensions/changelog.js +4 -4
  163. package/lib/extensions/displayExtensionInfo.js +6 -6
  164. package/lib/extensions/emulator/optionsHelper.js +1 -1
  165. package/lib/extensions/emulator/specHelper.js +1 -1
  166. package/lib/extensions/emulator/triggerHelper.js +1 -1
  167. package/lib/extensions/export.js +6 -6
  168. package/lib/extensions/extensionsApi.js +69 -110
  169. package/lib/extensions/extensionsHelper.js +56 -43
  170. package/lib/extensions/listExtensions.js +1 -1
  171. package/lib/extensions/localHelper.js +1 -1
  172. package/lib/extensions/metricsTypeDef.js +2 -0
  173. package/lib/extensions/metricsUtils.js +98 -0
  174. package/lib/extensions/paramHelper.js +6 -6
  175. package/lib/extensions/provisioningHelper.js +13 -14
  176. package/lib/extensions/resolveSource.js +6 -6
  177. package/lib/extensions/secretsUtils.js +3 -3
  178. package/lib/extensions/updateHelper.js +10 -10
  179. package/lib/extensions/utils.js +1 -1
  180. package/lib/extensions/warnings.js +11 -10
  181. package/lib/fetchWebSetup.js +2 -2
  182. package/lib/filterTargets.js +2 -2
  183. package/lib/firestore/indexes.js +2 -2
  184. package/lib/fsAsync.js +3 -3
  185. package/lib/fsutils.js +2 -2
  186. package/lib/functional.js +2 -1
  187. package/lib/functions/env.js +1 -1
  188. package/lib/functions/runtimeConfigExport.js +4 -4
  189. package/lib/functionsConfig.js +7 -8
  190. package/lib/functionsShellCommandAction.js +4 -3
  191. package/lib/gcp/cloudmonitoring.js +74 -0
  192. package/lib/gcp/cloudscheduler.js +1 -1
  193. package/lib/gcp/iam.js +2 -2
  194. package/lib/gcp/resourceManager.js +2 -2
  195. package/lib/gcp/rules.js +18 -41
  196. package/lib/gcp/secretManager.js +3 -2
  197. package/lib/getDefaultDatabaseInstance.js +1 -1
  198. package/lib/getDefaultHostingSite.js +1 -1
  199. package/lib/getProjectNumber.js +2 -2
  200. package/lib/handlePreviewToggles.js +5 -5
  201. package/lib/hosting/api.js +6 -6
  202. package/lib/hosting/cloudRunProxy.js +6 -6
  203. package/lib/hosting/functionsProxy.js +3 -3
  204. package/lib/hosting/implicitInit.js +2 -2
  205. package/lib/hosting/normalizedHostingConfigs.js +3 -3
  206. package/lib/hosting/proxy.js +2 -2
  207. package/lib/init/features/account.js +7 -7
  208. package/lib/init/features/database.js +9 -9
  209. package/lib/init/features/emulators.js +8 -8
  210. package/lib/init/features/firestore/index.js +3 -3
  211. package/lib/init/features/firestore/indexes.js +2 -2
  212. package/lib/init/features/firestore/rules.js +2 -2
  213. package/lib/init/features/functions/golang.js +4 -4
  214. package/lib/init/features/functions/index.js +4 -4
  215. package/lib/init/features/hosting/github.js +31 -31
  216. package/lib/init/features/project.js +8 -8
  217. package/lib/init/features/remoteconfig.js +2 -2
  218. package/lib/init/features/storage.js +2 -2
  219. package/lib/listFiles.js +1 -1
  220. package/lib/management/apps.js +3 -3
  221. package/lib/management/projects.js +6 -6
  222. package/lib/previews.js +2 -2
  223. package/lib/profiler.js +1 -1
  224. package/lib/projectPath.js +1 -1
  225. package/lib/projectUtils.js +2 -2
  226. package/lib/prompt.js +0 -1
  227. package/lib/rc.js +1 -1
  228. package/lib/remoteconfig/get.js +14 -8
  229. package/lib/remoteconfig/rollback.js +13 -6
  230. package/lib/remoteconfig/versionslist.js +13 -7
  231. package/lib/requireAuth.js +2 -2
  232. package/lib/requireDatabaseInstance.js +1 -1
  233. package/lib/requireHostingSite.js +1 -1
  234. package/lib/requirePermissions.js +4 -4
  235. package/lib/rulesDeploy.js +2 -2
  236. package/lib/serve/functions.js +14 -7
  237. package/lib/serve/hosting.js +7 -7
  238. package/lib/utils.js +3 -2
  239. package/npm-shrinkwrap.json +24095 -0
  240. package/package.json +33 -30
  241. package/templates/init/hosting/index.html +1 -1
  242. package/CHANGELOG.md +0 -5
  243. package/lib/commands/functions-config-legacy.js +0 -45
  244. package/lib/prepareFirebaseRules.js +0 -58
@@ -20,26 +20,26 @@ exports.default = new command_1.Command("hosting:channel:open [channelId]")
20
20
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
21
21
  .before(requireHostingSite_1.requireHostingSite)
22
22
  .action(async (channelId, options) => {
23
- const projectId = projectUtils_1.needProjectId(options);
23
+ const projectId = (0, projectUtils_1.needProjectId)(options);
24
24
  const siteId = options.site;
25
25
  if (!channelId) {
26
26
  if (options.nonInteractive) {
27
27
  throw new error_1.FirebaseError(`Please provide a channelId.`);
28
28
  }
29
- const channels = await api_1.listChannels(projectId, siteId);
30
- lodash_1.sortBy(channels, ["name"]);
31
- channelId = await prompt_1.promptOnce({
29
+ const channels = await (0, api_1.listChannels)(projectId, siteId);
30
+ (0, lodash_1.sortBy)(channels, ["name"]);
31
+ channelId = await (0, prompt_1.promptOnce)({
32
32
  type: "list",
33
33
  message: "Which channel would you like to open?",
34
- choices: channels.map((c) => lodash_1.last(c.name.split("/")) || c.name),
34
+ choices: channels.map((c) => (0, lodash_1.last)(c.name.split("/")) || c.name),
35
35
  });
36
36
  }
37
- channelId = api_1.normalizeName(channelId);
38
- const channel = await api_1.getChannel(projectId, siteId, channelId);
37
+ channelId = (0, api_1.normalizeName)(channelId);
38
+ const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
39
39
  if (!channel) {
40
- throw new error_1.FirebaseError(`Could not find the channel ${cli_color_1.bold(channelId)} for site ${cli_color_1.bold(siteId)}.`);
40
+ 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
41
  }
42
- utils_1.logLabeledBullet("hosting:channel", channel.url);
42
+ (0, utils_1.logLabeledBullet)("hosting:channel", channel.url);
43
43
  if (!options.nonInteractive) {
44
44
  open(channel.url);
45
45
  }
@@ -7,7 +7,7 @@ const error_1 = require("../error");
7
7
  const api_1 = require("../hosting/api");
8
8
  const utils = require("../utils");
9
9
  const requireAuth_1 = require("../requireAuth");
10
- const marked = require("marked");
10
+ const { marked } = require("marked");
11
11
  const logger_1 = require("../logger");
12
12
  exports.default = new command_1.Command("hosting:clone <source> <targetChannel>")
13
13
  .description("clone a version from one site to another")
@@ -28,9 +28,9 @@ exports.default = new command_1.Command("hosting:clone <source> <targetChannel>"
28
28
  if (!targetSiteId || !targetChannelId) {
29
29
  throw new error_1.FirebaseError(`"${targetChannel}" is not a valid target channel. Must be in the form "<site>:<channel>" (to clone to the active website, use "live" as the channel).`);
30
30
  }
31
- targetChannelId = api_1.normalizeName(targetChannelId);
31
+ targetChannelId = (0, api_1.normalizeName)(targetChannelId);
32
32
  if (sourceChannelId) {
33
- sourceChannelId = api_1.normalizeName(sourceChannelId);
33
+ sourceChannelId = (0, api_1.normalizeName)(sourceChannelId);
34
34
  }
35
35
  const equalSiteIds = sourceSiteId == targetSiteId;
36
36
  const equalChannelIds = sourceChannelId == targetChannelId;
@@ -38,28 +38,28 @@ exports.default = new command_1.Command("hosting:clone <source> <targetChannel>"
38
38
  throw new error_1.FirebaseError(`Source and destination cannot be equal. Please pick a different source or desination.`);
39
39
  }
40
40
  if (!sourceVersionName) {
41
- const sChannel = await api_1.getChannel("-", sourceSiteId, sourceChannelId);
41
+ const sChannel = await (0, api_1.getChannel)("-", sourceSiteId, sourceChannelId);
42
42
  if (!sChannel) {
43
- throw new error_1.FirebaseError(`Could not find the channel ${cli_color_1.bold(sourceChannelId)} for site ${cli_color_1.bold(sourceSiteId)}.`);
43
+ throw new error_1.FirebaseError(`Could not find the channel ${(0, cli_color_1.bold)(sourceChannelId)} for site ${(0, cli_color_1.bold)(sourceSiteId)}.`);
44
44
  }
45
45
  sourceVersionName = (_b = (_a = sChannel.release) === null || _a === void 0 ? void 0 : _a.version) === null || _b === void 0 ? void 0 : _b.name;
46
46
  if (!sourceVersionName) {
47
- throw new error_1.FirebaseError(`Could not find a version on the channel ${cli_color_1.bold(sourceChannelId)} for site ${cli_color_1.bold(sourceSiteId)}.`);
47
+ 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)}.`);
48
48
  }
49
49
  }
50
- let tChannel = await api_1.getChannel("-", targetSiteId, targetChannelId);
50
+ let tChannel = await (0, api_1.getChannel)("-", targetSiteId, targetChannelId);
51
51
  if (!tChannel) {
52
- utils.logBullet(`could not find channel ${cli_color_1.bold(targetChannelId)} in site ${cli_color_1.bold(targetSiteId)}, creating it...`);
52
+ utils.logBullet(`could not find channel ${(0, cli_color_1.bold)(targetChannelId)} in site ${(0, cli_color_1.bold)(targetSiteId)}, creating it...`);
53
53
  try {
54
- tChannel = await api_1.createChannel("-", targetSiteId, targetChannelId);
54
+ tChannel = await (0, api_1.createChannel)("-", targetSiteId, targetChannelId);
55
55
  }
56
56
  catch (e) {
57
- throw new error_1.FirebaseError(`Could not create the channel ${cli_color_1.bold(targetChannelId)} for site ${cli_color_1.bold(targetSiteId)}.`, { original: e });
57
+ 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 });
58
58
  }
59
59
  utils.logSuccess(`Created new channel ${targetChannelId}`);
60
60
  try {
61
61
  const tProjectId = parseProjectId(tChannel.name);
62
- await api_1.addAuthDomains(tProjectId, [tChannel.url]);
62
+ await (0, api_1.addAuthDomains)(tProjectId, [tChannel.url]);
63
63
  }
64
64
  catch (e) {
65
65
  utils.logLabeledWarning("hosting:clone", marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils.consoleUrl(targetSiteId, "/authentication/providers")}`));
@@ -68,27 +68,27 @@ exports.default = new command_1.Command("hosting:clone <source> <targetChannel>"
68
68
  }
69
69
  const currentTargetVersionName = (_d = (_c = tChannel.release) === null || _c === void 0 ? void 0 : _c.version) === null || _d === void 0 ? void 0 : _d.name;
70
70
  if (equalSiteIds && sourceVersionName == currentTargetVersionName) {
71
- utils.logSuccess(`Channels ${cli_color_1.bold(sourceChannelId)} and ${cli_color_1.bold(targetChannel)} are serving identical versions. No need to clone.`);
71
+ utils.logSuccess(`Channels ${(0, cli_color_1.bold)(sourceChannelId)} and ${(0, cli_color_1.bold)(targetChannel)} are serving identical versions. No need to clone.`);
72
72
  return;
73
73
  }
74
74
  let targetVersionName = sourceVersionName;
75
75
  const spinner = ora("Cloning site content...").start();
76
76
  try {
77
77
  if (!equalSiteIds) {
78
- const targetVersion = await api_1.cloneVersion(targetSiteId, sourceVersionName, true);
78
+ const targetVersion = await (0, api_1.cloneVersion)(targetSiteId, sourceVersionName, true);
79
79
  if (!targetVersion) {
80
- throw new error_1.FirebaseError(`Could not clone the version ${cli_color_1.bold(sourceVersion)} for site ${cli_color_1.bold(targetSiteId)}.`);
80
+ throw new error_1.FirebaseError(`Could not clone the version ${(0, cli_color_1.bold)(sourceVersion)} for site ${(0, cli_color_1.bold)(targetSiteId)}.`);
81
81
  }
82
82
  targetVersionName = targetVersion.name;
83
83
  }
84
- await api_1.createRelease(targetSiteId, targetChannelId, targetVersionName);
84
+ await (0, api_1.createRelease)(targetSiteId, targetChannelId, targetVersionName);
85
85
  }
86
86
  catch (err) {
87
87
  spinner.fail();
88
88
  throw err;
89
89
  }
90
90
  spinner.succeed();
91
- utils.logSuccess(`Site ${cli_color_1.bold(sourceSiteId)} ${sourceChannelId ? "channel" : "version"} ${cli_color_1.bold(sourceChannelId || sourceVersion)} has been cloned to site ${cli_color_1.bold(targetSiteId)} channel ${cli_color_1.bold(targetChannelId)}.`);
91
+ 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)}.`);
92
92
  utils.logSuccess(`Channel URL (${targetChannelId}): ${tChannel.url}`);
93
93
  });
94
94
  function parseProjectId(name) {
@@ -16,7 +16,7 @@ exports.default = new command_1.Command("hosting:disable")
16
16
  .before(requireHostingSite_1.requireHostingSite)
17
17
  .action(async (options) => {
18
18
  const siteToDisable = options.site;
19
- const confirm = await prompt_1.promptOnce({
19
+ const confirm = await (0, prompt_1.promptOnce)({
20
20
  type: "confirm",
21
21
  name: "force",
22
22
  message: `Are you sure you want to disable Firebase Hosting for the site ${clc.underline(siteToDisable)}\n${clc.underline("This will immediately make your site inaccessible!")}`,
@@ -15,13 +15,13 @@ exports.default = new command_1.Command("hosting:sites:create [siteId]")
15
15
  .option("--app <appId>", "specify an existing Firebase Web App ID")
16
16
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
17
17
  .action(async (siteId, options) => {
18
- const projectId = projectUtils_1.needProjectId(options);
18
+ const projectId = (0, projectUtils_1.needProjectId)(options);
19
19
  const appId = options.app;
20
20
  if (!siteId) {
21
21
  if (options.nonInteractive) {
22
22
  throw new error_1.FirebaseError(`"siteId" argument must be provided in a non-interactive environment`);
23
23
  }
24
- siteId = await prompt_1.promptOnce({
24
+ siteId = await (0, prompt_1.promptOnce)({
25
25
  type: "input",
26
26
  message: "Please provide an unique, URL-friendly id for the site (<id>.web.app):",
27
27
  validate: (s) => s.length > 0,
@@ -32,20 +32,20 @@ exports.default = new command_1.Command("hosting:sites:create [siteId]")
32
32
  }
33
33
  let site;
34
34
  try {
35
- site = await api_1.createSite(projectId, siteId, appId);
35
+ site = await (0, api_1.createSite)(projectId, siteId, appId);
36
36
  }
37
37
  catch (e) {
38
38
  if (e.status === 409) {
39
- throw new error_1.FirebaseError(`Site ${cli_color_1.bold(siteId)} already exists in project ${cli_color_1.bold(projectId)}.`, { original: e });
39
+ 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
40
  }
41
41
  throw e;
42
42
  }
43
43
  logger_1.logger.info();
44
- utils_1.logLabeledSuccess(LOG_TAG, `Site ${cli_color_1.bold(siteId)} has been created in project ${cli_color_1.bold(projectId)}.`);
44
+ (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
45
  if (appId) {
46
- utils_1.logLabeledSuccess(LOG_TAG, `Site ${cli_color_1.bold(siteId)} has been linked to web app ${cli_color_1.bold(appId)}`);
46
+ (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
47
  }
48
- utils_1.logLabeledSuccess(LOG_TAG, `Site URL: ${site.defaultUrl}`);
48
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Site URL: ${site.defaultUrl}`);
49
49
  logger_1.logger.info();
50
50
  logger_1.logger.info(`To deploy to this site, follow the guide at https://firebase.google.com/docs/hosting/multisites.`);
51
51
  return site;
@@ -17,22 +17,22 @@ exports.default = new command_1.Command("hosting:sites:delete <siteId>")
17
17
  .before(requireConfig)
18
18
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.delete"])
19
19
  .action(async (siteId, options) => {
20
- const projectId = projectUtils_1.needProjectId(options);
20
+ const projectId = (0, projectUtils_1.needProjectId)(options);
21
21
  if (!siteId) {
22
22
  throw new error_1.FirebaseError("siteId is required");
23
23
  }
24
- 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 ${cli_color_1.underline(siteId)} cannot be reactivated by you or anyone else.`);
24
+ 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
25
  logger_1.logger.info();
26
- const confirmed = await prompt_1.promptOnce({
26
+ const confirmed = await (0, prompt_1.promptOnce)({
27
27
  name: "force",
28
28
  type: "confirm",
29
- message: `Are you sure you want to delete the Hosting site ${cli_color_1.underline(siteId)} for project ${cli_color_1.underline(projectId)}? `,
29
+ 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
30
  default: false,
31
31
  }, options);
32
32
  if (!confirmed) {
33
33
  return;
34
34
  }
35
- await api_1.getSite(projectId, siteId);
36
- await api_1.deleteSite(projectId, siteId);
37
- utils_1.logLabeledSuccess(LOG_TAG, `Successfully deleted site ${cli_color_1.bold(siteId)} from project ${cli_color_1.bold(projectId)}`);
35
+ await (0, api_1.getSite)(projectId, siteId);
36
+ await (0, api_1.deleteSite)(projectId, siteId);
37
+ (0, utils_1.logLabeledSuccess)(LOG_TAG, `Successfully deleted site ${(0, cli_color_1.bold)(siteId)} from project ${(0, cli_color_1.bold)(projectId)}`);
38
38
  });
@@ -11,11 +11,11 @@ exports.default = new command_1.Command("hosting:sites:get <siteId>")
11
11
  .description("print info about a Firebase Hosting site")
12
12
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
13
13
  .action(async (siteId, options) => {
14
- const projectId = projectUtils_1.needProjectId(options);
14
+ const projectId = (0, projectUtils_1.needProjectId)(options);
15
15
  if (!siteId) {
16
16
  throw new error_1.FirebaseError("<siteId> must be specified");
17
17
  }
18
- const site = await api_1.getSite(projectId, siteId);
18
+ const site = await (0, api_1.getSite)(projectId, siteId);
19
19
  const table = new Table();
20
20
  table.push(["Site ID:", site.name.split("/").pop()]);
21
21
  table.push(["Default URL:", site.defaultUrl]);
@@ -12,15 +12,15 @@ exports.default = new command_1.Command("hosting:sites:list")
12
12
  .description("list Firebase Hosting sites")
13
13
  .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
14
14
  .action(async (options) => {
15
- const projectId = projectUtils_1.needProjectId(options);
16
- const sites = await api_1.listSites(projectId);
15
+ const projectId = (0, projectUtils_1.needProjectId)(options);
16
+ const sites = await (0, api_1.listSites)(projectId);
17
17
  const table = new Table({ head: TABLE_HEAD, style: { head: ["green"] } });
18
18
  for (const site of sites) {
19
19
  const siteId = site.name.split("/").pop();
20
20
  table.push([siteId, site.defaultUrl, site.appId || "--"]);
21
21
  }
22
22
  logger_1.logger.info();
23
- logger_1.logger.info(`Sites for project ${cli_color_1.bold(projectId)}`);
23
+ logger_1.logger.info(`Sites for project ${(0, cli_color_1.bold)(projectId)}`);
24
24
  logger_1.logger.info();
25
25
  logger_1.logger.info(table.toString());
26
26
  return { sites };
@@ -83,6 +83,7 @@ module.exports = function (client) {
83
83
  client.ext.dev.unpublish = loadCommand("ext-dev-unpublish");
84
84
  client.ext.dev.publish = loadCommand("ext-dev-publish");
85
85
  client.ext.dev.delete = loadCommand("ext-dev-extension-delete");
86
+ client.ext.dev.usage = loadCommand("ext-dev-usage");
86
87
  }
87
88
  client.firestore = {};
88
89
  client.firestore.delete = loadCommand("firestore-delete");
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
- var { Command } = require("../command");
3
- var clc = require("cli-color");
4
- var utils = require("../utils");
5
- const { logger } = require("../logger");
6
- var auth = require("../auth");
7
- module.exports = new Command("login:ci")
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const clc = require("cli-color");
4
+ const command_1 = require("../command");
5
+ const error_1 = require("../error");
6
+ const logger_1 = require("../logger");
7
+ const auth = require("../auth");
8
+ const utils = require("../utils");
9
+ exports.default = new command_1.Command("login:ci")
8
10
  .description("generate an access token for use in non-interactive environments")
9
11
  .option("--no-localhost", "copy and paste a code instead of starting a local server for authentication")
10
12
  .action(async (options) => {
11
13
  if (options.nonInteractive) {
12
- return utils.reject("Cannot run login:ci in non-interactive mode.", {
13
- exit: 1,
14
- });
14
+ throw new error_1.FirebaseError("Cannot run login:ci in non-interactive mode.");
15
15
  }
16
16
  const userCredentials = await auth.loginGoogle(options.localhost);
17
- logger.info();
17
+ logger_1.logger.info();
18
18
  utils.logSuccess("Success! Use this token to login on a CI server:\n\n" +
19
19
  clc.bold(userCredentials.tokens.refresh_token) +
20
20
  '\n\nExample: firebase deploy --token "$FIREBASE_TOKEN"\n');
@@ -28,7 +28,7 @@ module.exports = new command_1.Command("login")
28
28
  }
29
29
  if (!options.reauth) {
30
30
  utils.logBullet("Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.\n");
31
- const collectUsage = await prompt_1.promptOnce({
31
+ const collectUsage = await (0, prompt_1.promptOnce)({
32
32
  type: "confirm",
33
33
  name: "collectUsage",
34
34
  message: "Allow Firebase to collect CLI usage and error reporting information?",
@@ -38,7 +38,7 @@ module.exports = new command_1.Command("login")
38
38
  utils.logBullet("To change your data collection preference at any time, run `firebase logout` and log in again.");
39
39
  }
40
40
  }
41
- const useLocalhost = utils_1.isCloudEnvironment() ? false : options.localhost;
41
+ const useLocalhost = (0, utils_1.isCloudEnvironment)() ? false : options.localhost;
42
42
  const result = await auth.loginGoogle(useLocalhost, _.get(user, "email"));
43
43
  configstore_1.configstore.set("user", result.user);
44
44
  configstore_1.configstore.set("tokens", result.tokens);
@@ -38,7 +38,7 @@ module.exports = new command_1.Command("logout [email]")
38
38
  value: a,
39
39
  };
40
40
  });
41
- newDefaultAccount = await prompt_1.promptOnce({
41
+ newDefaultAccount = await (0, prompt_1.promptOnce)({
42
42
  type: "list",
43
43
  message: "You are logging out of your default account, which account should become the new default?",
44
44
  choices,
@@ -52,7 +52,7 @@ exports.default = new command_1.Command("open [link]")
52
52
  throw new error_1.FirebaseError("Unrecognized link name. Valid links are:\n\n" + _.map(LINKS, "arg").join("\n"));
53
53
  }
54
54
  if (!link) {
55
- const name = await prompt_1.promptOnce({
55
+ const name = await (0, prompt_1.promptOnce)({
56
56
  type: "list",
57
57
  message: "What link would you like to open?",
58
58
  choices: CHOICES,
@@ -9,10 +9,10 @@ module.exports = new command_1.Command("projects:addfirebase [projectId]")
9
9
  .before(requireAuth_1.requireAuth)
10
10
  .action(async (projectId, options) => {
11
11
  if (!options.nonInteractive && !projectId) {
12
- projectId = await projects_1.promptAvailableProjectId();
12
+ projectId = await (0, projects_1.promptAvailableProjectId)();
13
13
  }
14
14
  if (!projectId) {
15
15
  throw new error_1.FirebaseError("Project ID cannot be empty");
16
16
  }
17
- return projects_1.addFirebaseToCloudProjectAndLog(projectId);
17
+ return (0, projects_1.addFirebaseToCloudProjectAndLog)(projectId);
18
18
  });
@@ -17,7 +17,7 @@ module.exports = new command_1.Command("projects:create [projectId]")
17
17
  throw new error_1.FirebaseError("Invalid argument, please provide only one type of project parent (organization or folder)");
18
18
  }
19
19
  if (!options.nonInteractive) {
20
- await prompt_1.prompt(options, projects_1.PROJECTS_CREATE_QUESTIONS);
20
+ await (0, prompt_1.prompt)(options, projects_1.PROJECTS_CREATE_QUESTIONS);
21
21
  }
22
22
  if (!options.projectId) {
23
23
  throw new error_1.FirebaseError("Project ID cannot be empty");
@@ -29,7 +29,7 @@ module.exports = new command_1.Command("projects:create [projectId]")
29
29
  else if (options.folder) {
30
30
  parentResource = { type: projects_1.ProjectParentResourceType.FOLDER, id: options.folder };
31
31
  }
32
- return projects_1.createFirebaseProjectAndLog(options.projectId, {
32
+ return (0, projects_1.createFirebaseProjectAndLog)(options.projectId, {
33
33
  displayName: options.displayName,
34
34
  parentResource,
35
35
  });
@@ -47,7 +47,7 @@ module.exports = new command_1.Command("projects:list")
47
47
  const spinner = ora("Preparing the list of your Firebase projects").start();
48
48
  let projects;
49
49
  try {
50
- projects = await projects_1.listFirebaseProjects();
50
+ projects = await (0, projects_1.listFirebaseProjects)();
51
51
  }
52
52
  catch (err) {
53
53
  spinner.fail();
@@ -28,7 +28,7 @@ module.exports = new command_1.Command("remoteconfig:get")
28
28
  .before(requirePermissions_1.requirePermissions, ["cloudconfig.configs.get"])
29
29
  .action(async (options) => {
30
30
  utils.assertIsStringOrUndefined(options.versionNumber);
31
- const template = await rcGet.getTemplate(projectUtils_1.needProjectId(options), checkValidOptionalNumber(options.versionNumber));
31
+ const template = await rcGet.getTemplate((0, projectUtils_1.needProjectId)(options), checkValidOptionalNumber(options.versionNumber));
32
32
  const table = new Table({ head: tableHead, style: { head: ["green"] } });
33
33
  if (template.conditions) {
34
34
  let updatedConditions = template.conditions
@@ -40,9 +40,9 @@ module.exports = new command_1.Command("remoteconfig:get")
40
40
  }
41
41
  table.push(["conditions", updatedConditions]);
42
42
  }
43
- const updatedParameters = get_1.parseTemplateForTable(template.parameters);
43
+ const updatedParameters = (0, get_1.parseTemplateForTable)(template.parameters);
44
44
  table.push(["parameters", updatedParameters]);
45
- const updatedParameterGroups = get_1.parseTemplateForTable(template.parameterGroups);
45
+ const updatedParameterGroups = (0, get_1.parseTemplateForTable)(template.parameterGroups);
46
46
  table.push(["parameterGroups", updatedParameterGroups]);
47
47
  table.push(["version", util.inspect(template.version, { showHidden: false, depth: null })]);
48
48
  const fileOut = !!options.output;
@@ -16,7 +16,7 @@ module.exports = new command_1.Command("remoteconfig:rollback")
16
16
  .withForce()
17
17
  .action(async (options) => {
18
18
  var _a;
19
- const templateVersion = await versionslist_1.getVersions(projectUtils_1.needProjectId(options), 1);
19
+ const templateVersion = await (0, versionslist_1.getVersions)((0, projectUtils_1.needProjectId)(options), 1);
20
20
  let targetVersion = 0;
21
21
  if (options.versionNumber) {
22
22
  targetVersion = options.versionNumber;
@@ -34,7 +34,7 @@ module.exports = new command_1.Command("remoteconfig:rollback")
34
34
  `. ` +
35
35
  `Invalid Version Number`);
36
36
  }
37
- const confirm = await prompt_1.promptOnce({
37
+ const confirm = await (0, prompt_1.promptOnce)({
38
38
  type: "confirm",
39
39
  name: "force",
40
40
  message: "Proceed to rollback template to version " + targetVersion + "?",
@@ -43,5 +43,5 @@ module.exports = new command_1.Command("remoteconfig:rollback")
43
43
  if (!confirm) {
44
44
  return;
45
45
  }
46
- return rollback_1.rollbackTemplate(projectUtils_1.needProjectId(options), targetVersion);
46
+ return (0, rollback_1.rollbackTemplate)((0, projectUtils_1.needProjectId)(options), targetVersion);
47
47
  });
@@ -6,11 +6,16 @@ const command_1 = require("../command");
6
6
  const projectUtils_1 = require("../projectUtils");
7
7
  const requireAuth_1 = require("../requireAuth");
8
8
  const requirePermissions_1 = require("../requirePermissions");
9
+ const utils_1 = require("../utils");
9
10
  const Table = require("cli-table");
10
11
  const tableHead = ["Update User", "Version Number", "Update Time"];
11
12
  function pushTableContents(table, version) {
12
13
  var _a;
13
- return table.push([(_a = version === null || version === void 0 ? void 0 : version.updateUser) === null || _a === void 0 ? void 0 : _a.email, version === null || version === void 0 ? void 0 : version.versionNumber, version === null || version === void 0 ? void 0 : version.updateTime]);
14
+ return table.push([
15
+ (_a = version.updateUser) === null || _a === void 0 ? void 0 : _a.email,
16
+ version.versionNumber,
17
+ version.updateTime ? (0, utils_1.datetimeString)(new Date(version.updateTime)) : "",
18
+ ]);
14
19
  }
15
20
  module.exports = new command_1.Command("remoteconfig:versions:list")
16
21
  .description("get a list of Remote Config template versions that have been published for a Firebase project")
@@ -18,7 +23,7 @@ module.exports = new command_1.Command("remoteconfig:versions:list")
18
23
  .before(requireAuth_1.requireAuth)
19
24
  .before(requirePermissions_1.requirePermissions, ["cloudconfig.configs.get"])
20
25
  .action(async (options) => {
21
- const versionsList = await rcVersion.getVersions(projectUtils_1.needProjectId(options), options.limit);
26
+ const versionsList = await rcVersion.getVersions((0, projectUtils_1.needProjectId)(options), options.limit);
22
27
  const table = new Table({ head: tableHead, style: { head: ["green"] } });
23
28
  for (let item = 0; item < versionsList.versions.length; item++) {
24
29
  pushTableContents(table, versionsList.versions[item]);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
- const { Command } = require("../command");
3
- const { Emulators } = require("../emulator/types");
4
- const { downloadEmulator } = require("../emulator/download");
5
- const NAME = Emulators.DATABASE;
6
- module.exports = new Command(`setup:emulators:${NAME}`)
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("../command");
4
+ const download_1 = require("../emulator/download");
5
+ const types_1 = require("../emulator/types");
6
+ const NAME = types_1.Emulators.DATABASE;
7
+ exports.default = new command_1.Command(`setup:emulators:${NAME}`)
7
8
  .description(`downloads the ${NAME} emulator`)
8
- .action((options) => {
9
- return downloadEmulator(NAME);
9
+ .action(() => {
10
+ return (0, download_1.downloadEmulator)(NAME);
10
11
  });
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
- const { Command } = require("../command");
3
- const { Emulators } = require("../emulator/types");
4
- const { downloadEmulator } = require("../emulator/download");
5
- const NAME = Emulators.FIRESTORE;
6
- module.exports = new Command(`setup:emulators:${NAME}`)
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("../command");
4
+ const download_1 = require("../emulator/download");
5
+ const types_1 = require("../emulator/types");
6
+ const NAME = types_1.Emulators.FIRESTORE;
7
+ exports.default = new command_1.Command(`setup:emulators:${NAME}`)
7
8
  .description(`downloads the ${NAME} emulator`)
8
- .action((options) => {
9
- return downloadEmulator(NAME);
9
+ .action(() => {
10
+ return (0, download_1.downloadEmulator)(NAME);
10
11
  });
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("../command");
4
- const { downloadEmulator } = require("../emulator/download");
5
- const EMULATOR_NAME = "pubsub";
6
- module.exports = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
4
+ const download_1 = require("../emulator/download");
5
+ const types_1 = require("../emulator/types");
6
+ const EMULATOR_NAME = types_1.Emulators.PUBSUB;
7
+ exports.default = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
7
8
  .description(`downloads the ${EMULATOR_NAME} emulator`)
8
9
  .action(() => {
9
- return downloadEmulator(EMULATOR_NAME);
10
+ return (0, download_1.downloadEmulator)(EMULATOR_NAME);
10
11
  });
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("../command");
4
4
  const download_1 = require("../emulator/download");
5
- const EMULATOR_NAME = "storage";
6
- module.exports = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
5
+ const types_1 = require("../emulator/types");
6
+ const EMULATOR_NAME = types_1.Emulators.STORAGE;
7
+ exports.default = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
7
8
  .description(`downloads the ${EMULATOR_NAME} emulator`)
8
9
  .action(() => {
9
- return download_1.downloadEmulator(EMULATOR_NAME);
10
+ return (0, download_1.downloadEmulator)(EMULATOR_NAME);
10
11
  });
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
- const { Command } = require("../command");
3
- const { Emulators } = require("../emulator/types");
4
- const { downloadEmulator } = require("../emulator/download");
5
- const NAME = Emulators.UI;
6
- module.exports = new Command(`setup:emulators:${NAME}`)
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("../command");
4
+ const download_1 = require("../emulator/download");
5
+ const types_1 = require("../emulator/types");
6
+ const NAME = types_1.Emulators.UI;
7
+ exports.default = new command_1.Command(`setup:emulators:${NAME}`)
7
8
  .description(`downloads the ${NAME} emulator`)
8
- .action((options) => {
9
- return downloadEmulator(NAME);
9
+ .action(() => {
10
+ return (0, download_1.downloadEmulator)(NAME);
10
11
  });
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
- var _ = require("lodash");
3
- var clc = require("cli-color");
4
- var { Command } = require("../command");
5
- const { logger } = require("../logger");
6
- var requireConfig = require("../requireConfig");
7
- var utils = require("../utils");
8
- module.exports = new Command("target:apply <type> <name> <resources...>")
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const clc = require("cli-color");
4
+ const command_1 = require("../command");
5
+ const logger_1 = require("../logger");
6
+ const requireConfig = require("../requireConfig");
7
+ const utils = require("../utils");
8
+ const error_1 = require("../error");
9
+ exports.default = new command_1.Command("target:apply <type> <name> <resources...>")
9
10
  .description("apply a deploy target to a resource")
10
11
  .before(requireConfig)
11
- .action(function (type, name, resources, options) {
12
+ .action((type, name, resources, options) => {
12
13
  if (!options.project) {
13
- return utils.reject("Must have an active project to set deploy targets. Try " + clc.bold("firebase use --add"));
14
+ throw new error_1.FirebaseError(`Must have an active project to set deploy targets. Try ${clc.bold("firebase use --add")}`);
14
15
  }
15
- var changes = options.rc.applyTarget(options.project, type, name, resources);
16
- utils.logSuccess("Applied " + type + " target " + clc.bold(name) + " to " + clc.bold(resources.join(", ")));
17
- _.forEach(changes, function (change) {
18
- utils.logWarning("Previous target " + clc.bold(change.target) + " removed from " + clc.bold(change.resource));
19
- });
20
- logger.info();
21
- logger.info("Updated: " + name + " (" + options.rc.target(options.project, type, name).join(",") + ")");
16
+ const changes = options.rc.applyTarget(options.project, type, name, resources);
17
+ utils.logSuccess(`Applied ${type} target ${clc.bold(name)} to ${clc.bold(resources.join(", "))}`);
18
+ for (const change of changes) {
19
+ utils.logWarning(`Previous target ${clc.bold(change.target)} removed from ${clc.bold(change.resource)}`);
20
+ }
21
+ logger_1.logger.info();
22
+ logger_1.logger.info(`Updated: ${name} (${options.rc.target(options.project, type, name).join(",")})`);
22
23
  });
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
- var clc = require("cli-color");
3
- var { Command } = require("../command");
4
- var requireConfig = require("../requireConfig");
5
- var utils = require("../utils");
6
- module.exports = new Command("target:clear <type> <target>")
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const clc = require("cli-color");
4
+ const command_1 = require("../command");
5
+ const requireConfig = require("../requireConfig");
6
+ const utils = require("../utils");
7
+ exports.default = new command_1.Command("target:clear <type> <target>")
7
8
  .description("clear all resources from a named resource target")
8
9
  .before(requireConfig)
9
- .action(function (type, name, options) {
10
- var existed = options.rc.clearTarget(options.project, type, name);
10
+ .action((type, name, options) => {
11
+ const existed = options.rc.clearTarget(options.project, type, name);
11
12
  if (existed) {
12
- utils.logSuccess("Cleared " + type + " target " + clc.bold(name));
13
+ utils.logSuccess(`Cleared ${type} target ${clc.bold(name)}`);
13
14
  }
14
15
  else {
15
- utils.logWarning("No action taken. No " + type + " target found named " + clc.bold(name));
16
+ utils.logWarning(`No action taken. No ${type} target found named ${clc.bold(name)}`);
16
17
  }
17
- return Promise.resolve(existed);
18
+ return existed;
18
19
  });