firebase-tools 11.0.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accountExporter.js +11 -4
- package/lib/accountImporter.js +93 -95
- package/lib/api.js +77 -218
- package/lib/apiv2.js +5 -4
- package/lib/appdistribution/client.js +23 -34
- package/lib/auth.js +72 -52
- package/lib/bin/firebase.js +42 -47
- package/lib/checkValidTargetFilters.js +36 -25
- package/lib/commands/appdistribution-distribute.js +2 -1
- package/lib/commands/appdistribution-testers-add.js +2 -1
- package/lib/commands/appdistribution-testers-remove.js +2 -1
- package/lib/commands/apps-android-sha-create.js +2 -1
- package/lib/commands/apps-android-sha-delete.js +2 -1
- package/lib/commands/apps-android-sha-list.js +2 -1
- package/lib/commands/apps-create.js +2 -1
- package/lib/commands/apps-list.js +2 -1
- package/lib/commands/apps-sdkconfig.js +2 -1
- package/lib/commands/auth-export.js +2 -1
- package/lib/commands/auth-import.js +7 -10
- package/lib/commands/crashlytics-symbols-upload.js +2 -1
- package/lib/commands/database-get.js +4 -3
- package/lib/commands/database-instances-create.js +2 -1
- package/lib/commands/database-instances-list.js +3 -3
- package/lib/commands/database-profile.js +4 -4
- package/lib/commands/database-push.js +4 -4
- package/lib/commands/database-remove.js +3 -3
- package/lib/commands/database-rules-canary.js +2 -1
- package/lib/commands/database-rules-get.js +2 -1
- package/lib/commands/database-rules-list.js +2 -1
- package/lib/commands/database-rules-release.js +2 -1
- package/lib/commands/database-rules-stage.js +2 -1
- package/lib/commands/database-set.js +3 -3
- package/lib/commands/database-settings-get.js +2 -1
- package/lib/commands/database-settings-set.js +2 -1
- package/lib/commands/database-update.js +2 -1
- package/lib/commands/deploy.js +26 -25
- package/lib/commands/emulators-exec.js +2 -1
- package/lib/commands/emulators-export.js +2 -1
- package/lib/commands/emulators-start.js +2 -1
- package/lib/commands/experimental-functions-shell.js +10 -8
- package/lib/commands/ext-configure.js +6 -1
- package/lib/commands/ext-dev-deprecate.js +2 -1
- package/lib/commands/ext-dev-emulators-exec.js +3 -2
- package/lib/commands/ext-dev-emulators-start.js +3 -2
- package/lib/commands/ext-dev-extension-delete.js +2 -1
- package/lib/commands/ext-dev-init.js +2 -1
- package/lib/commands/ext-dev-list.js +8 -8
- package/lib/commands/ext-dev-publish.js +2 -1
- package/lib/commands/ext-dev-register.js +2 -1
- package/lib/commands/ext-dev-undeprecate.js +2 -1
- package/lib/commands/ext-dev-unpublish.js +2 -1
- package/lib/commands/ext-dev-usage.js +2 -1
- package/lib/commands/ext-export.js +2 -1
- package/lib/commands/ext-info.js +14 -14
- package/lib/commands/ext-install.js +6 -1
- package/lib/commands/ext-list.js +2 -1
- package/lib/commands/ext-sources-create.js +2 -1
- package/lib/commands/ext-uninstall.js +7 -1
- package/lib/commands/ext-update.js +6 -1
- package/lib/commands/ext.js +4 -4
- package/lib/commands/firestore-delete.js +2 -1
- package/lib/commands/firestore-indexes-list.js +2 -1
- package/lib/commands/functions-config-clone.js +4 -3
- package/lib/commands/functions-config-export.js +2 -1
- package/lib/commands/functions-config-get.js +2 -1
- package/lib/commands/functions-config-set.js +2 -1
- package/lib/commands/functions-config-unset.js +2 -1
- package/lib/commands/functions-delete.js +3 -8
- package/lib/commands/functions-deletegcfartifacts.js +2 -1
- package/lib/commands/functions-list.js +2 -1
- package/lib/commands/functions-log.js +2 -1
- package/lib/commands/functions-secrets-access.js +2 -1
- package/lib/commands/functions-secrets-destroy.js +2 -1
- package/lib/commands/functions-secrets-get.js +2 -1
- package/lib/commands/functions-secrets-prune.js +2 -1
- package/lib/commands/functions-secrets-set.js +2 -1
- package/lib/commands/functions-shell.js +12 -10
- package/lib/commands/help.js +2 -1
- package/lib/commands/hosting-channel-create.js +2 -1
- package/lib/commands/hosting-channel-delete.js +2 -1
- package/lib/commands/hosting-channel-deploy.js +2 -1
- package/lib/commands/hosting-channel-list.js +2 -1
- package/lib/commands/hosting-channel-open.js +2 -1
- package/lib/commands/hosting-clone.js +2 -1
- package/lib/commands/hosting-disable.js +2 -1
- package/lib/commands/hosting-sites-create.js +2 -1
- package/lib/commands/hosting-sites-delete.js +2 -1
- package/lib/commands/hosting-sites-get.js +2 -1
- package/lib/commands/hosting-sites-list.js +2 -1
- package/lib/commands/index.js +23 -13
- package/lib/commands/init.js +47 -43
- package/lib/commands/login-add.js +2 -1
- package/lib/commands/login-ci.js +2 -1
- package/lib/commands/login-list.js +2 -1
- package/lib/commands/login-use.js +2 -1
- package/lib/commands/login.js +2 -1
- package/lib/commands/logout.js +2 -1
- package/lib/commands/open.js +7 -7
- package/lib/commands/projects-addfirebase.js +2 -1
- package/lib/commands/projects-create.js +2 -1
- package/lib/commands/projects-list.js +2 -1
- package/lib/commands/remoteconfig-get.js +2 -1
- package/lib/commands/remoteconfig-rollback.js +2 -1
- package/lib/commands/remoteconfig-versions-list.js +2 -1
- package/lib/commands/serve.js +30 -30
- package/lib/commands/setup-emulators-database.js +2 -1
- package/lib/commands/setup-emulators-firestore.js +2 -1
- package/lib/commands/setup-emulators-pubsub.js +2 -1
- package/lib/commands/setup-emulators-storage.js +2 -1
- package/lib/commands/setup-emulators-ui.js +2 -1
- package/lib/commands/target-apply.js +2 -1
- package/lib/commands/target-clear.js +2 -1
- package/lib/commands/target-remove.js +2 -1
- package/lib/commands/target.js +2 -1
- package/lib/commands/use.js +54 -53
- package/lib/config.js +7 -6
- package/lib/deploy/database/deploy.js +3 -2
- package/lib/deploy/database/index.js +8 -5
- package/lib/deploy/database/prepare.js +22 -20
- package/lib/deploy/database/release.js +12 -9
- package/lib/deploy/extensions/secrets.js +3 -3
- package/lib/deploy/firestore/prepare.js +2 -2
- package/lib/deploy/functions/build.js +33 -20
- package/lib/deploy/functions/ensure.js +1 -11
- package/lib/deploy/functions/prepare.js +3 -13
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -3
- package/lib/deploy/functions/release/fabricator.js +0 -1
- package/lib/deploy/functions/release/index.js +1 -5
- package/lib/deploy/functions/runtimes/discovery/index.js +18 -3
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +188 -54
- package/lib/deploy/functions/runtimes/golang/index.js +2 -22
- package/lib/deploy/functions/runtimes/node/index.js +3 -7
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +15 -3
- package/lib/deploy/functions/services/database.js +14 -0
- package/lib/deploy/functions/services/index.js +14 -0
- package/lib/deploy/index.js +3 -3
- package/lib/deploy/lifecycleHooks.js +27 -27
- package/lib/deploy/remoteconfig/functions.js +18 -14
- package/lib/deploy/remoteconfig/prepare.js +2 -2
- package/lib/deploy/storage/prepare.js +1 -1
- package/lib/emulator/auth/apiSpec.js +14 -46
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +342 -93
- package/lib/emulator/auth/server.js +2 -2
- package/lib/emulator/auth/state.js +34 -32
- package/lib/emulator/commandUtils.js +1 -1
- package/lib/emulator/constants.js +1 -1
- package/lib/emulator/controller.js +7 -6
- package/lib/emulator/databaseEmulator.js +11 -9
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/events/types.js +2 -3
- package/lib/emulator/firestoreEmulator.js +12 -14
- package/lib/emulator/functionsEmulator.js +65 -77
- package/lib/emulator/functionsEmulatorRuntime.js +7 -7
- package/lib/emulator/hostingEmulator.js +1 -1
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/hubClient.js +11 -22
- package/lib/emulator/hubExport.js +26 -16
- package/lib/emulator/loggingEmulator.js +1 -1
- package/lib/emulator/pubsubEmulator.js +1 -1
- package/lib/emulator/storage/crc.js +4 -4
- package/lib/emulator/storage/index.js +1 -1
- package/lib/emulator/types.js +1 -1
- package/lib/errorOut.js +2 -2
- package/lib/extensions/askUserForConsent.js +1 -2
- package/lib/extensions/askUserForParam.js +15 -18
- package/lib/extensions/emulator/optionsHelper.js +4 -4
- package/lib/extensions/extensionsApi.js +1 -22
- package/lib/extensions/extensionsHelper.js +6 -6
- package/lib/extensions/listExtensions.js +9 -10
- package/lib/extensions/manifest.js +2 -2
- package/lib/extensions/resolveSource.js +11 -7
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/types.js +24 -0
- package/lib/extensions/updateHelper.js +1 -1
- package/lib/extensions/utils.js +1 -2
- package/lib/extensions/warnings.js +3 -3
- package/lib/firestore/checkDatabaseType.js +4 -5
- package/lib/firestore/encodeFirestoreValue.js +11 -8
- package/lib/firestore/indexes.js +17 -34
- package/lib/fsAsync.js +3 -3
- package/lib/functions/events/v2.js +7 -1
- package/lib/functionsConfig.js +17 -14
- package/lib/functionsConfigClone.js +46 -46
- package/lib/gcp/cloudfunctions.js +2 -15
- package/lib/gcp/cloudfunctionsv2.js +17 -2
- package/lib/gcp/iam.js +1 -1
- package/lib/gcp/index.js +10 -10
- package/lib/gcp/rules.js +1 -1
- package/lib/gcp/runtimeconfig.js +45 -47
- package/lib/gcp/storage.js +2 -4
- package/lib/hosting/cloudRunProxy.js +19 -15
- package/lib/hosting/proxy.js +1 -1
- package/lib/index.js +29 -28
- package/lib/init/features/database.js +11 -5
- package/lib/init/features/functions/index.js +1 -1
- package/lib/init/features/functions/javascript.js +23 -20
- package/lib/init/features/functions/npm-dependencies.js +17 -14
- package/lib/init/features/functions/typescript.js +27 -24
- package/lib/init/features/hosting/github.js +6 -5
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/loadCJSON.js +9 -6
- package/lib/localFunction.js +4 -4
- package/lib/logError.js +15 -12
- package/lib/management/apps.js +47 -43
- package/lib/management/database.js +33 -31
- package/lib/management/projects.js +13 -7
- package/lib/parseBoltRules.js +15 -14
- package/lib/previews.js +1 -1
- package/lib/profileReport.js +504 -512
- package/lib/profiler.js +4 -4
- package/lib/prompt.js +1 -2
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +0 -1
- package/lib/responseToError.js +8 -5
- package/lib/rtdb.js +31 -29
- package/lib/rulesDeploy.js +2 -2
- package/lib/scopes.js +9 -9
- package/lib/serve/index.js +4 -5
- package/lib/utils.js +30 -6
- package/npm-shrinkwrap.json +877 -279
- package/package.json +19 -16
- package/standalone/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const command_1 = require("../command");
|
|
4
5
|
const projectUtils_1 = require("../projectUtils");
|
|
5
6
|
const containerCleaner_1 = require("../deploy/functions/containerCleaner");
|
|
@@ -14,7 +15,7 @@ function getConfirmationMessage(paths) {
|
|
|
14
15
|
message += "\nAre you sure?\n";
|
|
15
16
|
return message;
|
|
16
17
|
}
|
|
17
|
-
exports.
|
|
18
|
+
exports.command = new command_1.Command("functions:deletegcfartifacts")
|
|
18
19
|
.description("Deletes all artifacts created by Google Cloud Functions on Google Container Registry.")
|
|
19
20
|
.option("--regions <regions>", "Specify regions of artifacts to be deleted. " +
|
|
20
21
|
"If omitted, artifacts from all regions will be deleted. " +
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const command_1 = require("../command");
|
|
4
5
|
const error_1 = require("../error");
|
|
5
6
|
const projectUtils_1 = require("../projectUtils");
|
|
@@ -7,7 +8,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
7
8
|
const backend = require("../deploy/functions/backend");
|
|
8
9
|
const logger_1 = require("../logger");
|
|
9
10
|
const Table = require("cli-table");
|
|
10
|
-
exports.
|
|
11
|
+
exports.command = new command_1.Command("functions:list")
|
|
11
12
|
.description("list all deployed functions in your Firebase project")
|
|
12
13
|
.before(requirePermissions_1.requirePermissions, ["cloudfunctions.functions.list"])
|
|
13
14
|
.action(async (options) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const opn = require("open");
|
|
4
5
|
const qs = require("querystring");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -8,7 +9,7 @@ const cloudlogging = require("../gcp/cloudlogging");
|
|
|
8
9
|
const functionsLog = require("../functions/functionslog");
|
|
9
10
|
const projectUtils_1 = require("../projectUtils");
|
|
10
11
|
const requirePermissions_1 = require("../requirePermissions");
|
|
11
|
-
|
|
12
|
+
exports.command = new command_1.Command("functions:log")
|
|
12
13
|
.description("read logs from deployed functions")
|
|
13
14
|
.option("--only <function_names>", 'only show logs of specified, comma-seperated functions (e.g. "funcA,funcB")')
|
|
14
15
|
.option("-n, --lines <num_lines>", "specify number of log lines to fetch")
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const command_1 = require("../command");
|
|
4
5
|
const logger_1 = require("../logger");
|
|
5
6
|
const projectUtils_1 = require("../projectUtils");
|
|
6
7
|
const secretManager_1 = require("../gcp/secretManager");
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command("functions:secrets:access <KEY>[@version]")
|
|
8
9
|
.description("Access secret value given secret and its version. Defaults to accessing the latest version.")
|
|
9
10
|
.action(async (key, options) => {
|
|
10
11
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const command_1 = require("../command");
|
|
4
5
|
const projectUtils_1 = require("../projectUtils");
|
|
5
6
|
const secretManager_1 = require("../gcp/secretManager");
|
|
@@ -7,7 +8,7 @@ const prompt_1 = require("../prompt");
|
|
|
7
8
|
const utils_1 = require("../utils");
|
|
8
9
|
const secrets = require("../functions/secrets");
|
|
9
10
|
const backend = require("../deploy/functions/backend");
|
|
10
|
-
exports.
|
|
11
|
+
exports.command = new command_1.Command("functions:secrets:destroy <KEY>[@version]")
|
|
11
12
|
.description("Destroy a secret. Defaults to destroying the latest version.")
|
|
12
13
|
.withForce("Destroys a secret without confirmation.")
|
|
13
14
|
.action(async (key, options) => {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const Table = require("cli-table");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const logger_1 = require("../logger");
|
|
6
7
|
const projectUtils_1 = require("../projectUtils");
|
|
7
8
|
const secretManager_1 = require("../gcp/secretManager");
|
|
8
|
-
exports.
|
|
9
|
+
exports.command = new command_1.Command("functions:secrets:get <KEY>")
|
|
9
10
|
.description("Get metadata for secret and its versions")
|
|
10
11
|
.action(async (key, options) => {
|
|
11
12
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const backend = require("../deploy/functions/backend");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const projectUtils_1 = require("../projectUtils");
|
|
@@ -9,7 +10,7 @@ const deploymentTool_1 = require("../deploymentTool");
|
|
|
9
10
|
const utils_1 = require("../utils");
|
|
10
11
|
const prompt_1 = require("../prompt");
|
|
11
12
|
const secretManager_1 = require("../gcp/secretManager");
|
|
12
|
-
exports.
|
|
13
|
+
exports.command = new command_1.Command("functions:secrets:prune")
|
|
13
14
|
.withForce("Destroys unused secrets without prompt")
|
|
14
15
|
.description("Destroys unused secrets")
|
|
15
16
|
.before(requirePermissions_1.requirePermissions, [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const tty = require("tty");
|
|
4
5
|
const fs = require("fs");
|
|
5
6
|
const clc = require("cli-color");
|
|
@@ -12,7 +13,7 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
12
13
|
const secretManager_1 = require("../gcp/secretManager");
|
|
13
14
|
const secrets = require("../functions/secrets");
|
|
14
15
|
const backend = require("../deploy/functions/backend");
|
|
15
|
-
exports.
|
|
16
|
+
exports.command = new command_1.Command("functions:secrets:set <KEY>")
|
|
16
17
|
.description("Create or update a secret for use in Cloud Functions for Firebase.")
|
|
17
18
|
.withForce("Automatically updates functions to use the new secret.")
|
|
18
19
|
.before(requirePermissions_1.requirePermissions, [
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
6
|
+
const functionsShellCommandAction_1 = require("../functionsShellCommandAction");
|
|
7
|
+
const requireConfig_1 = require("../requireConfig");
|
|
8
|
+
const commandUtils_1 = require("../emulator/commandUtils");
|
|
9
|
+
exports.command = new command_1.Command("functions:shell")
|
|
8
10
|
.description("launch full Node shell with emulated functions")
|
|
9
11
|
.option("-p, --port <port>", "the port on which to emulate functions")
|
|
10
|
-
.option(
|
|
11
|
-
.before(requireConfig)
|
|
12
|
-
.before(requirePermissions)
|
|
13
|
-
.action(actionFunction);
|
|
12
|
+
.option(commandUtils_1.FLAG_INSPECT_FUNCTIONS, commandUtils_1.DESC_INSPECT_FUNCTIONS)
|
|
13
|
+
.before(requireConfig_1.requireConfig)
|
|
14
|
+
.before(requirePermissions_1.requirePermissions)
|
|
15
|
+
.action(functionsShellCommandAction_1.actionFunction);
|
package/lib/commands/help.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const clc = require("cli-color");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const logger_1 = require("../logger");
|
|
6
7
|
const utils = require("../utils");
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command("help [command]")
|
|
8
9
|
.description("display help information")
|
|
9
10
|
.action(function (commandName) {
|
|
10
11
|
const client = this.client;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const api_1 = require("../hosting/api");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -14,7 +15,7 @@ const requireConfig_1 = require("../requireConfig");
|
|
|
14
15
|
const { marked } = require("marked");
|
|
15
16
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
16
17
|
const LOG_TAG = "hosting:channel";
|
|
17
|
-
exports.
|
|
18
|
+
exports.command = new command_1.Command("hosting:channel:create [channelId]")
|
|
18
19
|
.description("create a Firebase Hosting channel")
|
|
19
20
|
.option("-e, --expires <duration>", "duration string (e.g. 12h or 30d) for channel expiration, max 30d")
|
|
20
21
|
.option("--site <siteId>", "site for which to create the channel")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const { marked } = require("marked");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -11,7 +12,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
12
|
const projectUtils_1 = require("../projectUtils");
|
|
12
13
|
const requireConfig_1 = require("../requireConfig");
|
|
13
14
|
const logger_1 = require("../logger");
|
|
14
|
-
exports.
|
|
15
|
+
exports.command = new command_1.Command("hosting:channel:delete <channelId>")
|
|
15
16
|
.description("delete a Firebase Hosting channel")
|
|
16
17
|
.withForce()
|
|
17
18
|
.option("--site <siteId>", "site in which the channel exists")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const error_1 = require("../error");
|
|
@@ -15,7 +16,7 @@ const utils_1 = require("../utils");
|
|
|
15
16
|
const { marked } = require("marked");
|
|
16
17
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
17
18
|
const LOG_TAG = "hosting:channel";
|
|
18
|
-
exports.
|
|
19
|
+
exports.command = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
19
20
|
.description("deploy to a specific Firebase Hosting channel")
|
|
20
21
|
.option("-e, --expires <duration>", "duration string (e.g. 12h, 30d) for channel expiration, max 30d; defaults to 7d")
|
|
21
22
|
.option("--only <target1,target2...>", "only create previews for specified targets")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const Table = require("cli-table");
|
|
5
6
|
const api_1 = require("../hosting/api");
|
|
@@ -11,7 +12,7 @@ const requireConfig_1 = require("../requireConfig");
|
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
13
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
13
14
|
const TABLE_HEAD = ["Channel ID", "Last Release Time", "URL", "Expire Time"];
|
|
14
|
-
exports.
|
|
15
|
+
exports.command = new command_1.Command("hosting:channel:list")
|
|
15
16
|
.description("list all Firebase Hosting channels for your project")
|
|
16
17
|
.option("--site <siteName>", "list channels for the specified site")
|
|
17
18
|
.before(requireConfig_1.requireConfig)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const lodash_1 = require("lodash");
|
|
4
5
|
const cli_color_1 = require("cli-color");
|
|
5
6
|
const open = require("open");
|
|
@@ -12,7 +13,7 @@ const requireConfig_1 = require("../requireConfig");
|
|
|
12
13
|
const utils_1 = require("../utils");
|
|
13
14
|
const prompt_1 = require("../prompt");
|
|
14
15
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
15
|
-
exports.
|
|
16
|
+
exports.command = new command_1.Command("hosting:channel:open [channelId]")
|
|
16
17
|
.description("opens the URL for a Firebase Hosting channel")
|
|
17
18
|
.help("if unable to open the URL in a browser, it will be displayed in the output")
|
|
18
19
|
.option("--site <siteId>", "the site to which the channel belongs")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const ora = require("ora");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -9,7 +10,7 @@ const utils = require("../utils");
|
|
|
9
10
|
const requireAuth_1 = require("../requireAuth");
|
|
10
11
|
const { marked } = require("marked");
|
|
11
12
|
const logger_1 = require("../logger");
|
|
12
|
-
exports.
|
|
13
|
+
exports.command = new command_1.Command("hosting:clone <source> <targetChannel>")
|
|
13
14
|
.description("clone a version from one site to another")
|
|
14
15
|
.before(requireAuth_1.requireAuth)
|
|
15
16
|
.action(async (source = "", targetChannel = "") => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const clc = require("cli-color");
|
|
4
5
|
const apiv2_1 = require("../apiv2");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -8,7 +9,7 @@ const prompt_1 = require("../prompt");
|
|
|
8
9
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
9
10
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
11
|
const utils = require("../utils");
|
|
11
|
-
exports.
|
|
12
|
+
exports.command = new command_1.Command("hosting:disable")
|
|
12
13
|
.description("stop serving web traffic to your Firebase Hosting site")
|
|
13
14
|
.option("-f, --force", "skip confirmation")
|
|
14
15
|
.option("-s, --site <siteName>", "the site to disable")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const utils_1 = require("../utils");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -10,7 +11,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
10
11
|
const projectUtils_1 = require("../projectUtils");
|
|
11
12
|
const logger_1 = require("../logger");
|
|
12
13
|
const LOG_TAG = "hosting:sites";
|
|
13
|
-
exports.
|
|
14
|
+
exports.command = new command_1.Command("hosting:sites:create [siteId]")
|
|
14
15
|
.description("create a Firebase Hosting site")
|
|
15
16
|
.option("--app <appId>", "specify an existing Firebase Web App ID")
|
|
16
17
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const utils_1 = require("../utils");
|
|
@@ -11,7 +12,7 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
11
12
|
const requireConfig_1 = require("../requireConfig");
|
|
12
13
|
const logger_1 = require("../logger");
|
|
13
14
|
const LOG_TAG = "hosting:sites";
|
|
14
|
-
exports.
|
|
15
|
+
exports.command = new command_1.Command("hosting:sites:delete <siteId>")
|
|
15
16
|
.description("delete a Firebase Hosting site")
|
|
16
17
|
.withForce()
|
|
17
18
|
.before(requireConfig_1.requireConfig)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const Table = require("cli-table");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const api_1 = require("../hosting/api");
|
|
@@ -7,7 +8,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
7
8
|
const projectUtils_1 = require("../projectUtils");
|
|
8
9
|
const logger_1 = require("../logger");
|
|
9
10
|
const error_1 = require("../error");
|
|
10
|
-
exports.
|
|
11
|
+
exports.command = new command_1.Command("hosting:sites:get <siteId>")
|
|
11
12
|
.description("print info about a Firebase Hosting site")
|
|
12
13
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
|
|
13
14
|
.action(async (siteId, options) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const cli_color_1 = require("cli-color");
|
|
4
5
|
const Table = require("cli-table");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -8,7 +9,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
8
9
|
const projectUtils_1 = require("../projectUtils");
|
|
9
10
|
const logger_1 = require("../logger");
|
|
10
11
|
const TABLE_HEAD = ["Site ID", "Default URL", "App ID (if set)"];
|
|
11
|
-
exports.
|
|
12
|
+
exports.command = new command_1.Command("hosting:sites:list")
|
|
12
13
|
.description("list Firebase Hosting sites")
|
|
13
14
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
|
|
14
15
|
.action(async (options) => {
|
package/lib/commands/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.load = void 0;
|
|
4
|
+
const previews_1 = require("../previews");
|
|
5
|
+
function load(client) {
|
|
6
|
+
function loadCommand(name) {
|
|
7
|
+
const t0 = process.hrtime.bigint();
|
|
8
|
+
const { command: cmd } = require(`./${name}`);
|
|
9
9
|
cmd.register(client);
|
|
10
|
+
const t1 = process.hrtime.bigint();
|
|
11
|
+
const diffMS = (t1 - t0) / BigInt(1e6);
|
|
12
|
+
if (diffMS > 75) {
|
|
13
|
+
}
|
|
10
14
|
return cmd.runner();
|
|
11
|
-
}
|
|
15
|
+
}
|
|
16
|
+
const t0 = process.hrtime.bigint();
|
|
12
17
|
client.appdistribution = {};
|
|
13
18
|
client.appdistribution.distribute = loadCommand("appdistribution-distribute");
|
|
14
19
|
client.appdistribution.testers = {};
|
|
@@ -37,7 +42,7 @@ module.exports = function (client) {
|
|
|
37
42
|
client.database.profile = loadCommand("database-profile");
|
|
38
43
|
client.database.push = loadCommand("database-push");
|
|
39
44
|
client.database.remove = loadCommand("database-remove");
|
|
40
|
-
if (previews.rtdbrules) {
|
|
45
|
+
if (previews_1.previews.rtdbrules) {
|
|
41
46
|
client.database.rules = {};
|
|
42
47
|
client.database.rules.get = loadCommand("database-rules-get");
|
|
43
48
|
client.database.rules.list = loadCommand("database-rules-list");
|
|
@@ -66,11 +71,11 @@ module.exports = function (client) {
|
|
|
66
71
|
client.ext.list = loadCommand("ext-list");
|
|
67
72
|
client.ext.uninstall = loadCommand("ext-uninstall");
|
|
68
73
|
client.ext.update = loadCommand("ext-update");
|
|
69
|
-
if (previews.ext) {
|
|
74
|
+
if (previews_1.previews.ext) {
|
|
70
75
|
client.ext.sources = {};
|
|
71
76
|
client.ext.sources.create = loadCommand("ext-sources-create");
|
|
72
77
|
}
|
|
73
|
-
if (previews.extdev) {
|
|
78
|
+
if (previews_1.previews.extdev) {
|
|
74
79
|
client.ext.dev = {};
|
|
75
80
|
client.ext.dev.init = loadCommand("ext-dev-init");
|
|
76
81
|
client.ext.dev.list = loadCommand("ext-dev-list");
|
|
@@ -99,7 +104,7 @@ module.exports = function (client) {
|
|
|
99
104
|
client.functions.log = loadCommand("functions-log");
|
|
100
105
|
client.functions.shell = loadCommand("functions-shell");
|
|
101
106
|
client.functions.list = loadCommand("functions-list");
|
|
102
|
-
if (previews.deletegcfartifacts) {
|
|
107
|
+
if (previews_1.previews.deletegcfartifacts) {
|
|
103
108
|
client.functions.deletegcfartifacts = loadCommand("functions-deletegcfartifacts");
|
|
104
109
|
}
|
|
105
110
|
client.functions.secrets = {};
|
|
@@ -153,5 +158,10 @@ module.exports = function (client) {
|
|
|
153
158
|
client.target.clear = loadCommand("target-clear");
|
|
154
159
|
client.target.remove = loadCommand("target-remove");
|
|
155
160
|
client.use = loadCommand("use");
|
|
161
|
+
const t1 = process.hrtime.bigint();
|
|
162
|
+
const diffMS = (t1 - t0) / BigInt(1e6);
|
|
163
|
+
if (diffMS > 100) {
|
|
164
|
+
}
|
|
156
165
|
return client;
|
|
157
|
-
}
|
|
166
|
+
}
|
|
167
|
+
exports.load = load;
|
package/lib/commands/init.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("cli-color");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const command_1 = require("../command");
|
|
9
|
+
const config_1 = require("../config");
|
|
10
|
+
const auth_1 = require("../auth");
|
|
11
|
+
const init_1 = require("../init");
|
|
12
|
+
const logger_1 = require("../logger");
|
|
13
|
+
const prompt_1 = require("../prompt");
|
|
14
|
+
const requireAuth_1 = require("../requireAuth");
|
|
15
|
+
const fsutils = require("../fsutils");
|
|
16
|
+
const utils = require("../utils");
|
|
17
|
+
const homeDir = os.homedir();
|
|
18
|
+
const TEMPLATE_ROOT = path.resolve(__dirname, "../../templates/");
|
|
19
|
+
const BANNER_TEXT = fs.readFileSync(path.join(TEMPLATE_ROOT, "banner.txt"), "utf8");
|
|
20
|
+
const GITIGNORE_TEMPLATE = fs.readFileSync(path.join(TEMPLATE_ROOT, "_gitignore"), "utf8");
|
|
21
|
+
function isOutside(from, to) {
|
|
22
|
+
return !!/^\.\./.exec(path.relative(from, to));
|
|
23
|
+
}
|
|
21
24
|
const choices = [
|
|
22
25
|
{
|
|
23
26
|
value: "database",
|
|
@@ -70,30 +73,30 @@ ${[...featureNames]
|
|
|
70
73
|
.sort()
|
|
71
74
|
.map((n) => `\n - ${n}`)
|
|
72
75
|
.join("")}`;
|
|
73
|
-
|
|
76
|
+
exports.command = new command_1.Command("init [feature]")
|
|
74
77
|
.description(DESCRIPTION)
|
|
75
|
-
.before(requireAuth)
|
|
76
|
-
.action(
|
|
78
|
+
.before(requireAuth_1.requireAuth)
|
|
79
|
+
.action((feature, options) => {
|
|
77
80
|
if (feature && !featureNames.includes(feature)) {
|
|
78
81
|
return utils.reject(clc.bold(feature) +
|
|
79
82
|
" is not a supported feature; must be one of " +
|
|
80
83
|
featureNames.join(", ") +
|
|
81
|
-
"."
|
|
84
|
+
".");
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (
|
|
86
|
+
const cwd = options.cwd || process.cwd();
|
|
87
|
+
const warnings = [];
|
|
88
|
+
let warningText = "";
|
|
89
|
+
if (isOutside(homeDir, cwd)) {
|
|
87
90
|
warnings.push("You are currently outside your home directory");
|
|
88
91
|
}
|
|
89
92
|
if (cwd === homeDir) {
|
|
90
93
|
warnings.push("You are initializing your home directory as a Firebase project directory");
|
|
91
94
|
}
|
|
92
|
-
|
|
95
|
+
const existingConfig = config_1.Config.load(options, true);
|
|
93
96
|
if (existingConfig) {
|
|
94
97
|
warnings.push("You are initializing within an existing Firebase project directory");
|
|
95
98
|
}
|
|
96
|
-
|
|
99
|
+
const config = existingConfig !== null ? existingConfig : new config_1.Config({}, { projectDir: cwd, cwd: cwd });
|
|
97
100
|
if (warnings.length) {
|
|
98
101
|
warningText =
|
|
99
102
|
"\nBefore we get started, keep in mind:\n\n " +
|
|
@@ -101,21 +104,21 @@ module.exports = new Command("init [feature]")
|
|
|
101
104
|
warnings.join("\n " + clc.yellow.bold("* ")) +
|
|
102
105
|
"\n";
|
|
103
106
|
}
|
|
104
|
-
logger.info(clc.yellow.bold(BANNER_TEXT) +
|
|
107
|
+
logger_1.logger.info(clc.yellow.bold(BANNER_TEXT) +
|
|
105
108
|
"\nYou're about to initialize a Firebase project in this directory:\n\n " +
|
|
106
109
|
clc.bold(config.projectDir) +
|
|
107
110
|
"\n" +
|
|
108
111
|
warningText);
|
|
109
|
-
|
|
112
|
+
const setup = {
|
|
110
113
|
config: config.src,
|
|
111
114
|
rcfile: config.readProjectFile(".firebaserc", {
|
|
112
115
|
json: true,
|
|
113
116
|
fallback: {},
|
|
114
117
|
}),
|
|
115
118
|
};
|
|
116
|
-
|
|
119
|
+
let next;
|
|
117
120
|
if (process.platform === "win32") {
|
|
118
|
-
next = promptOnce({
|
|
121
|
+
next = (0, prompt_1.promptOnce)({
|
|
119
122
|
type: "confirm",
|
|
120
123
|
message: "Are you ready to proceed?",
|
|
121
124
|
});
|
|
@@ -124,7 +127,7 @@ module.exports = new Command("init [feature]")
|
|
|
124
127
|
next = Promise.resolve(true);
|
|
125
128
|
}
|
|
126
129
|
return next
|
|
127
|
-
.then(
|
|
130
|
+
.then((proceed) => {
|
|
128
131
|
if (!proceed) {
|
|
129
132
|
return utils.reject("Aborted by user.", { exit: 1 });
|
|
130
133
|
}
|
|
@@ -133,7 +136,7 @@ module.exports = new Command("init [feature]")
|
|
|
133
136
|
setup.features = [feature];
|
|
134
137
|
return undefined;
|
|
135
138
|
}
|
|
136
|
-
return prompt(setup, [
|
|
139
|
+
return (0, prompt_1.prompt)(setup, [
|
|
137
140
|
{
|
|
138
141
|
type: "checkbox",
|
|
139
142
|
name: "features",
|
|
@@ -143,25 +146,26 @@ module.exports = new Command("init [feature]")
|
|
|
143
146
|
},
|
|
144
147
|
]);
|
|
145
148
|
})
|
|
146
|
-
.then(
|
|
147
|
-
|
|
149
|
+
.then(() => {
|
|
150
|
+
var _a;
|
|
151
|
+
if (!setup.features || ((_a = setup.features) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
148
152
|
return utils.reject("Must select at least one feature. Use " +
|
|
149
153
|
clc.bold.underline("SPACEBAR") +
|
|
150
154
|
" to select features, or specify a feature by running " +
|
|
151
155
|
clc.bold("firebase init [feature_name]"));
|
|
152
156
|
}
|
|
153
157
|
setup.features.unshift("project");
|
|
154
|
-
const allAccounts = getAllAccounts();
|
|
158
|
+
const allAccounts = (0, auth_1.getAllAccounts)();
|
|
155
159
|
if (allAccounts.length > 1) {
|
|
156
160
|
setup.features.unshift("account");
|
|
157
161
|
}
|
|
158
162
|
if (setup.features.includes("hosting") && setup.features.includes("hosting:github")) {
|
|
159
|
-
setup.features = setup.features.filter((f) => f
|
|
163
|
+
setup.features = setup.features.filter((f) => f !== "hosting:github");
|
|
160
164
|
}
|
|
161
|
-
return init(setup, config, options);
|
|
165
|
+
return (0, init_1.init)(setup, config, options);
|
|
162
166
|
})
|
|
163
|
-
.then(
|
|
164
|
-
logger.info();
|
|
167
|
+
.then(() => {
|
|
168
|
+
logger_1.logger.info();
|
|
165
169
|
utils.logBullet("Writing configuration info to " + clc.bold("firebase.json") + "...");
|
|
166
170
|
config.writeProjectFile("firebase.json", setup.config);
|
|
167
171
|
utils.logBullet("Writing project information to " + clc.bold(".firebaserc") + "...");
|
|
@@ -170,7 +174,7 @@ module.exports = new Command("init [feature]")
|
|
|
170
174
|
utils.logBullet("Writing gitignore file to " + clc.bold(".gitignore") + "...");
|
|
171
175
|
config.writeProjectFile(".gitignore", GITIGNORE_TEMPLATE);
|
|
172
176
|
}
|
|
173
|
-
logger.info();
|
|
177
|
+
logger_1.logger.info();
|
|
174
178
|
utils.logSuccess("Firebase initialization complete!");
|
|
175
179
|
});
|
|
176
180
|
});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const clc = require("cli-color");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const logger_1 = require("../logger");
|
|
6
7
|
const utils = require("../utils");
|
|
7
8
|
const error_1 = require("../error");
|
|
8
9
|
const auth = require("../auth");
|
|
9
|
-
|
|
10
|
+
exports.command = new command_1.Command("login:add [email]")
|
|
10
11
|
.description("authorize the CLI for an additional account")
|
|
11
12
|
.option("--no-localhost", "copy and paste a code instead of starting a local server for authentication")
|
|
12
13
|
.action(async (email, options) => {
|
package/lib/commands/login-ci.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const clc = require("cli-color");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const error_1 = require("../error");
|
|
6
7
|
const logger_1 = require("../logger");
|
|
7
8
|
const auth = require("../auth");
|
|
8
9
|
const utils = require("../utils");
|
|
9
|
-
exports.
|
|
10
|
+
exports.command = new command_1.Command("login:ci")
|
|
10
11
|
.description("generate an access token for use in non-interactive environments")
|
|
11
12
|
.option("--no-localhost", "copy and paste a code instead of starting a local server for authentication")
|
|
12
13
|
.action(async (options) => {
|