firebase-tools 10.0.1 → 10.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accountExporter.js +9 -8
- package/lib/accountImporter.js +10 -8
- package/lib/api.js +1 -0
- package/lib/apiv2.js +91 -48
- package/lib/appdistribution/client.js +1 -1
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/archiveDirectory.js +63 -73
- package/lib/auth.js +2 -2
- package/lib/bin/firebase.js +1 -1
- package/lib/command.js +26 -26
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/appdistribution-testers-add.js +2 -2
- package/lib/commands/appdistribution-testers-remove.js +2 -2
- package/lib/commands/apps-android-sha-create.js +2 -2
- package/lib/commands/apps-android-sha-delete.js +2 -2
- package/lib/commands/apps-android-sha-list.js +2 -2
- package/lib/commands/apps-create.js +9 -9
- package/lib/commands/apps-list.js +3 -3
- package/lib/commands/apps-sdkconfig.js +8 -8
- package/lib/commands/auth-export.js +26 -25
- package/lib/commands/auth-import.js +88 -78
- package/lib/commands/database-get.js +1 -1
- package/lib/commands/database-instances-create.js +4 -4
- package/lib/commands/database-instances-list.js +4 -4
- package/lib/commands/database-profile.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +2 -2
- package/lib/commands/database-set.js +2 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +2 -2
- package/lib/commands/ext-configure.js +3 -3
- package/lib/commands/ext-dev-deprecate.js +4 -4
- package/lib/commands/ext-dev-extension-delete.js +3 -3
- package/lib/commands/ext-dev-init.js +4 -4
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +4 -4
- package/lib/commands/ext-dev-register.js +6 -6
- package/lib/commands/ext-dev-undeprecate.js +4 -4
- package/lib/commands/ext-dev-unpublish.js +3 -3
- package/lib/commands/ext-dev-usage.js +140 -0
- package/lib/commands/ext-export.js +8 -8
- package/lib/commands/ext-info.js +5 -5
- package/lib/commands/ext-install.js +27 -23
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +4 -4
- package/lib/commands/ext-update.js +18 -18
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +1 -1
- package/lib/commands/functions-config-clone.js +22 -23
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-config-get.js +22 -22
- package/lib/commands/functions-config-set.js +24 -22
- package/lib/commands/functions-config-unset.js +20 -22
- package/lib/commands/functions-delete.js +3 -3
- package/lib/commands/functions-deletegcfartifacts.js +4 -4
- package/lib/commands/functions-list.js +1 -1
- package/lib/commands/functions-log.js +1 -1
- package/lib/commands/help.js +12 -12
- package/lib/commands/hosting-channel-create.js +13 -13
- package/lib/commands/hosting-channel-delete.js +10 -10
- package/lib/commands/hosting-channel-deploy.js +18 -18
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +16 -16
- package/lib/commands/hosting-disable.js +1 -1
- package/lib/commands/hosting-sites-create.js +7 -7
- package/lib/commands/hosting-sites-delete.js +7 -7
- package/lib/commands/hosting-sites-get.js +2 -2
- package/lib/commands/hosting-sites-list.js +3 -3
- package/lib/commands/index.js +1 -0
- package/lib/commands/login-ci.js +10 -10
- package/lib/commands/login.js +2 -2
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/commands/projects-addfirebase.js +2 -2
- package/lib/commands/projects-create.js +2 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +3 -3
- package/lib/commands/remoteconfig-rollback.js +3 -3
- package/lib/commands/remoteconfig-versions-list.js +7 -2
- package/lib/commands/setup-emulators-database.js +8 -7
- package/lib/commands/setup-emulators-firestore.js +8 -7
- package/lib/commands/setup-emulators-pubsub.js +5 -4
- package/lib/commands/setup-emulators-storage.js +4 -3
- package/lib/commands/setup-emulators-ui.js +8 -7
- package/lib/commands/target-apply.js +17 -16
- package/lib/commands/target-clear.js +11 -10
- package/lib/commands/target-remove.js +10 -9
- package/lib/commands/target.js +20 -20
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/database/metadata.js +16 -24
- package/lib/defaultCredentials.js +3 -3
- package/lib/deploy/extensions/deploy.js +4 -4
- package/lib/deploy/extensions/deploymentSummary.js +5 -4
- package/lib/deploy/extensions/index.js +1 -0
- package/lib/deploy/extensions/params.js +1 -1
- package/lib/deploy/extensions/planner.js +3 -3
- package/lib/deploy/extensions/prepare.js +9 -9
- package/lib/deploy/extensions/release.js +1 -1
- package/lib/deploy/extensions/secrets.js +7 -7
- package/lib/deploy/extensions/validate.js +2 -2
- package/lib/deploy/functions/backend.js +9 -5
- package/lib/deploy/functions/checkIam.js +7 -7
- package/lib/deploy/functions/containerCleaner.js +3 -3
- package/lib/deploy/functions/deploy.js +4 -4
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +29 -23
- package/lib/deploy/functions/prompts.js +5 -5
- package/lib/deploy/functions/release/executor.js +4 -1
- package/lib/deploy/functions/release/fabricator.js +9 -6
- package/lib/deploy/functions/release/index.js +2 -2
- package/lib/deploy/functions/release/planner.js +6 -6
- package/lib/deploy/functions/release/reporter.js +8 -4
- package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
- package/lib/deploy/functions/runtimes/golang/index.js +11 -14
- package/lib/deploy/functions/runtimes/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/runtimes/node/validate.js +2 -1
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- package/lib/deploy/functions/validate.js +32 -4
- package/lib/deploy/hosting/convertConfig.js +45 -24
- package/lib/deploy/hosting/deploy.js +7 -7
- package/lib/deploy/hosting/prepare.js +1 -1
- package/lib/deploy/hosting/uploader.js +1 -1
- package/lib/deploy/hosting/validate.js +3 -3
- package/lib/deploy/remoteconfig/prepare.js +3 -3
- package/lib/deploy/remoteconfig/release.js +3 -3
- package/lib/deploy/storage/deploy.js +1 -1
- package/lib/deploy/storage/release.js +2 -2
- package/lib/detectProjectRoot.js +5 -5
- package/lib/emulator/auth/apiSpec.js +13 -7
- package/lib/emulator/auth/handlers.js +3 -3
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +256 -248
- package/lib/emulator/auth/server.js +11 -8
- package/lib/emulator/auth/state.js +12 -12
- package/lib/emulator/commandUtils.js +5 -5
- package/lib/emulator/controller.js +16 -11
- package/lib/emulator/downloadableEmulators.js +5 -4
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +110 -75
- package/lib/emulator/functionsEmulatorRuntime.js +36 -21
- package/lib/emulator/functionsEmulatorShell.js +3 -2
- package/lib/emulator/functionsRuntimeWorker.js +1 -1
- package/lib/emulator/hubExport.js +2 -2
- package/lib/emulator/storage/apis/firebase.js +2 -2
- package/lib/emulator/storage/apis/gcloud.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +1 -1
- package/lib/emulator/storage/files.js +14 -14
- package/lib/emulator/storage/index.js +2 -2
- package/lib/emulator/storage/metadata.js +7 -6
- package/lib/emulator/storage/rules/runtime.js +10 -9
- package/lib/emulator/storage/server.js +2 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/error.js +3 -3
- package/lib/extensions/askUserForConsent.js +3 -4
- package/lib/extensions/askUserForParam.js +11 -11
- package/lib/extensions/billingMigrationHelper.js +2 -2
- package/lib/extensions/changelog.js +4 -4
- package/lib/extensions/displayExtensionInfo.js +6 -6
- package/lib/extensions/emulator/optionsHelper.js +1 -1
- package/lib/extensions/emulator/specHelper.js +1 -1
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/export.js +6 -6
- package/lib/extensions/extensionsApi.js +68 -110
- package/lib/extensions/extensionsHelper.js +56 -43
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/localHelper.js +1 -1
- package/lib/extensions/metricsTypeDef.js +2 -0
- package/lib/extensions/metricsUtils.js +98 -0
- package/lib/extensions/paramHelper.js +6 -6
- package/lib/extensions/provisioningHelper.js +13 -14
- package/lib/extensions/resolveSource.js +6 -6
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +10 -10
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +11 -10
- package/lib/fetchWebSetup.js +2 -2
- package/lib/filterTargets.js +2 -2
- package/lib/firestore/indexes.js +2 -2
- package/lib/fsAsync.js +3 -3
- package/lib/fsutils.js +2 -2
- package/lib/functional.js +2 -1
- package/lib/functions/env.js +1 -1
- package/lib/functions/runtimeConfigExport.js +4 -4
- package/lib/functionsConfig.js +7 -8
- package/lib/functionsShellCommandAction.js +4 -3
- package/lib/gcp/cloudbilling.js +8 -19
- package/lib/gcp/cloudfunctions.js +22 -46
- package/lib/gcp/cloudlogging.js +8 -11
- package/lib/gcp/cloudmonitoring.js +77 -0
- package/lib/gcp/cloudscheduler.js +8 -19
- package/lib/gcp/firedata.js +5 -4
- package/lib/gcp/firestore.js +5 -5
- package/lib/gcp/iam.js +19 -34
- package/lib/gcp/resourceManager.js +10 -15
- package/lib/gcp/rules.js +18 -41
- package/lib/gcp/runtimeconfig.js +31 -53
- package/lib/gcp/secretManager.js +24 -45
- package/lib/gcp/storage.js +24 -29
- package/lib/getDefaultDatabaseInstance.js +1 -1
- package/lib/getDefaultHostingSite.js +1 -1
- package/lib/getProjectNumber.js +2 -2
- package/lib/handlePreviewToggles.js +5 -5
- package/lib/hosting/api.js +6 -6
- package/lib/hosting/cloudRunProxy.js +6 -6
- package/lib/hosting/functionsProxy.js +3 -3
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/hosting/proxy.js +2 -2
- package/lib/init/features/account.js +7 -7
- package/lib/init/features/database.js +9 -9
- package/lib/init/features/emulators.js +8 -8
- package/lib/init/features/firestore/index.js +3 -3
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/golang.js +4 -4
- package/lib/init/features/functions/index.js +4 -4
- package/lib/init/features/hosting/github.js +31 -31
- package/lib/init/features/project.js +8 -8
- package/lib/init/features/remoteconfig.js +2 -2
- package/lib/init/features/storage.js +2 -2
- package/lib/listFiles.js +1 -1
- package/lib/management/apps.js +3 -3
- package/lib/management/projects.js +6 -6
- package/lib/previews.js +2 -2
- package/lib/profiler.js +1 -1
- package/lib/projectPath.js +1 -1
- package/lib/projectUtils.js +2 -2
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/remoteconfig/get.js +14 -8
- package/lib/remoteconfig/rollback.js +13 -6
- package/lib/remoteconfig/versionslist.js +13 -7
- package/lib/requireAuth.js +2 -2
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requireHostingSite.js +1 -1
- package/lib/requirePermissions.js +4 -4
- package/lib/rulesDeploy.js +2 -2
- package/lib/serve/functions.js +14 -7
- package/lib/serve/hosting.js +7 -7
- package/lib/utils.js +3 -2
- package/npm-shrinkwrap.json +24090 -0
- package/package.json +36 -31
- package/schema/firebase-config.json +387 -12
- package/lib/commands/functions-config-legacy.js +0 -45
- package/lib/prepareFirebaseRules.js +0 -58
|
@@ -11,7 +11,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
11
|
const projectUtils_1 = require("../projectUtils");
|
|
12
12
|
const logger_1 = require("../logger");
|
|
13
13
|
const requireConfig = require("../requireConfig");
|
|
14
|
-
const marked = require("marked");
|
|
14
|
+
const { marked } = require("marked");
|
|
15
15
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
16
16
|
const LOG_TAG = "hosting:channel";
|
|
17
17
|
exports.default = new command_1.Command("hosting:channel:create [channelId]")
|
|
@@ -22,45 +22,45 @@ exports.default = new command_1.Command("hosting:channel:create [channelId]")
|
|
|
22
22
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
23
23
|
.before(requireHostingSite_1.requireHostingSite)
|
|
24
24
|
.action(async (channelId, options) => {
|
|
25
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
25
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
26
26
|
const site = options.site;
|
|
27
27
|
let expireTTL = expireUtils_1.DEFAULT_DURATION;
|
|
28
28
|
if (options.expires) {
|
|
29
|
-
expireTTL = expireUtils_1.calculateChannelExpireTTL(options.expires);
|
|
29
|
+
expireTTL = (0, expireUtils_1.calculateChannelExpireTTL)(options.expires);
|
|
30
30
|
}
|
|
31
31
|
if (channelId) {
|
|
32
32
|
options.channelId = channelId;
|
|
33
33
|
}
|
|
34
34
|
channelId =
|
|
35
35
|
channelId ||
|
|
36
|
-
(await prompt_1.promptOnce({
|
|
36
|
+
(await (0, prompt_1.promptOnce)({
|
|
37
37
|
type: "input",
|
|
38
38
|
message: "Please provide a URL-friendly name for the channel:",
|
|
39
39
|
validate: (s) => s.length > 0,
|
|
40
40
|
}));
|
|
41
|
-
channelId = api_1.normalizeName(channelId);
|
|
41
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
42
42
|
let channel;
|
|
43
43
|
try {
|
|
44
|
-
channel = await api_1.createChannel(projectId, site, channelId, expireTTL);
|
|
44
|
+
channel = await (0, api_1.createChannel)(projectId, site, channelId, expireTTL);
|
|
45
45
|
}
|
|
46
46
|
catch (e) {
|
|
47
47
|
if (e.status === 409) {
|
|
48
|
-
throw new error_1.FirebaseError(`Channel ${cli_color_1.bold(channelId)} already exists on site ${cli_color_1.bold(site)}. Deploy to ${cli_color_1.bold(channelId)} with: ${cli_color_1.yellow(`firebase hosting:channel:deploy ${channelId}`)}`, { original: e });
|
|
48
|
+
throw new error_1.FirebaseError(`Channel ${(0, cli_color_1.bold)(channelId)} already exists on site ${(0, cli_color_1.bold)(site)}. Deploy to ${(0, cli_color_1.bold)(channelId)} with: ${(0, cli_color_1.yellow)(`firebase hosting:channel:deploy ${channelId}`)}`, { original: e });
|
|
49
49
|
}
|
|
50
50
|
throw e;
|
|
51
51
|
}
|
|
52
52
|
try {
|
|
53
|
-
await api_1.addAuthDomains(projectId, [channel.url]);
|
|
53
|
+
await (0, api_1.addAuthDomains)(projectId, [channel.url]);
|
|
54
54
|
}
|
|
55
55
|
catch (e) {
|
|
56
|
-
utils_1.logLabeledWarning(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils_1.consoleUrl(projectId, "/authentication/providers")}`));
|
|
56
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
57
57
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
58
58
|
}
|
|
59
59
|
logger_1.logger.info();
|
|
60
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel ${cli_color_1.bold(channelId)} has been created on site ${cli_color_1.bold(site)}.`);
|
|
61
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel ${cli_color_1.bold(channelId)} will expire at ${cli_color_1.bold(utils_1.datetimeString(new Date(channel.expireTime)))}.`);
|
|
62
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel URL: ${channel.url}`);
|
|
60
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, cli_color_1.bold)(channelId)} has been created on site ${(0, cli_color_1.bold)(site)}.`);
|
|
61
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, cli_color_1.bold)(channelId)} will expire at ${(0, cli_color_1.bold)((0, utils_1.datetimeString)(new Date(channel.expireTime)))}.`);
|
|
62
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel URL: ${channel.url}`);
|
|
63
63
|
logger_1.logger.info();
|
|
64
|
-
logger_1.logger.info(`To deploy to this channel, use ${cli_color_1.yellow(`firebase hosting:channel:deploy ${channelId}`)}.`);
|
|
64
|
+
logger_1.logger.info(`To deploy to this channel, use ${(0, cli_color_1.yellow)(`firebase hosting:channel:deploy ${channelId}`)}.`);
|
|
65
65
|
return channel;
|
|
66
66
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_color_1 = require("cli-color");
|
|
4
|
-
const
|
|
4
|
+
const { marked } = require("marked");
|
|
5
5
|
const command_1 = require("../command");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const api_1 = require("../hosting/api");
|
|
@@ -19,28 +19,28 @@ exports.default = new command_1.Command("hosting:channel:delete <channelId>")
|
|
|
19
19
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
20
20
|
.before(requireHostingSite_1.requireHostingSite)
|
|
21
21
|
.action(async (channelId, options) => {
|
|
22
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
22
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
23
23
|
const siteId = options.site;
|
|
24
|
-
channelId = api_1.normalizeName(channelId);
|
|
25
|
-
const channel = await api_1.getChannel(projectId, siteId, channelId);
|
|
26
|
-
const confirmed = await prompt_1.promptOnce({
|
|
24
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
25
|
+
const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
|
|
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 Channel ${cli_color_1.underline(channelId)} for site ${cli_color_1.underline(siteId)}?`,
|
|
29
|
+
message: `Are you sure you want to delete the Hosting Channel ${(0, cli_color_1.underline)(channelId)} for site ${(0, cli_color_1.underline)(siteId)}?`,
|
|
30
30
|
default: false,
|
|
31
31
|
}, options);
|
|
32
32
|
if (!confirmed) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
await api_1.deleteChannel(projectId, siteId, channelId);
|
|
35
|
+
await (0, api_1.deleteChannel)(projectId, siteId, channelId);
|
|
36
36
|
if (channel) {
|
|
37
37
|
try {
|
|
38
|
-
await api_1.removeAuthDomain(projectId, channel.url);
|
|
38
|
+
await (0, api_1.removeAuthDomain)(projectId, channel.url);
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
-
utils_1.logLabeledWarning("hosting:channel",
|
|
41
|
+
(0, utils_1.logLabeledWarning)("hosting:channel", marked(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
42
42
|
logger_1.logger.debug("[hosting] unable to remove auth domain", e);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
utils_1.logLabeledSuccess("hosting:channels", `Successfully deleted channel ${cli_color_1.bold(channelId)} for site ${cli_color_1.bold(siteId)}.`);
|
|
45
|
+
(0, utils_1.logLabeledSuccess)("hosting:channels", `Successfully deleted channel ${(0, cli_color_1.bold)(channelId)} for site ${(0, cli_color_1.bold)(siteId)}.`);
|
|
46
46
|
});
|
|
@@ -12,7 +12,7 @@ const logger_1 = require("../logger");
|
|
|
12
12
|
const requireConfig = require("../requireConfig");
|
|
13
13
|
const expireUtils_1 = require("../hosting/expireUtils");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
|
-
const marked = require("marked");
|
|
15
|
+
const { marked } = require("marked");
|
|
16
16
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
17
17
|
const LOG_TAG = "hosting:channel";
|
|
18
18
|
exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
@@ -25,21 +25,21 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
25
25
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
26
26
|
.before(requireHostingSite_1.requireHostingSite)
|
|
27
27
|
.action(async (channelId, options) => {
|
|
28
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
28
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
29
29
|
if (options.open) {
|
|
30
30
|
throw new error_1.FirebaseError("open is not yet implemented");
|
|
31
31
|
}
|
|
32
32
|
let expireTTL = expireUtils_1.DEFAULT_DURATION;
|
|
33
33
|
if (options.expires) {
|
|
34
|
-
expireTTL = expireUtils_1.calculateChannelExpireTTL(options.expires);
|
|
34
|
+
expireTTL = (0, expireUtils_1.calculateChannelExpireTTL)(options.expires);
|
|
35
35
|
logger_1.logger.debug(`Expires TTL: ${expireTTL}`);
|
|
36
36
|
}
|
|
37
37
|
if (!channelId) {
|
|
38
38
|
throw new error_1.FirebaseError("channelID is currently required");
|
|
39
39
|
}
|
|
40
|
-
channelId = api_1.normalizeName(channelId);
|
|
40
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
41
41
|
if (channelId.toLowerCase().trim() === "live") {
|
|
42
|
-
throw new error_1.FirebaseError(`Cannot deploy to the ${cli_color_1.bold("live")} channel using this command. Please use ${cli_color_1.bold(cli_color_1.yellow("firebase deploy"))} instead.`);
|
|
42
|
+
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
43
|
}
|
|
44
44
|
if (options.only) {
|
|
45
45
|
options.only = options.only
|
|
@@ -47,7 +47,7 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
47
47
|
.map((o) => `hosting:${o}`)
|
|
48
48
|
.join(",");
|
|
49
49
|
}
|
|
50
|
-
const sites = normalizedHostingConfigs_1.normalizedHostingConfigs(options, {
|
|
50
|
+
const sites = (0, normalizedHostingConfigs_1.normalizedHostingConfigs)(options, {
|
|
51
51
|
resolveTargets: true,
|
|
52
52
|
}).map((cfg) => ({
|
|
53
53
|
site: cfg.site,
|
|
@@ -58,25 +58,25 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
58
58
|
}));
|
|
59
59
|
await Promise.all(sites.map(async (siteInfo) => {
|
|
60
60
|
const site = siteInfo.site;
|
|
61
|
-
let chan = await api_1.getChannel(projectId, site, channelId);
|
|
61
|
+
let chan = await (0, api_1.getChannel)(projectId, site, channelId);
|
|
62
62
|
if (chan) {
|
|
63
63
|
logger_1.logger.debug("[hosting] found existing channel for site", site, chan);
|
|
64
64
|
const channelExpires = Boolean(chan.expireTime);
|
|
65
65
|
if (!channelExpires && options.expires) {
|
|
66
|
-
chan = await api_1.updateChannelTtl(projectId, site, channelId, expireTTL);
|
|
66
|
+
chan = await (0, api_1.updateChannelTtl)(projectId, site, channelId, expireTTL);
|
|
67
67
|
}
|
|
68
68
|
else if (channelExpires) {
|
|
69
69
|
const channelTimeRemaining = new Date(chan.expireTime).getTime() - Date.now();
|
|
70
70
|
if (options.expires || channelTimeRemaining < expireTTL) {
|
|
71
|
-
chan = await api_1.updateChannelTtl(projectId, site, channelId, expireTTL);
|
|
71
|
+
chan = await (0, api_1.updateChannelTtl)(projectId, site, channelId, expireTTL);
|
|
72
72
|
logger_1.logger.debug("[hosting] updated TTL for existing channel for site", site, chan);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
chan = await api_1.createChannel(projectId, site, channelId, expireTTL);
|
|
77
|
+
chan = await (0, api_1.createChannel)(projectId, site, channelId, expireTTL);
|
|
78
78
|
logger_1.logger.debug("[hosting] created new channnel for site", site, chan);
|
|
79
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel ${cli_color_1.bold(channelId)} has been created on site ${cli_color_1.bold(site)}.`);
|
|
79
|
+
(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
80
|
}
|
|
81
81
|
siteInfo.url = chan.url;
|
|
82
82
|
siteInfo.expireTime = chan.expireTime;
|
|
@@ -104,7 +104,7 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
104
104
|
deploys[d.target || d.site] = d;
|
|
105
105
|
let expires = "";
|
|
106
106
|
if (d.expireTime) {
|
|
107
|
-
expires = `[expires ${cli_color_1.bold(utils_1.datetimeString(new Date(d.expireTime)))}]`;
|
|
107
|
+
expires = `[expires ${(0, cli_color_1.bold)((0, utils_1.datetimeString)(new Date(d.expireTime)))}]`;
|
|
108
108
|
}
|
|
109
109
|
const versionPrefix = `sites/${d.site}/versions/`;
|
|
110
110
|
const versionName = versionNames.find((v) => {
|
|
@@ -113,9 +113,9 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
113
113
|
let version = "";
|
|
114
114
|
if (versionName) {
|
|
115
115
|
d.version = versionName.replace(versionPrefix, "");
|
|
116
|
-
version = ` [version ${cli_color_1.bold(d.version)}]`;
|
|
116
|
+
version = ` [version ${(0, cli_color_1.bold)(d.version)}]`;
|
|
117
117
|
}
|
|
118
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel URL (${cli_color_1.bold(d.site || d.target)}): ${d.url} ${expires}${version}`);
|
|
118
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel URL (${(0, cli_color_1.bold)(d.site || d.target)}): ${d.url} ${expires}${version}`);
|
|
119
119
|
});
|
|
120
120
|
return deploys;
|
|
121
121
|
});
|
|
@@ -123,18 +123,18 @@ async function syncAuthState(projectId, sites) {
|
|
|
123
123
|
const siteNames = sites.map((d) => d.site);
|
|
124
124
|
const urlNames = sites.map((d) => d.url);
|
|
125
125
|
try {
|
|
126
|
-
await api_1.addAuthDomains(projectId, urlNames);
|
|
126
|
+
await (0, api_1.addAuthDomains)(projectId, urlNames);
|
|
127
127
|
logger_1.logger.debug("[hosting] added auth domain for urls", urlNames);
|
|
128
128
|
}
|
|
129
129
|
catch (e) {
|
|
130
|
-
utils_1.logLabeledWarning(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils_1.consoleUrl(projectId, "/authentication/providers")}`));
|
|
130
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
131
131
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
132
132
|
}
|
|
133
133
|
try {
|
|
134
|
-
await api_1.cleanAuthState(projectId, siteNames);
|
|
134
|
+
await (0, api_1.cleanAuthState)(projectId, siteNames);
|
|
135
135
|
}
|
|
136
136
|
catch (e) {
|
|
137
|
-
utils_1.logLabeledWarning(LOG_TAG, "Unable to sync Firebase Auth state.");
|
|
137
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, "Unable to sync Firebase Auth state.");
|
|
138
138
|
logger_1.logger.debug("[hosting] unable to sync auth domain", e);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -18,21 +18,21 @@ exports.default = new command_1.Command("hosting:channel:list")
|
|
|
18
18
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
19
19
|
.before(requireHostingSite_1.requireHostingSite)
|
|
20
20
|
.action(async (options) => {
|
|
21
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
21
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
22
22
|
const siteId = options.site;
|
|
23
|
-
const channels = await api_1.listChannels(projectId, siteId);
|
|
23
|
+
const channels = await (0, api_1.listChannels)(projectId, siteId);
|
|
24
24
|
const table = new Table({ head: TABLE_HEAD, style: { head: ["green"] } });
|
|
25
25
|
for (const channel of channels) {
|
|
26
26
|
const channelId = channel.name.split("/").pop();
|
|
27
27
|
table.push([
|
|
28
28
|
channelId,
|
|
29
|
-
utils_1.datetimeString(new Date(channel.updateTime)),
|
|
29
|
+
(0, utils_1.datetimeString)(new Date(channel.updateTime)),
|
|
30
30
|
channel.url,
|
|
31
|
-
channel.expireTime ? utils_1.datetimeString(new Date(channel.expireTime)) : "never",
|
|
31
|
+
channel.expireTime ? (0, utils_1.datetimeString)(new Date(channel.expireTime)) : "never",
|
|
32
32
|
]);
|
|
33
33
|
}
|
|
34
34
|
logger_1.logger.info();
|
|
35
|
-
logger_1.logger.info(`Channels for site ${cli_color_1.bold(siteId)}`);
|
|
35
|
+
logger_1.logger.info(`Channels for site ${(0, cli_color_1.bold)(siteId)}`);
|
|
36
36
|
logger_1.logger.info();
|
|
37
37
|
logger_1.logger.info(table.toString());
|
|
38
38
|
return { channels };
|
|
@@ -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 };
|
package/lib/commands/index.js
CHANGED
|
@@ -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");
|
package/lib/commands/login-ci.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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');
|
package/lib/commands/login.js
CHANGED
|
@@ -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);
|
package/lib/commands/logout.js
CHANGED
|
@@ -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,
|
package/lib/commands/open.js
CHANGED
|
@@ -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
|
});
|