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,11 +1,12 @@
|
|
|
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 auth = require("../auth");
|
|
8
|
-
|
|
9
|
+
exports.command = new command_1.Command("login:list")
|
|
9
10
|
.description("list authorized CLI accounts")
|
|
10
11
|
.action((options) => {
|
|
11
12
|
const user = options.user;
|
|
@@ -1,11 +1,12 @@
|
|
|
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 utils = require("../utils");
|
|
6
7
|
const auth = require("../auth");
|
|
7
8
|
const error_1 = require("../error");
|
|
8
|
-
|
|
9
|
+
exports.command = new command_1.Command("login:use <email>")
|
|
9
10
|
.description("set the default account to use for this project directory")
|
|
10
11
|
.action((email, options) => {
|
|
11
12
|
const allAccounts = auth.getAllAccounts();
|
package/lib/commands/login.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const _ = require("lodash");
|
|
4
5
|
const clc = require("cli-color");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -10,7 +11,7 @@ const error_1 = require("../error");
|
|
|
10
11
|
const prompt_1 = require("../prompt");
|
|
11
12
|
const auth = require("../auth");
|
|
12
13
|
const utils_1 = require("../utils");
|
|
13
|
-
|
|
14
|
+
exports.command = new command_1.Command("login")
|
|
14
15
|
.description("log the CLI into Firebase")
|
|
15
16
|
.option("--no-localhost", "login from a device without an accessible localhost")
|
|
16
17
|
.option("--reauth", "force reauthentication even if already logged in")
|
package/lib/commands/logout.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 command_1 = require("../command");
|
|
4
5
|
const logger_1 = require("../logger");
|
|
5
6
|
const clc = require("cli-color");
|
|
6
7
|
const utils = require("../utils");
|
|
7
8
|
const auth = require("../auth");
|
|
8
9
|
const prompt_1 = require("../prompt");
|
|
9
|
-
|
|
10
|
+
exports.command = new command_1.Command("logout [email]")
|
|
10
11
|
.description("log the CLI out of Firebase")
|
|
11
12
|
.action(async (email, options) => {
|
|
12
13
|
const globalToken = utils.getInheritedOption(options, "token");
|
package/lib/commands/open.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.command = void 0;
|
|
4
4
|
const clc = require("cli-color");
|
|
5
5
|
const open = require("open");
|
|
6
6
|
const error_1 = require("../error");
|
|
@@ -41,15 +41,15 @@ const LINKS = [
|
|
|
41
41
|
{ name: "Storage: Rules", arg: "storage:rules", consolePath: "/storage/rules" },
|
|
42
42
|
{ name: "Test Lab", arg: "testlab", consolePath: "/testlab/histories/" },
|
|
43
43
|
];
|
|
44
|
-
const CHOICES =
|
|
45
|
-
exports.
|
|
44
|
+
const CHOICES = LINKS.map((l) => l.name);
|
|
45
|
+
exports.command = new command_1.Command("open [link]")
|
|
46
46
|
.description("quickly open a browser to relevant project resources")
|
|
47
47
|
.before(requirePermissions_1.requirePermissions)
|
|
48
48
|
.before(requireDatabaseInstance_1.requireDatabaseInstance)
|
|
49
49
|
.action(async (linkName, options) => {
|
|
50
|
-
let link =
|
|
50
|
+
let link = LINKS.find((l) => l.arg === linkName);
|
|
51
51
|
if (linkName && !link) {
|
|
52
|
-
throw new error_1.FirebaseError("Unrecognized link name. Valid links are:\n\n" +
|
|
52
|
+
throw new error_1.FirebaseError("Unrecognized link name. Valid links are:\n\n" + LINKS.map((l) => l.arg).join("\n"));
|
|
53
53
|
}
|
|
54
54
|
if (!link) {
|
|
55
55
|
const name = await (0, prompt_1.promptOnce)({
|
|
@@ -57,10 +57,10 @@ exports.default = new command_1.Command("open [link]")
|
|
|
57
57
|
message: "What link would you like to open?",
|
|
58
58
|
choices: CHOICES,
|
|
59
59
|
});
|
|
60
|
-
link =
|
|
60
|
+
link = LINKS.find((l) => l.name === name);
|
|
61
61
|
}
|
|
62
62
|
if (!link) {
|
|
63
|
-
throw new error_1.FirebaseError("Unrecognized link name. Valid links are:\n\n" +
|
|
63
|
+
throw new error_1.FirebaseError("Unrecognized link name. Valid links are:\n\n" + LINKS.map((l) => l.arg).join("\n"));
|
|
64
64
|
}
|
|
65
65
|
let url;
|
|
66
66
|
if (link.consolePath) {
|
|
@@ -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 error_1 = require("../error");
|
|
5
6
|
const projects_1 = require("../management/projects");
|
|
6
7
|
const requireAuth_1 = require("../requireAuth");
|
|
7
|
-
|
|
8
|
+
exports.command = new command_1.Command("projects:addfirebase [projectId]")
|
|
8
9
|
.description("add Firebase resources to a Google Cloud Platform project")
|
|
9
10
|
.before(requireAuth_1.requireAuth)
|
|
10
11
|
.action(async (projectId, 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 command_1 = require("../command");
|
|
4
5
|
const error_1 = require("../error");
|
|
5
6
|
const projects_1 = require("../management/projects");
|
|
6
7
|
const prompt_1 = require("../prompt");
|
|
7
8
|
const requireAuth_1 = require("../requireAuth");
|
|
8
|
-
|
|
9
|
+
exports.command = new command_1.Command("projects:create [projectId]")
|
|
9
10
|
.description("creates a new Google Cloud Platform project, then adds Firebase resources to the project")
|
|
10
11
|
.option("-n, --display-name <displayName>", "(optional) display name for the project")
|
|
11
12
|
.option("-o, --organization <organizationId>", "(optional) ID of the parent Google Cloud Platform organization under which to create this project")
|
|
@@ -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 ora = require("ora");
|
|
5
6
|
const Table = require("cli-table");
|
|
@@ -40,7 +41,7 @@ function logProjectCount(arr = []) {
|
|
|
40
41
|
logger_1.logger.info("");
|
|
41
42
|
logger_1.logger.info(`${arr.length} project(s) total.`);
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
exports.command = new command_1.Command("projects:list")
|
|
44
45
|
.description("list all Firebase projects you have access to")
|
|
45
46
|
.before(requireAuth_1.requireAuth)
|
|
46
47
|
.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 rcGet = require("../remoteconfig/get");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
6
|
const requireAuth_1 = require("../requireAuth");
|
|
@@ -20,7 +21,7 @@ function checkValidOptionalNumber(versionNumber) {
|
|
|
20
21
|
}
|
|
21
22
|
throw new error_1.FirebaseError(`Could not interpret "${versionNumber}" as a valid number.`);
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
exports.command = new command_1.Command("remoteconfig:get")
|
|
24
25
|
.description("get a Firebase project's Remote Config template")
|
|
25
26
|
.option("-v, --version-number <versionNumber>", "grabs the specified version of the template")
|
|
26
27
|
.option("-o, --output [filename]", "write config output to a filename (if omitted, will use the default file path)")
|
|
@@ -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 prompt_1 = require("../prompt");
|
|
@@ -8,7 +9,7 @@ const rollback_1 = require("../remoteconfig/rollback");
|
|
|
8
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
9
10
|
const versionslist_1 = require("../remoteconfig/versionslist");
|
|
10
11
|
const projectUtils_1 = require("../projectUtils");
|
|
11
|
-
|
|
12
|
+
exports.command = new command_1.Command("remoteconfig:rollback")
|
|
12
13
|
.description("roll back a project's published Remote Config template to the one specified by the provided version number")
|
|
13
14
|
.before(requireAuth_1.requireAuth)
|
|
14
15
|
.before(requirePermissions_1.requirePermissions, ["cloudconfig.configs.get", "cloudconfig.configs.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 logger_1 = require("../logger");
|
|
4
5
|
const rcVersion = require("../remoteconfig/versionslist");
|
|
5
6
|
const command_1 = require("../command");
|
|
@@ -17,7 +18,7 @@ function pushTableContents(table, version) {
|
|
|
17
18
|
version.updateTime ? (0, utils_1.datetimeString)(new Date(version.updateTime)) : "",
|
|
18
19
|
]);
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
exports.command = new command_1.Command("remoteconfig:versions:list")
|
|
21
22
|
.description("get a list of Remote Config template versions that have been published for a Firebase project")
|
|
22
23
|
.option("--limit <maxResults>", "limit the number of versions being returned. Pass '0' to fetch all versions.")
|
|
23
24
|
.before(requireAuth_1.requireAuth)
|
package/lib/commands/serve.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("cli-color");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const utils = require("../utils");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const requireConfig_1 = require("../requireConfig");
|
|
10
|
+
const index_1 = require("../serve/index");
|
|
11
|
+
const filterTargets_1 = require("../filterTargets");
|
|
12
|
+
const projectUtils_1 = require("../projectUtils");
|
|
13
|
+
const error_1 = require("../error");
|
|
14
|
+
const VALID_TARGETS = ["hosting", "functions"];
|
|
15
|
+
const REQUIRES_AUTH = ["hosting", "functions"];
|
|
16
|
+
const ALL_TARGETS = Array.from(new Set(["database", "firestore", ...VALID_TARGETS]));
|
|
17
|
+
function filterOnly(list, only = "") {
|
|
17
18
|
if (!only) {
|
|
18
19
|
return [];
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
module.exports = new Command("serve")
|
|
21
|
+
const targets = only.split(",").map((o) => o.split(":")[0]);
|
|
22
|
+
return targets.filter((t) => list.includes(t));
|
|
23
|
+
}
|
|
24
|
+
exports.command = new command_1.Command("serve")
|
|
25
25
|
.description("start a local server for your static assets")
|
|
26
26
|
.option("-p, --port <port>", "the port on which to listen (default: 5000)", 5000)
|
|
27
27
|
.option("-o, --host <host>", "the host on which to listen (default: localhost)", "localhost")
|
|
@@ -33,28 +33,28 @@ module.exports = new Command("serve")
|
|
|
33
33
|
filterOnly(REQUIRES_AUTH, options.only).length === 0) {
|
|
34
34
|
return Promise.resolve();
|
|
35
35
|
}
|
|
36
|
-
return requireConfig(options)
|
|
37
|
-
.then(() => requirePermissions(options))
|
|
38
|
-
.then(() => needProjectNumber(options));
|
|
36
|
+
return (0, requireConfig_1.requireConfig)(options)
|
|
37
|
+
.then(() => (0, requirePermissions_1.requirePermissions)(options))
|
|
38
|
+
.then(() => (0, projectUtils_1.needProjectNumber)(options));
|
|
39
39
|
})
|
|
40
40
|
.action((options) => {
|
|
41
41
|
options.targets = filterOnly(ALL_TARGETS, options.only);
|
|
42
42
|
if (options.targets.includes("database") || options.targets.includes("firestore")) {
|
|
43
|
-
throw new FirebaseError(`Please use ${clc.bold("firebase emulators:start")} to start the Realtime Database or Cloud Firestore emulators. ${clc.bold("firebase serve")} only supports Hosting and Cloud Functions.`);
|
|
43
|
+
throw new error_1.FirebaseError(`Please use ${clc.bold("firebase emulators:start")} to start the Realtime Database or Cloud Firestore emulators. ${clc.bold("firebase serve")} only supports Hosting and Cloud Functions.`);
|
|
44
44
|
}
|
|
45
45
|
options.targets = filterOnly(VALID_TARGETS, options.only);
|
|
46
46
|
if (options.targets.length > 0) {
|
|
47
|
-
return serve(options);
|
|
47
|
+
return (0, index_1.serve)(options);
|
|
48
48
|
}
|
|
49
49
|
if (options.config) {
|
|
50
|
-
logger.info();
|
|
51
|
-
logger.info(clc.bold(clc.white("===") + " Serving from '" + options.config.projectDir + "'..."));
|
|
52
|
-
logger.info();
|
|
50
|
+
logger_1.logger.info();
|
|
51
|
+
logger_1.logger.info(clc.bold(clc.white("===") + " Serving from '" + options.config.projectDir + "'..."));
|
|
52
|
+
logger_1.logger.info();
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
utils.logWarning("No Firebase project directory detected. Serving static content from " +
|
|
56
56
|
clc.bold(options.cwd || process.cwd()));
|
|
57
57
|
}
|
|
58
|
-
options.targets = filterTargets(options, VALID_TARGETS);
|
|
59
|
-
return serve(options);
|
|
58
|
+
options.targets = (0, filterTargets_1.filterTargets)(options, VALID_TARGETS);
|
|
59
|
+
return (0, index_1.serve)(options);
|
|
60
60
|
});
|
|
@@ -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 download_1 = require("../emulator/download");
|
|
5
6
|
const types_1 = require("../emulator/types");
|
|
6
7
|
const NAME = types_1.Emulators.DATABASE;
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command(`setup:emulators:${NAME}`)
|
|
8
9
|
.description(`downloads the ${NAME} emulator`)
|
|
9
10
|
.action(() => {
|
|
10
11
|
return (0, download_1.downloadEmulator)(NAME);
|
|
@@ -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 download_1 = require("../emulator/download");
|
|
5
6
|
const types_1 = require("../emulator/types");
|
|
6
7
|
const NAME = types_1.Emulators.FIRESTORE;
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command(`setup:emulators:${NAME}`)
|
|
8
9
|
.description(`downloads the ${NAME} emulator`)
|
|
9
10
|
.action(() => {
|
|
10
11
|
return (0, download_1.downloadEmulator)(NAME);
|
|
@@ -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 download_1 = require("../emulator/download");
|
|
5
6
|
const types_1 = require("../emulator/types");
|
|
6
7
|
const EMULATOR_NAME = types_1.Emulators.PUBSUB;
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
|
|
8
9
|
.description(`downloads the ${EMULATOR_NAME} emulator`)
|
|
9
10
|
.action(() => {
|
|
10
11
|
return (0, download_1.downloadEmulator)(EMULATOR_NAME);
|
|
@@ -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 download_1 = require("../emulator/download");
|
|
5
6
|
const types_1 = require("../emulator/types");
|
|
6
7
|
const EMULATOR_NAME = types_1.Emulators.STORAGE;
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
|
|
8
9
|
.description(`downloads the ${EMULATOR_NAME} emulator`)
|
|
9
10
|
.action(() => {
|
|
10
11
|
return (0, download_1.downloadEmulator)(EMULATOR_NAME);
|
|
@@ -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 download_1 = require("../emulator/download");
|
|
5
6
|
const types_1 = require("../emulator/types");
|
|
6
7
|
const NAME = types_1.Emulators.UI;
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command(`setup:emulators:${NAME}`)
|
|
8
9
|
.description(`downloads the ${NAME} emulator`)
|
|
9
10
|
.action(() => {
|
|
10
11
|
return (0, download_1.downloadEmulator)(NAME);
|
|
@@ -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 requireConfig_1 = require("../requireConfig");
|
|
7
8
|
const utils = require("../utils");
|
|
8
9
|
const error_1 = require("../error");
|
|
9
|
-
exports.
|
|
10
|
+
exports.command = new command_1.Command("target:apply <type> <name> <resources...>")
|
|
10
11
|
.description("apply a deploy target to a resource")
|
|
11
12
|
.before(requireConfig_1.requireConfig)
|
|
12
13
|
.action((type, name, resources, options) => {
|
|
@@ -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 requireConfig_1 = require("../requireConfig");
|
|
6
7
|
const utils = require("../utils");
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command("target:clear <type> <target>")
|
|
8
9
|
.description("clear all resources from a named resource target")
|
|
9
10
|
.before(requireConfig_1.requireConfig)
|
|
10
11
|
.action((type, name, options) => {
|
|
@@ -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 requireConfig_1 = require("../requireConfig");
|
|
6
7
|
const utils = require("../utils");
|
|
7
|
-
exports.
|
|
8
|
+
exports.command = new command_1.Command("target:remove <type> <resource>")
|
|
8
9
|
.description("remove a resource target")
|
|
9
10
|
.before(requireConfig_1.requireConfig)
|
|
10
11
|
.action((type, resource, options) => {
|
package/lib/commands/target.js
CHANGED
|
@@ -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 command_1 = require("../command");
|
|
5
6
|
const logger_1 = require("../logger");
|
|
@@ -11,7 +12,7 @@ function logTargets(type, targets) {
|
|
|
11
12
|
logger_1.logger.info(name, "(" + (resources || []).join(",") + ")");
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
exports.
|
|
15
|
+
exports.command = new command_1.Command("target [type]")
|
|
15
16
|
.description("display configured deploy targets for the current project")
|
|
16
17
|
.before(requireConfig_1.requireConfig)
|
|
17
18
|
.action((type, options) => {
|
package/lib/commands/use.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("cli-color");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const projects_1 = require("../management/projects");
|
|
7
|
+
const logger_1 = require("../logger");
|
|
8
|
+
const prompt_1 = require("../prompt");
|
|
9
|
+
const requireAuth_1 = require("../requireAuth");
|
|
10
|
+
const command_2 = require("../command");
|
|
11
|
+
const utils = require("../utils");
|
|
12
|
+
function listAliases(options) {
|
|
12
13
|
if (options.rc.hasProjects) {
|
|
13
|
-
logger.info("Project aliases for", clc.bold(options.projectRoot) + ":");
|
|
14
|
-
logger.info();
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
logger_1.logger.info("Project aliases for", clc.bold(options.projectRoot) + ":");
|
|
15
|
+
logger_1.logger.info();
|
|
16
|
+
for (const [alias, projectId] of Object.entries(options.rc.projects)) {
|
|
17
|
+
const listing = alias + " (" + projectId + ")";
|
|
17
18
|
if (options.project === projectId || options.projectAlias === alias) {
|
|
18
|
-
logger.info(clc.cyan.bold("* " + listing));
|
|
19
|
+
logger_1.logger.info(clc.cyan.bold("* " + listing));
|
|
19
20
|
}
|
|
20
21
|
else {
|
|
21
|
-
logger.info(" " + listing);
|
|
22
|
+
logger_1.logger.info(" " + listing);
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
-
logger.info();
|
|
24
|
+
}
|
|
25
|
+
logger_1.logger.info();
|
|
25
26
|
}
|
|
26
|
-
logger.info("Run", clc.bold("firebase use --add"), "to define a new project alias.");
|
|
27
|
-
}
|
|
28
|
-
|
|
27
|
+
logger_1.logger.info("Run", clc.bold("firebase use --add"), "to define a new project alias.");
|
|
28
|
+
}
|
|
29
|
+
function verifyMessage(name) {
|
|
29
30
|
return "please verify project " + clc.bold(name) + " exists and you have access.";
|
|
30
|
-
}
|
|
31
|
-
|
|
31
|
+
}
|
|
32
|
+
exports.command = new command_1.Command("use [alias_or_project_id]")
|
|
32
33
|
.description("set an active Firebase project for your working directory")
|
|
33
34
|
.option("--add", "create a new project alias interactively")
|
|
34
35
|
.option("--alias <name>", "create a new alias for the provided project id")
|
|
35
36
|
.option("--unalias <name>", "remove an already created project alias")
|
|
36
37
|
.option("--clear", "clear the active project selection")
|
|
37
|
-
.before(requireAuth)
|
|
38
|
-
.action(
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
.before(requireAuth_1.requireAuth)
|
|
39
|
+
.action((newActive, options) => {
|
|
40
|
+
let aliasOpt;
|
|
41
|
+
const i = process.argv.indexOf("--alias");
|
|
41
42
|
if (i >= 0 && process.argv.length > i + 1) {
|
|
42
43
|
aliasOpt = process.argv[i + 1];
|
|
43
44
|
}
|
|
@@ -48,11 +49,11 @@ module.exports = new Command("use [alias_or_project_id]")
|
|
|
48
49
|
" to start a project directory in the current folder.");
|
|
49
50
|
}
|
|
50
51
|
if (newActive) {
|
|
51
|
-
|
|
52
|
+
let project;
|
|
52
53
|
const hasAlias = options.rc.hasProjectAlias(newActive);
|
|
53
54
|
const resolvedProject = options.rc.resolveAlias(newActive);
|
|
54
|
-
validateProjectId(resolvedProject);
|
|
55
|
-
return getFirebaseProject(resolvedProject)
|
|
55
|
+
(0, command_2.validateProjectId)(resolvedProject);
|
|
56
|
+
return (0, projects_1.getFirebaseProject)(resolvedProject)
|
|
56
57
|
.then((foundProject) => {
|
|
57
58
|
project = foundProject;
|
|
58
59
|
})
|
|
@@ -65,18 +66,18 @@ module.exports = new Command("use [alias_or_project_id]")
|
|
|
65
66
|
return utils.reject("Cannot create alias " + clc.bold(aliasOpt) + ", " + verifyMessage(newActive));
|
|
66
67
|
}
|
|
67
68
|
options.rc.addProjectAlias(aliasOpt, newActive);
|
|
68
|
-
logger.info("Created alias", clc.bold(aliasOpt), "for", resolvedProject + ".");
|
|
69
|
+
logger_1.logger.info("Created alias", clc.bold(aliasOpt), "for", resolvedProject + ".");
|
|
69
70
|
}
|
|
70
71
|
if (hasAlias) {
|
|
71
72
|
if (!project) {
|
|
72
73
|
return utils.reject("Unable to use alias " + clc.bold(newActive) + ", " + verifyMessage(resolvedProject));
|
|
73
74
|
}
|
|
74
75
|
utils.makeActiveProject(options.projectRoot, newActive);
|
|
75
|
-
logger.info("Now using alias", clc.bold(newActive), "(" + resolvedProject + ")");
|
|
76
|
+
logger_1.logger.info("Now using alias", clc.bold(newActive), "(" + resolvedProject + ")");
|
|
76
77
|
}
|
|
77
78
|
else if (project) {
|
|
78
79
|
utils.makeActiveProject(options.projectRoot, newActive);
|
|
79
|
-
logger.info("Now using project", clc.bold(newActive));
|
|
80
|
+
logger_1.logger.info("Now using project", clc.bold(newActive));
|
|
80
81
|
}
|
|
81
82
|
else {
|
|
82
83
|
return utils.reject("Invalid project selection, " + verifyMessage(newActive));
|
|
@@ -86,8 +87,8 @@ module.exports = new Command("use [alias_or_project_id]")
|
|
|
86
87
|
else if (options.unalias) {
|
|
87
88
|
if (options.rc.hasProjectAlias(options.unalias)) {
|
|
88
89
|
options.rc.removeProjectAlias(options.unalias);
|
|
89
|
-
logger.info("Removed alias", clc.bold(options.unalias));
|
|
90
|
-
logger.info();
|
|
90
|
+
logger_1.logger.info("Removed alias", clc.bold(options.unalias));
|
|
91
|
+
logger_1.logger.info();
|
|
91
92
|
listAliases(options);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -99,9 +100,9 @@ module.exports = new Command("use [alias_or_project_id]")
|
|
|
99
100
|
clc.bold("firebase use <project_id> --alias <alias>") +
|
|
100
101
|
" instead.");
|
|
101
102
|
}
|
|
102
|
-
return listFirebaseProjects().then(
|
|
103
|
-
|
|
104
|
-
return prompt(results, [
|
|
103
|
+
return (0, projects_1.listFirebaseProjects)().then((projects) => {
|
|
104
|
+
const results = {};
|
|
105
|
+
return (0, prompt_1.prompt)(results, [
|
|
105
106
|
{
|
|
106
107
|
type: "list",
|
|
107
108
|
name: "project",
|
|
@@ -112,49 +113,49 @@ module.exports = new Command("use [alias_or_project_id]")
|
|
|
112
113
|
type: "input",
|
|
113
114
|
name: "alias",
|
|
114
115
|
message: "What alias do you want to use for this project? (e.g. staging)",
|
|
115
|
-
validate:
|
|
116
|
+
validate: (input) => {
|
|
116
117
|
return input && input.length > 0;
|
|
117
118
|
},
|
|
118
119
|
},
|
|
119
|
-
]).then(
|
|
120
|
+
]).then(() => {
|
|
120
121
|
options.rc.addProjectAlias(results.alias, results.project);
|
|
121
122
|
utils.makeActiveProject(options.projectRoot, results.alias);
|
|
122
|
-
logger.info();
|
|
123
|
-
logger.info("Created alias", clc.bold(results.alias), "for", results.project + ".");
|
|
124
|
-
logger.info("Now using alias", clc.bold(results.alias) + " (" + results.project + ")");
|
|
123
|
+
logger_1.logger.info();
|
|
124
|
+
logger_1.logger.info("Created alias", clc.bold(results.alias), "for", results.project + ".");
|
|
125
|
+
logger_1.logger.info("Now using alias", clc.bold(results.alias) + " (" + results.project + ")");
|
|
125
126
|
});
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
129
|
else if (options.clear) {
|
|
129
|
-
utils.makeActiveProject(options.projectRoot,
|
|
130
|
+
utils.makeActiveProject(options.projectRoot, undefined);
|
|
130
131
|
options.projectAlias = null;
|
|
131
132
|
options.project = null;
|
|
132
|
-
logger.info("Cleared active project.");
|
|
133
|
-
logger.info();
|
|
133
|
+
logger_1.logger.info("Cleared active project.");
|
|
134
|
+
logger_1.logger.info();
|
|
134
135
|
listAliases(options);
|
|
135
136
|
}
|
|
136
137
|
else {
|
|
137
138
|
if (options.nonInteractive || !process.stdout.isTTY) {
|
|
138
139
|
if (options.project) {
|
|
139
|
-
logger.info(options.project);
|
|
140
|
+
logger_1.logger.info(options.project);
|
|
140
141
|
return options.project;
|
|
141
142
|
}
|
|
142
|
-
return utils.reject("No active project"
|
|
143
|
+
return utils.reject("No active project");
|
|
143
144
|
}
|
|
144
145
|
if (options.projectAlias) {
|
|
145
|
-
logger.info("Active Project:", clc.bold.cyan(options.projectAlias + " (" + options.project + ")"));
|
|
146
|
+
logger_1.logger.info("Active Project:", clc.bold.cyan(options.projectAlias + " (" + options.project + ")"));
|
|
146
147
|
}
|
|
147
148
|
else if (options.project) {
|
|
148
|
-
logger.info("Active Project:", clc.bold.cyan(options.project));
|
|
149
|
+
logger_1.logger.info("Active Project:", clc.bold.cyan(options.project));
|
|
149
150
|
}
|
|
150
151
|
else {
|
|
151
|
-
|
|
152
|
+
let msg = "No project is currently active";
|
|
152
153
|
if (options.rc.hasProjects) {
|
|
153
154
|
msg += ", and no aliases have been created.";
|
|
154
155
|
}
|
|
155
|
-
logger.info(msg + ".");
|
|
156
|
+
logger_1.logger.info(msg + ".");
|
|
156
157
|
}
|
|
157
|
-
logger.info();
|
|
158
|
+
logger_1.logger.info();
|
|
158
159
|
listAliases(options);
|
|
159
160
|
return options.project;
|
|
160
161
|
}
|