firebase-tools 11.5.0 → 11.8.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/command.js +33 -7
- package/lib/commands/crashlytics-mappingfile-generateid.js +26 -0
- package/lib/commands/crashlytics-mappingfile-upload.js +46 -0
- package/lib/commands/crashlytics-symbols-upload.js +18 -87
- package/lib/commands/emulators-exec.js +4 -1
- package/lib/commands/emulators-export.js +5 -2
- package/lib/commands/emulators-start.js +23 -17
- package/lib/commands/ext-dev-publish.js +3 -0
- package/lib/commands/functions-delete.js +2 -0
- package/lib/commands/functions-secrets-get.js +2 -0
- package/lib/commands/index.js +3 -0
- package/lib/commands/login.js +2 -2
- package/lib/crashlytics/buildToolsJarHelper.js +51 -0
- package/lib/deploy/functions/backend.js +4 -4
- package/lib/deploy/functions/build.js +76 -9
- package/lib/deploy/functions/checkIam.js +6 -5
- package/lib/deploy/functions/params.js +22 -16
- package/lib/deploy/functions/prepare.js +1 -1
- package/lib/deploy/functions/release/fabricator.js +22 -5
- package/lib/deploy/functions/release/index.js +2 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +1 -16
- package/lib/deploy/functions/runtimes/discovery/parsing.js +16 -0
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +59 -131
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +1 -1
- package/lib/emulator/auth/index.js +7 -2
- package/lib/emulator/auth/operations.js +10 -10
- package/lib/emulator/commandUtils.js +32 -15
- package/lib/emulator/constants.js +14 -6
- package/lib/emulator/controller.js +49 -17
- package/lib/emulator/downloadableEmulators.js +7 -7
- package/lib/emulator/eventarcEmulator.js +148 -0
- package/lib/emulator/extensionsEmulator.js +3 -1
- package/lib/emulator/functionsEmulator.js +44 -4
- package/lib/emulator/functionsEmulatorRuntime.js +12 -23
- package/lib/emulator/functionsEmulatorShared.js +6 -1
- package/lib/emulator/hub.js +7 -3
- package/lib/emulator/hubClient.js +2 -2
- package/lib/emulator/hubExport.js +22 -2
- package/lib/emulator/registry.js +1 -0
- package/lib/emulator/storage/apis/firebase.js +145 -129
- package/lib/emulator/storage/apis/gcloud.js +102 -42
- package/lib/emulator/storage/files.js +39 -17
- package/lib/emulator/storage/metadata.js +76 -55
- package/lib/emulator/storage/multipart.js +2 -2
- package/lib/emulator/storage/rules/runtime.js +12 -4
- package/lib/emulator/storage/server.js +2 -1
- package/lib/emulator/storage/upload.js +46 -9
- package/lib/emulator/types.js +3 -0
- package/lib/emulator/ui.js +7 -2
- package/lib/extensions/extensionsApi.js +2 -1
- package/lib/extensions/extensionsHelper.js +29 -1
- package/lib/functions/constants.js +14 -0
- package/lib/functions/env.js +9 -9
- package/lib/gcp/cloudfunctions.js +15 -18
- package/lib/gcp/cloudfunctionsv2.js +15 -18
- package/lib/gcp/cloudscheduler.js +32 -14
- package/lib/serve/index.js +15 -0
- package/lib/track.js +122 -3
- package/lib/utils.js +14 -1
- package/npm-shrinkwrap.json +542 -9
- package/package.json +5 -4
- package/schema/firebase-config.json +12 -0
- package/templates/extensions/CHANGELOG.md +1 -7
package/lib/command.js
CHANGED
|
@@ -70,22 +70,39 @@ class Command {
|
|
|
70
70
|
this.positionalArgs = cmd._args;
|
|
71
71
|
cmd.action((...args) => {
|
|
72
72
|
const runner = this.runner();
|
|
73
|
-
const start =
|
|
73
|
+
const start = process.uptime();
|
|
74
74
|
const options = (0, lodash_1.last)(args);
|
|
75
75
|
if (args.length - 1 > cmd._args.length) {
|
|
76
76
|
client.errorOut(new error_1.FirebaseError(`Too many arguments. Run ${clc.bold("firebase help " + this.name)} for usage instructions`, { exit: 1 }));
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
+
const isEmulator = this.name.includes("emulator") || this.name === "serve";
|
|
80
|
+
if (isEmulator) {
|
|
81
|
+
void (0, track_1.trackEmulator)("command_start", { command_name: this.name });
|
|
82
|
+
}
|
|
79
83
|
runner(...args)
|
|
80
|
-
.then((result) => {
|
|
84
|
+
.then(async (result) => {
|
|
81
85
|
if ((0, utils_1.getInheritedOption)(options, "json")) {
|
|
82
86
|
console.log(JSON.stringify({
|
|
83
87
|
status: "success",
|
|
84
88
|
result: result,
|
|
85
89
|
}, null, 2));
|
|
86
90
|
}
|
|
87
|
-
const duration =
|
|
88
|
-
|
|
91
|
+
const duration = Math.floor((process.uptime() - start) * 1000);
|
|
92
|
+
const trackSuccess = (0, track_1.track)(this.name, "success", duration);
|
|
93
|
+
if (!isEmulator) {
|
|
94
|
+
await (0, utils_1.withTimeout)(5000, trackSuccess);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
await (0, utils_1.withTimeout)(5000, Promise.all([
|
|
98
|
+
trackSuccess,
|
|
99
|
+
(0, track_1.trackEmulator)("command_success", {
|
|
100
|
+
command_name: this.name,
|
|
101
|
+
duration,
|
|
102
|
+
}),
|
|
103
|
+
]));
|
|
104
|
+
}
|
|
105
|
+
process.exit();
|
|
89
106
|
})
|
|
90
107
|
.catch(async (err) => {
|
|
91
108
|
if ((0, utils_1.getInheritedOption)(options, "json")) {
|
|
@@ -94,9 +111,18 @@ class Command {
|
|
|
94
111
|
error: err.message,
|
|
95
112
|
}, null, 2));
|
|
96
113
|
}
|
|
97
|
-
const duration =
|
|
98
|
-
|
|
99
|
-
|
|
114
|
+
const duration = Math.floor((process.uptime() - start) * 1000);
|
|
115
|
+
await (0, utils_1.withTimeout)(5000, Promise.all([
|
|
116
|
+
(0, track_1.track)(this.name, "error", duration),
|
|
117
|
+
(0, track_1.track)(err.exit === 1 ? "Error (User)" : "Error (Unexpected)", "", duration),
|
|
118
|
+
isEmulator
|
|
119
|
+
? (0, track_1.trackEmulator)("command_error", {
|
|
120
|
+
command_name: this.name,
|
|
121
|
+
duration,
|
|
122
|
+
error_type: err.exit === 1 ? "user" : "unexpected",
|
|
123
|
+
})
|
|
124
|
+
: Promise.resolve(),
|
|
125
|
+
]));
|
|
100
126
|
client.errorOut(err);
|
|
101
127
|
});
|
|
102
128
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const utils = require("../utils");
|
|
6
|
+
const buildToolsJarHelper_1 = require("../crashlytics/buildToolsJarHelper");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
exports.command = new command_1.Command("crashlytics:mappingfile:generateid")
|
|
9
|
+
.description("generate a mapping file id and write it to an Android resource file, which will be built into the app")
|
|
10
|
+
.option("--resource-file <resourceFile>", "path to the Android resource XML file that will be created or updated.")
|
|
11
|
+
.action(async (options) => {
|
|
12
|
+
const debug = !!options.debug;
|
|
13
|
+
const resourceFilePath = options.resourceFile;
|
|
14
|
+
if (!resourceFilePath) {
|
|
15
|
+
throw new error_1.FirebaseError("set --resource-file <resourceFile> to an Android resource file path, e.g. app/src/main/res/values/crashlytics.xml");
|
|
16
|
+
}
|
|
17
|
+
const jarFile = await (0, buildToolsJarHelper_1.fetchBuildtoolsJar)();
|
|
18
|
+
const jarOptions = { resourceFilePath };
|
|
19
|
+
utils.logBullet(`Updating resource file: ${resourceFilePath}`);
|
|
20
|
+
const generateIdArgs = buildArgs(jarOptions);
|
|
21
|
+
(0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, generateIdArgs, debug);
|
|
22
|
+
utils.logBullet("Successfully updated mapping file id");
|
|
23
|
+
});
|
|
24
|
+
function buildArgs(options) {
|
|
25
|
+
return ["-injectMappingFileIdIntoResource", options.resourceFilePath, "-verbose"];
|
|
26
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
const buildToolsJarHelper_1 = require("../crashlytics/buildToolsJarHelper");
|
|
8
|
+
exports.command = new command_1.Command("crashlytics:mappingfile:upload <mappingFile>")
|
|
9
|
+
.description("upload a ProGuard/R8-compatible mapping file to deobfuscate stack traces")
|
|
10
|
+
.option("--app <appID>", "the app id of your Firebase app")
|
|
11
|
+
.option("--resource-file <resourceFile>", "path to the Android resource XML file that includes the mapping file id")
|
|
12
|
+
.action(async (mappingFile, options) => {
|
|
13
|
+
const app = getGoogleAppID(options);
|
|
14
|
+
const debug = !!options.debug;
|
|
15
|
+
if (!mappingFile) {
|
|
16
|
+
throw new error_1.FirebaseError("set `--mapping-file <mappingFile>` to a valid mapping file path, e.g. app/build/outputs/mapping.txt");
|
|
17
|
+
}
|
|
18
|
+
const mappingFilePath = mappingFile;
|
|
19
|
+
const resourceFilePath = options.resourceFile;
|
|
20
|
+
if (!resourceFilePath) {
|
|
21
|
+
throw new error_1.FirebaseError("set --resource-file <resourceFile> to a valid Android resource file path, e.g. app/main/res/values/strings.xml");
|
|
22
|
+
}
|
|
23
|
+
const jarFile = await (0, buildToolsJarHelper_1.fetchBuildtoolsJar)();
|
|
24
|
+
const jarOptions = { app, mappingFilePath, resourceFilePath };
|
|
25
|
+
utils.logBullet(`Uploading mapping file: ${mappingFilePath}`);
|
|
26
|
+
const uploadArgs = buildArgs(jarOptions);
|
|
27
|
+
(0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, uploadArgs, debug);
|
|
28
|
+
utils.logBullet("Successfully uploaded mapping file");
|
|
29
|
+
});
|
|
30
|
+
function getGoogleAppID(options) {
|
|
31
|
+
if (!options.app) {
|
|
32
|
+
throw new error_1.FirebaseError("set --app <appId> to a valid Firebase application id, e.g. 1:00000000:android:0000000");
|
|
33
|
+
}
|
|
34
|
+
return options.app;
|
|
35
|
+
}
|
|
36
|
+
function buildArgs(options) {
|
|
37
|
+
return [
|
|
38
|
+
"-uploadMappingFile",
|
|
39
|
+
options.mappingFilePath,
|
|
40
|
+
"-resourceFile",
|
|
41
|
+
options.resourceFilePath,
|
|
42
|
+
"-googleAppId",
|
|
43
|
+
options.app,
|
|
44
|
+
"-verbose",
|
|
45
|
+
];
|
|
46
|
+
}
|
|
@@ -1,44 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
|
-
const fs = require("fs-extra");
|
|
5
4
|
const os = require("os");
|
|
6
5
|
const path = require("path");
|
|
7
|
-
const spawn = require("cross-spawn");
|
|
8
6
|
const uuid = require("uuid");
|
|
9
7
|
const command_1 = require("../command");
|
|
10
|
-
const downloadUtils = require("../downloadUtils");
|
|
11
8
|
const error_1 = require("../error");
|
|
12
|
-
const logger_1 = require("../logger");
|
|
13
|
-
const rimraf = require("rimraf");
|
|
14
9
|
const utils = require("../utils");
|
|
10
|
+
const buildToolsJarHelper_1 = require("../crashlytics/buildToolsJarHelper");
|
|
15
11
|
var SymbolGenerator;
|
|
16
12
|
(function (SymbolGenerator) {
|
|
17
13
|
SymbolGenerator["breakpad"] = "breakpad";
|
|
18
14
|
SymbolGenerator["csym"] = "csym";
|
|
19
15
|
})(SymbolGenerator || (SymbolGenerator = {}));
|
|
20
16
|
const SYMBOL_CACHE_ROOT_DIR = process.env.FIREBASE_CRASHLYTICS_CACHE_PATH || os.tmpdir();
|
|
21
|
-
const JAR_CACHE_DIR = process.env.FIREBASE_CRASHLYTICS_BUILDTOOLS_PATH ||
|
|
22
|
-
path.join(os.homedir(), ".cache", "firebase", "crashlytics", "buildtools");
|
|
23
|
-
const JAR_VERSION = "2.8.0";
|
|
24
|
-
const JAR_URL = `https://dl.google.com/android/maven2/com/google/firebase/firebase-crashlytics-buildtools/${JAR_VERSION}/firebase-crashlytics-buildtools-${JAR_VERSION}.jar`;
|
|
25
17
|
exports.command = new command_1.Command("crashlytics:symbols:upload <symbolFiles...>")
|
|
26
|
-
.description("
|
|
18
|
+
.description("upload symbols for native code, to symbolicate stack traces")
|
|
27
19
|
.option("--app <appID>", "the app id of your Firebase app")
|
|
28
|
-
.option("--generator [breakpad|csym]", "the symbol generator being used,
|
|
20
|
+
.option("--generator [breakpad|csym]", "the symbol generator being used, default is breakpad")
|
|
29
21
|
.option("--dry-run", "generate symbols without uploading them")
|
|
30
|
-
.option("--debug", "print debug output and logging from the underlying uploader tool")
|
|
31
22
|
.action(async (symbolFiles, options) => {
|
|
32
|
-
const app = getGoogleAppID(options)
|
|
23
|
+
const app = getGoogleAppID(options);
|
|
33
24
|
const generator = getSymbolGenerator(options);
|
|
34
25
|
const dryRun = !!options.dryRun;
|
|
35
26
|
const debug = !!options.debug;
|
|
36
|
-
|
|
37
|
-
if (process.env.LOCAL_JAR) {
|
|
38
|
-
jarFile = process.env.LOCAL_JAR;
|
|
39
|
-
}
|
|
27
|
+
const jarFile = await (0, buildToolsJarHelper_1.fetchBuildtoolsJar)();
|
|
40
28
|
const jarOptions = {
|
|
41
|
-
jarFile,
|
|
42
29
|
app,
|
|
43
30
|
generator,
|
|
44
31
|
cachePath: path.join(SYMBOL_CACHE_ROOT_DIR, `crashlytics-${uuid.v4()}`, "nativeSymbols", app.replace(/:/g, "-"), generator),
|
|
@@ -48,32 +35,22 @@ exports.command = new command_1.Command("crashlytics:symbols:upload <symbolFiles
|
|
|
48
35
|
for (const symbolFile of symbolFiles) {
|
|
49
36
|
utils.logBullet(`Generating symbols for ${symbolFile}`);
|
|
50
37
|
const generateArgs = buildArgs(Object.assign(Object.assign({}, jarOptions), { symbolFile }));
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
utils.logBullet(`Generated symbols for ${symbolFile}`);
|
|
57
|
-
utils.logBullet(`Output Path: ${jarOptions.cachePath}`);
|
|
58
|
-
}
|
|
38
|
+
(0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, generateArgs, debug);
|
|
39
|
+
utils.logBullet(`Generated symbols for ${symbolFile}`);
|
|
40
|
+
utils.logBullet(`Output Path: ${jarOptions.cachePath}`);
|
|
59
41
|
}
|
|
60
42
|
if (dryRun) {
|
|
61
43
|
utils.logBullet("Skipping upload because --dry-run was passed");
|
|
62
44
|
return;
|
|
63
45
|
}
|
|
64
|
-
utils.logBullet(`Uploading all generated symbols
|
|
46
|
+
utils.logBullet(`Uploading all generated symbols...`);
|
|
65
47
|
const uploadArgs = buildArgs(Object.assign(Object.assign({}, jarOptions), { generate: false }));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
utils.logBullet(output);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
utils.logBullet("Successfully uploaded all symbols");
|
|
72
|
-
}
|
|
48
|
+
(0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, uploadArgs, debug);
|
|
49
|
+
utils.logBullet("Successfully uploaded all symbols");
|
|
73
50
|
});
|
|
74
51
|
function getGoogleAppID(options) {
|
|
75
52
|
if (!options.app) {
|
|
76
|
-
throw new error_1.FirebaseError("set
|
|
53
|
+
throw new error_1.FirebaseError("set --app <appId> to a valid Firebase application id, e.g. 1:00000000:android:0000000");
|
|
77
54
|
}
|
|
78
55
|
return options.app;
|
|
79
56
|
}
|
|
@@ -86,62 +63,16 @@ function getSymbolGenerator(options) {
|
|
|
86
63
|
}
|
|
87
64
|
return options.generator;
|
|
88
65
|
}
|
|
89
|
-
async function downloadBuiltoolsJar() {
|
|
90
|
-
const jarPath = path.join(JAR_CACHE_DIR, `crashlytics-buildtools-${JAR_VERSION}.jar`);
|
|
91
|
-
if (fs.existsSync(jarPath)) {
|
|
92
|
-
logger_1.logger.debug(`Buildtools Jar already downloaded at ${jarPath}`);
|
|
93
|
-
return jarPath;
|
|
94
|
-
}
|
|
95
|
-
if (fs.existsSync(JAR_CACHE_DIR)) {
|
|
96
|
-
logger_1.logger.debug(`Deleting Jar cache at ${JAR_CACHE_DIR} because the CLI was run with a newer Jar version`);
|
|
97
|
-
rimraf.sync(JAR_CACHE_DIR);
|
|
98
|
-
}
|
|
99
|
-
utils.logBullet("Downloading buildtools.jar to " + jarPath);
|
|
100
|
-
utils.logBullet("For open source licenses used by this command, look in the META-INF directory in the buildtools.jar file");
|
|
101
|
-
const tmpfile = await downloadUtils.downloadToTmp(JAR_URL);
|
|
102
|
-
fs.mkdirSync(JAR_CACHE_DIR, { recursive: true });
|
|
103
|
-
fs.copySync(tmpfile, jarPath);
|
|
104
|
-
return jarPath;
|
|
105
|
-
}
|
|
106
66
|
function buildArgs(options) {
|
|
107
67
|
const baseArgs = [
|
|
108
|
-
"-
|
|
109
|
-
options.
|
|
110
|
-
|
|
111
|
-
|
|
68
|
+
"-symbolGenerator",
|
|
69
|
+
options.generator,
|
|
70
|
+
"-symbolFileCacheDir",
|
|
71
|
+
options.cachePath,
|
|
112
72
|
"-verbose",
|
|
113
73
|
];
|
|
114
74
|
if (options.generate) {
|
|
115
|
-
return baseArgs.concat(["-generateNativeSymbols",
|
|
116
|
-
}
|
|
117
|
-
return baseArgs.concat([
|
|
118
|
-
"-uploadNativeSymbols",
|
|
119
|
-
`-googleAppId=${options.app}`,
|
|
120
|
-
]);
|
|
121
|
-
}
|
|
122
|
-
function runJar(args, debug) {
|
|
123
|
-
var _a, _b, _c;
|
|
124
|
-
const outputs = spawn.sync("java", args, {
|
|
125
|
-
stdio: debug ? "inherit" : "pipe",
|
|
126
|
-
});
|
|
127
|
-
if (outputs.status || 0 > 0) {
|
|
128
|
-
if (!debug) {
|
|
129
|
-
utils.logWarning(((_a = outputs.stdout) === null || _a === void 0 ? void 0 : _a.toString()) || "An unknown error occurred");
|
|
130
|
-
}
|
|
131
|
-
throw new error_1.FirebaseError("Failed to upload symbols");
|
|
132
|
-
}
|
|
133
|
-
if (!debug) {
|
|
134
|
-
let logRegex = /(Generated symbol file.*$)/m;
|
|
135
|
-
let matched = (((_b = outputs.stdout) === null || _b === void 0 ? void 0 : _b.toString()) || "").match(logRegex);
|
|
136
|
-
if (matched) {
|
|
137
|
-
return matched[1];
|
|
138
|
-
}
|
|
139
|
-
logRegex = /(Crashlytics symbol file uploaded successfully.*$)/m;
|
|
140
|
-
matched = (((_c = outputs.stdout) === null || _c === void 0 ? void 0 : _c.toString()) || "").match(logRegex);
|
|
141
|
-
if (matched) {
|
|
142
|
-
return matched[1];
|
|
143
|
-
}
|
|
144
|
-
return "";
|
|
75
|
+
return baseArgs.concat(["-generateNativeSymbols", "-unstrippedLibrary", options.symbolFile]);
|
|
145
76
|
}
|
|
146
|
-
return "";
|
|
77
|
+
return baseArgs.concat(["-uploadNativeSymbols", "-googleAppId", options.app]);
|
|
147
78
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const command_1 = require("../command");
|
|
5
5
|
const commandUtils = require("../emulator/commandUtils");
|
|
6
|
+
const commandUtils_1 = require("../emulator/commandUtils");
|
|
6
7
|
exports.command = new command_1.Command("emulators:exec <script>")
|
|
7
8
|
.before(commandUtils.setExportOnExitOptions)
|
|
8
9
|
.before(commandUtils.beforeEmulatorCommand)
|
|
@@ -12,4 +13,6 @@ exports.command = new command_1.Command("emulators:exec <script>")
|
|
|
12
13
|
.option(commandUtils.FLAG_IMPORT, commandUtils.DESC_IMPORT)
|
|
13
14
|
.option(commandUtils.FLAG_EXPORT_ON_EXIT, commandUtils.DESC_EXPORT_ON_EXIT)
|
|
14
15
|
.option(commandUtils.FLAG_UI, commandUtils.DESC_UI)
|
|
15
|
-
.action(
|
|
16
|
+
.action((script, options) => {
|
|
17
|
+
return Promise.race([(0, commandUtils_1.shutdownWhenKilled)(options), (0, commandUtils_1.emulatorExec)(script, options)]);
|
|
18
|
+
});
|
|
@@ -4,8 +4,11 @@ exports.command = void 0;
|
|
|
4
4
|
const command_1 = require("../command");
|
|
5
5
|
const controller = require("../emulator/controller");
|
|
6
6
|
const commandUtils = require("../emulator/commandUtils");
|
|
7
|
-
|
|
7
|
+
const COMMAND_NAME = "emulators:export";
|
|
8
|
+
exports.command = new command_1.Command(`${COMMAND_NAME} <path>`)
|
|
8
9
|
.description("export data from running emulators")
|
|
9
10
|
.withForce("overwrite any export data in the target directory")
|
|
10
11
|
.option(commandUtils.FLAG_ONLY, commandUtils.DESC_ONLY)
|
|
11
|
-
.action(
|
|
12
|
+
.action((exportPath, options) => {
|
|
13
|
+
return controller.exportEmulatorData(exportPath, options, COMMAND_NAME);
|
|
14
|
+
});
|
|
@@ -22,16 +22,28 @@ exports.command = new command_1.Command("emulators:start")
|
|
|
22
22
|
.option(commandUtils.FLAG_INSPECT_FUNCTIONS, commandUtils.DESC_INSPECT_FUNCTIONS)
|
|
23
23
|
.option(commandUtils.FLAG_IMPORT, commandUtils.DESC_IMPORT)
|
|
24
24
|
.option(commandUtils.FLAG_EXPORT_ON_EXIT, commandUtils.DESC_EXPORT_ON_EXIT)
|
|
25
|
-
.action(
|
|
25
|
+
.action((options) => {
|
|
26
26
|
const killSignalPromise = commandUtils.shutdownWhenKilled(options);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
return Promise.race([
|
|
28
|
+
killSignalPromise,
|
|
29
|
+
(async () => {
|
|
30
|
+
let deprecationNotices;
|
|
31
|
+
try {
|
|
32
|
+
({ deprecationNotices } = await controller.startAll(options));
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
await controller.cleanShutdown();
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
printEmulatorOverview(options);
|
|
39
|
+
for (const notice of deprecationNotices) {
|
|
40
|
+
(0, utils_1.logLabeledWarning)("emulators", notice, "warn");
|
|
41
|
+
}
|
|
42
|
+
return killSignalPromise;
|
|
43
|
+
})(),
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
function printEmulatorOverview(options) {
|
|
35
47
|
const reservedPorts = [];
|
|
36
48
|
for (const internalEmulator of [types_1.Emulators.LOGGING]) {
|
|
37
49
|
const info = registry_1.EmulatorRegistry.getInfo(internalEmulator);
|
|
@@ -71,9 +83,7 @@ exports.command = new command_1.Command("emulators:start")
|
|
|
71
83
|
return [
|
|
72
84
|
emulatorName,
|
|
73
85
|
registry_1.EmulatorRegistry.getInfoHostString(info),
|
|
74
|
-
isSupportedByUi && uiInfo
|
|
75
|
-
? stylizeLink(`${uiUrl}/${emulator}`)
|
|
76
|
-
: clc.blackBright("n/a"),
|
|
86
|
+
isSupportedByUi && uiInfo ? stylizeLink(`${uiUrl}/${emulator}`) : clc.blackBright("n/a"),
|
|
77
87
|
];
|
|
78
88
|
})
|
|
79
89
|
.map((col) => col.slice(0, head.length))
|
|
@@ -93,8 +103,4 @@ ${clc.blackBright(" Other reserved ports:")} ${reservedPortsString}
|
|
|
93
103
|
${extensionsTable}
|
|
94
104
|
Issues? Report them at ${stylizeLink("https://github.com/firebase/firebase-tools/issues")} and attach the *-debug.log files.
|
|
95
105
|
`);
|
|
96
|
-
|
|
97
|
-
(0, utils_1.logLabeledWarning)("emulators", notice, "warn");
|
|
98
|
-
}
|
|
99
|
-
await killSignalPromise;
|
|
100
|
-
});
|
|
106
|
+
}
|
|
@@ -17,12 +17,14 @@ marked.setOptions({
|
|
|
17
17
|
});
|
|
18
18
|
exports.command = new command_1.Command("ext:dev:publish <extensionRef>")
|
|
19
19
|
.description(`publish a new version of an extension`)
|
|
20
|
+
.option(`-s, --stage <stage>`, `release stage (supports "rc", "alpha", "beta", and "stable")`)
|
|
20
21
|
.withForce()
|
|
21
22
|
.help("if you have not previously published a version of this extension, this will " +
|
|
22
23
|
"create the extension. If you have previously published a version of this extension, this version must " +
|
|
23
24
|
"be greater than previous versions.")
|
|
24
25
|
.before(requireAuth_1.requireAuth)
|
|
25
26
|
.action(async (extensionRef, options) => {
|
|
27
|
+
var _a;
|
|
26
28
|
const { publisherId, extensionId, version } = refs.parse(extensionRef);
|
|
27
29
|
if (version) {
|
|
28
30
|
throw new error_1.FirebaseError(`The input extension reference must be of the format ${clc.bold("<publisherId>/<extensionId>")}. Version should not be supplied and will be inferred directly from extension.yaml. Please increment the version in extension.yaml if you would like to bump/specify a version.`);
|
|
@@ -37,6 +39,7 @@ exports.command = new command_1.Command("ext:dev:publish <extensionRef>")
|
|
|
37
39
|
rootDirectory: extensionYamlDirectory,
|
|
38
40
|
nonInteractive: options.nonInteractive,
|
|
39
41
|
force: options.force,
|
|
42
|
+
stage: (_a = options.stage) !== null && _a !== void 0 ? _a : "stable",
|
|
40
43
|
});
|
|
41
44
|
if (res) {
|
|
42
45
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`[Install Link](${(0, publishHelpers_1.consoleInstallLink)(res.ref)})`));
|
|
@@ -17,6 +17,7 @@ const fabricator = require("../deploy/functions/release/fabricator");
|
|
|
17
17
|
const executor = require("../deploy/functions/release/executor");
|
|
18
18
|
const reporter = require("../deploy/functions/release/reporter");
|
|
19
19
|
const containerCleaner = require("../deploy/functions/containerCleaner");
|
|
20
|
+
const getProjectNumber_1 = require("../getProjectNumber");
|
|
20
21
|
exports.command = new command_1.Command("functions:delete [filters...]")
|
|
21
22
|
.description("delete one or more Cloud Functions by name or group name.")
|
|
22
23
|
.option("--region <region>", "Specify region of the function to be deleted. " +
|
|
@@ -78,6 +79,7 @@ exports.command = new command_1.Command("functions:delete [filters...]")
|
|
|
78
79
|
appEngineLocation,
|
|
79
80
|
executor: new executor.QueueExecutor({}),
|
|
80
81
|
sources: {},
|
|
82
|
+
projectNumber: options.projectNumber || (await (0, getProjectNumber_1.getProjectNumber)({ projectId: context.projectId })),
|
|
81
83
|
});
|
|
82
84
|
const summary = await fab.applyPlan(plan);
|
|
83
85
|
await reporter.logAndTrackDeployStats(summary);
|
|
@@ -6,8 +6,10 @@ const command_1 = require("../command");
|
|
|
6
6
|
const logger_1 = require("../logger");
|
|
7
7
|
const projectUtils_1 = require("../projectUtils");
|
|
8
8
|
const secretManager_1 = require("../gcp/secretManager");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
10
|
exports.command = new command_1.Command("functions:secrets:get <KEY>")
|
|
10
11
|
.description("Get metadata for secret and its versions")
|
|
12
|
+
.before(requirePermissions_1.requirePermissions, ["secretmanager.secrets.get"])
|
|
11
13
|
.action(async (key, options) => {
|
|
12
14
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
13
15
|
const versions = await (0, secretManager_1.listSecretVersions)(projectId, key);
|
package/lib/commands/index.js
CHANGED
|
@@ -34,6 +34,9 @@ function load(client) {
|
|
|
34
34
|
client.crashlytics = {};
|
|
35
35
|
client.crashlytics.symbols = {};
|
|
36
36
|
client.crashlytics.symbols.upload = loadCommand("crashlytics-symbols-upload");
|
|
37
|
+
client.crashlytics.mappingfile = {};
|
|
38
|
+
client.crashlytics.mappingfile.generateid = loadCommand("crashlytics-mappingfile-generateid");
|
|
39
|
+
client.crashlytics.mappingfile.upload = loadCommand("crashlytics-mappingfile-upload");
|
|
37
40
|
client.database = {};
|
|
38
41
|
client.database.get = loadCommand("database-get");
|
|
39
42
|
client.database.instances = {};
|
package/lib/commands/login.js
CHANGED
|
@@ -28,11 +28,11 @@ exports.command = new command_1.Command("login")
|
|
|
28
28
|
return user;
|
|
29
29
|
}
|
|
30
30
|
if (!options.reauth) {
|
|
31
|
-
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
|
+
utils.logBullet("Firebase optionally collects CLI and Emulator Suite 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");
|
|
32
32
|
const collectUsage = await (0, prompt_1.promptOnce)({
|
|
33
33
|
type: "confirm",
|
|
34
34
|
name: "collectUsage",
|
|
35
|
-
message: "Allow Firebase to collect CLI usage and error reporting information?",
|
|
35
|
+
message: "Allow Firebase to collect CLI and Emulator Suite usage and error reporting information?",
|
|
36
36
|
});
|
|
37
37
|
configstore_1.configstore.set("usage", collectUsage);
|
|
38
38
|
if (collectUsage) {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runBuildtoolsCommand = exports.fetchBuildtoolsJar = void 0;
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const spawn = require("cross-spawn");
|
|
8
|
+
const downloadUtils = require("../downloadUtils");
|
|
9
|
+
const error_1 = require("../error");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const rimraf = require("rimraf");
|
|
12
|
+
const utils = require("../utils");
|
|
13
|
+
const JAR_CACHE_DIR = process.env.FIREBASE_CRASHLYTICS_BUILDTOOLS_PATH ||
|
|
14
|
+
path.join(os.homedir(), ".cache", "firebase", "crashlytics", "buildtools");
|
|
15
|
+
const JAR_VERSION = "2.9.1";
|
|
16
|
+
const JAR_URL = `https://dl.google.com/android/maven2/com/google/firebase/firebase-crashlytics-buildtools/${JAR_VERSION}/firebase-crashlytics-buildtools-${JAR_VERSION}.jar`;
|
|
17
|
+
async function fetchBuildtoolsJar() {
|
|
18
|
+
if (process.env.CRASHLYTICS_LOCAL_JAR) {
|
|
19
|
+
return process.env.CRASHLYTICS_LOCAL_JAR;
|
|
20
|
+
}
|
|
21
|
+
const jarPath = path.join(JAR_CACHE_DIR, `crashlytics-buildtools-${JAR_VERSION}.jar`);
|
|
22
|
+
if (fs.existsSync(jarPath)) {
|
|
23
|
+
logger_1.logger.debug(`Buildtools Jar already downloaded at ${jarPath}`);
|
|
24
|
+
return jarPath;
|
|
25
|
+
}
|
|
26
|
+
if (fs.existsSync(JAR_CACHE_DIR)) {
|
|
27
|
+
logger_1.logger.debug(`Deleting Jar cache at ${JAR_CACHE_DIR} because the CLI was run with a newer Jar version`);
|
|
28
|
+
rimraf.sync(JAR_CACHE_DIR);
|
|
29
|
+
}
|
|
30
|
+
utils.logBullet("Downloading crashlytics-buildtools.jar to " + jarPath);
|
|
31
|
+
utils.logBullet("For open source licenses used by this command, look in the META-INF directory in the buildtools.jar file");
|
|
32
|
+
const tmpfile = await downloadUtils.downloadToTmp(JAR_URL);
|
|
33
|
+
fs.mkdirSync(JAR_CACHE_DIR, { recursive: true });
|
|
34
|
+
fs.copySync(tmpfile, jarPath);
|
|
35
|
+
return jarPath;
|
|
36
|
+
}
|
|
37
|
+
exports.fetchBuildtoolsJar = fetchBuildtoolsJar;
|
|
38
|
+
function runBuildtoolsCommand(jarFile, args, debug) {
|
|
39
|
+
var _a;
|
|
40
|
+
const fullArgs = ["-jar", jarFile, ...args, "-clientName", "firebase-cli;crashlytics-buildtools"];
|
|
41
|
+
const outputs = spawn.sync("java", fullArgs, {
|
|
42
|
+
stdio: debug ? "inherit" : "pipe",
|
|
43
|
+
});
|
|
44
|
+
if (outputs.status !== 0) {
|
|
45
|
+
if (!debug) {
|
|
46
|
+
utils.logWarning(((_a = outputs.stdout) === null || _a === void 0 ? void 0 : _a.toString()) || "An unknown error occurred");
|
|
47
|
+
}
|
|
48
|
+
throw new error_1.FirebaseError(`java command failed with args: ${fullArgs}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.runBuildtoolsCommand = runBuildtoolsCommand;
|
|
@@ -65,8 +65,8 @@ function memoryToGen1Cpu(memory) {
|
|
|
65
65
|
2048: 1,
|
|
66
66
|
4096: 2,
|
|
67
67
|
8192: 2,
|
|
68
|
-
16384:
|
|
69
|
-
32768:
|
|
68
|
+
16384: 4,
|
|
69
|
+
32768: 8,
|
|
70
70
|
}[memory];
|
|
71
71
|
}
|
|
72
72
|
exports.memoryToGen1Cpu = memoryToGen1Cpu;
|
|
@@ -79,8 +79,8 @@ function memoryToGen2Cpu(memory) {
|
|
|
79
79
|
2048: 1,
|
|
80
80
|
4096: 2,
|
|
81
81
|
8192: 2,
|
|
82
|
-
16384:
|
|
83
|
-
32768:
|
|
82
|
+
16384: 4,
|
|
83
|
+
32768: 8,
|
|
84
84
|
}[memory];
|
|
85
85
|
}
|
|
86
86
|
exports.memoryToGen2Cpu = memoryToGen2Cpu;
|