firebase-tools 12.0.0 → 12.1.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.
@@ -11,6 +11,7 @@ const RUNTIMES = [
11
11
  "nodejs14",
12
12
  "nodejs16",
13
13
  "nodejs18",
14
+ "nodejs20",
14
15
  "python310",
15
16
  "python311",
16
17
  ];
@@ -32,6 +33,7 @@ const MESSAGE_FRIENDLY_RUNTIMES = {
32
33
  nodejs14: "Node.js 14",
33
34
  nodejs16: "Node.js 16",
34
35
  nodejs18: "Node.js 18",
36
+ nodejs20: "Node.js 20",
35
37
  python310: "Python 3.10",
36
38
  python311: "Python 3.11",
37
39
  };
@@ -15,6 +15,7 @@ const ENGINE_RUNTIMES = {
15
15
  14: "nodejs14",
16
16
  16: "nodejs16",
17
17
  18: "nodejs18",
18
+ 20: "nodejs20",
18
19
  };
19
20
  const ENGINE_RUNTIMES_NAMES = Object.values(ENGINE_RUNTIMES);
20
21
  exports.RUNTIME_NOT_SET = "`runtime` field is required but was not found in firebase.json.\n" +
@@ -107,7 +107,7 @@ class Delegate {
107
107
  var _a, _b;
108
108
  const modulesDir = await this.modulesDir();
109
109
  const envWithAdminPort = Object.assign(Object.assign({}, envs), { ADMIN_PORT: port.toString() });
110
- const args = [this.bin, path.join(modulesDir, "private", "serving.py")];
110
+ const args = [this.bin, `"${path.join(modulesDir, "private", "serving.py")}"`];
111
111
  const stdout = [];
112
112
  const stderr = [];
113
113
  logger_1.logger.debug(`Running admin server with args: ${JSON.stringify(args)} and env: ${JSON.stringify(envWithAdminPort)} in ${this.sourceDir}`);
@@ -36,10 +36,12 @@ function cloudEventFromProtoToJson(ce) {
36
36
  }
37
37
  exports.cloudEventFromProtoToJson = cloudEventFromProtoToJson;
38
38
  function getOptionalAttribute(ce, attr, type) {
39
- return ce["attributes"][attr][type];
39
+ var _a, _b;
40
+ return (_b = (_a = ce === null || ce === void 0 ? void 0 : ce["attributes"]) === null || _a === void 0 ? void 0 : _a[attr]) === null || _b === void 0 ? void 0 : _b[type];
40
41
  }
41
42
  function getRequiredAttribute(ce, attr, type) {
42
- const val = ce["attributes"][attr][type];
43
+ var _a, _b;
44
+ const val = (_b = (_a = ce === null || ce === void 0 ? void 0 : ce["attributes"]) === null || _a === void 0 ? void 0 : _a[attr]) === null || _b === void 0 ? void 0 : _b[type];
43
45
  if (val === undefined) {
44
46
  throw new error_1.FirebaseError("CloudEvent must contain " + attr + " attribute");
45
47
  }
@@ -10,6 +10,7 @@ const prompt_1 = require("../../prompt");
10
10
  const utils_1 = require("../utils");
11
11
  const utils_2 = require("./utils");
12
12
  const constants_1 = require("../constants");
13
+ const error_1 = require("../../error");
13
14
  exports.name = "Angular";
14
15
  exports.support = "preview";
15
16
  exports.type = 3;
@@ -47,10 +48,12 @@ async function build(dir) {
47
48
  await (0, utils_1.warnIfCustomBuildScript)(dir, exports.name, DEFAULT_BUILD_SCRIPT);
48
49
  for (const target of targets) {
49
50
  const cli = (0, utils_1.getNodeModuleBin)("ng", dir);
50
- (0, cross_spawn_1.sync)(cli, ["run", target], {
51
+ const result = (0, cross_spawn_1.sync)(cli, ["run", target], {
51
52
  cwd: dir,
52
53
  stdio: "inherit",
53
54
  });
55
+ if (result.status !== 0)
56
+ throw new error_1.FirebaseError(`Unable to build ${target}`);
54
57
  }
55
58
  const wantsBackend = !!serverTarget || serveOptimizedImages;
56
59
  const i18n = !!locales;
@@ -114,7 +114,7 @@ async function getContext(dir) {
114
114
  ? "production"
115
115
  : target.defaultConfiguration;
116
116
  if (!configuration)
117
- throw new Error("No production or default configutation found for prerender.");
117
+ throw new Error("No production or default configuration found for prerender.");
118
118
  if (configuration !== "production")
119
119
  console.warn(`Using ${configuration} configuration for the prerender, we suggest adding a production target.`);
120
120
  prerenderTarget = { project, target: "prerender", configuration };
@@ -134,7 +134,7 @@ async function getContext(dir) {
134
134
  ? "production"
135
135
  : target.defaultConfiguration;
136
136
  if (!configuration)
137
- throw new Error("No production or default configutation found for build.");
137
+ throw new Error("No production or default configuration found for build.");
138
138
  if (configuration !== "production")
139
139
  console.warn(`Using ${configuration} configuration for the browser deploy, we suggest adding a production target.`);
140
140
  browserTarget = { project, target: "build", configuration };
@@ -35,7 +35,7 @@ async function build(cwd) {
35
35
  throw new error_1.FirebaseError("Deploying an Astro application with SSR on Firebase Hosting requires the @astrojs/node adapter.");
36
36
  }
37
37
  const build = (0, cross_spawn_1.sync)(cli, ["build"], { cwd, stdio: "inherit" });
38
- if (build.status)
38
+ if (build.status !== 0)
39
39
  throw new error_1.FirebaseError("Unable to build your Astro app");
40
40
  return { wantsBackend: output === "server" };
41
41
  }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FALLBACK_PROJECT_NAME = exports.DART_RESERVED_WORDS = void 0;
4
+ exports.DART_RESERVED_WORDS = [
5
+ "abstract",
6
+ "else",
7
+ "import",
8
+ "show",
9
+ "as",
10
+ "enum",
11
+ "in",
12
+ "static",
13
+ "assert",
14
+ "export",
15
+ "interface",
16
+ "super",
17
+ "async",
18
+ "extends",
19
+ "is",
20
+ "switch",
21
+ "await",
22
+ "extension",
23
+ "late",
24
+ "sync",
25
+ "base",
26
+ "external",
27
+ "library",
28
+ "this",
29
+ "break",
30
+ "factory",
31
+ "mixin",
32
+ "throw",
33
+ "case",
34
+ "false",
35
+ "new",
36
+ "true",
37
+ "catch",
38
+ "final",
39
+ "null",
40
+ "try",
41
+ "class",
42
+ "on",
43
+ "typedef",
44
+ "const",
45
+ "finally",
46
+ "operator",
47
+ "var",
48
+ "continue",
49
+ "for",
50
+ "part",
51
+ "void",
52
+ "covariant",
53
+ "function",
54
+ "required",
55
+ "when",
56
+ "default",
57
+ "get",
58
+ "rethrow",
59
+ "while",
60
+ "deferred",
61
+ "hide",
62
+ "return",
63
+ "with",
64
+ "do",
65
+ "if",
66
+ "sealed",
67
+ "yield",
68
+ "dynamic",
69
+ "implements",
70
+ "set",
71
+ ];
72
+ exports.FALLBACK_PROJECT_NAME = "hello_firebase";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.support = exports.type = exports.name = void 0;
3
+ exports.ɵcodegenPublicDirectory = exports.build = exports.init = exports.discover = exports.support = exports.type = exports.name = void 0;
4
4
  const cross_spawn_1 = require("cross-spawn");
5
5
  const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
@@ -8,7 +8,8 @@ const js_yaml_1 = require("js-yaml");
8
8
  const promises_1 = require("fs/promises");
9
9
  const error_1 = require("../../error");
10
10
  const utils_1 = require("./utils");
11
- exports.name = "Flutter";
11
+ const constants_1 = require("./constants");
12
+ exports.name = "Flutter Web";
12
13
  exports.type = 3;
13
14
  exports.support = "experimental";
14
15
  async function discover(dir) {
@@ -25,10 +26,28 @@ async function discover(dir) {
25
26
  return { mayWantBackend: false, publicDirectory: (0, path_1.join)(dir, "web") };
26
27
  }
27
28
  exports.discover = discover;
29
+ function init(setup, config) {
30
+ (0, utils_1.assertFlutterCliExists)();
31
+ const projectName = constants_1.DART_RESERVED_WORDS.includes(setup.projectId)
32
+ ? constants_1.FALLBACK_PROJECT_NAME
33
+ : setup.projectId.replaceAll("-", "_");
34
+ const result = (0, cross_spawn_1.sync)("flutter", [
35
+ "create",
36
+ "--template=app",
37
+ `--project-name=${projectName}`,
38
+ "--overwrite",
39
+ "--platforms=web",
40
+ setup.hosting.source,
41
+ ], { stdio: "inherit", cwd: config.projectDir });
42
+ if (result.status !== 0)
43
+ throw new error_1.FirebaseError("We were not able to create your flutter app, create the application yourself https://docs.flutter.dev/get-started/test-drive?tab=terminal before trying again.");
44
+ return Promise.resolve();
45
+ }
46
+ exports.init = init;
28
47
  function build(cwd) {
29
48
  (0, utils_1.assertFlutterCliExists)();
30
49
  const build = (0, cross_spawn_1.sync)("flutter", ["build", "web"], { cwd, stdio: "inherit" });
31
- if (build.status)
50
+ if (build.status !== 0)
32
51
  throw new error_1.FirebaseError("Unable to build your Flutter app");
33
52
  return Promise.resolve({ wantsBackend: false });
34
53
  }
@@ -5,7 +5,7 @@ const cross_spawn_1 = require("cross-spawn");
5
5
  const error_1 = require("../../error");
6
6
  function assertFlutterCliExists() {
7
7
  const process = (0, cross_spawn_1.sync)("flutter", ["--version"], { stdio: "ignore" });
8
- if (process.status)
9
- throw new error_1.FirebaseError("Flutter CLI not found.");
8
+ if (process.status !== 0)
9
+ throw new error_1.FirebaseError("Flutter CLI not found, follow the instructions here https://docs.flutter.dev/get-started/install before trying again.");
10
10
  }
11
11
  exports.assertFlutterCliExists = assertFlutterCliExists;
@@ -311,7 +311,7 @@ async function prepareFrameworks(targetNames, context, options, emulators = [])
311
311
  const result = (0, cross_spawn_1.sync)("npm", ["pack", (0, path_1.relative)(functionsDist, path), "--json=true"], {
312
312
  cwd: functionsDist,
313
313
  });
314
- if (result.status)
314
+ if (result.status !== 0)
315
315
  throw new Error(`Error running \`npm pack\` at ${path}`);
316
316
  const { filename } = JSON.parse(result.stdout.toString())[0];
317
317
  packageJson.dependencies[name] = `file:${filename}`;
@@ -325,7 +325,7 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir) {
325
325
  cwd: sourceDir,
326
326
  timeout: BUNDLE_NEXT_CONFIG_TIMEOUT,
327
327
  });
328
- if (bundle.status) {
328
+ if (bundle.status !== 0) {
329
329
  throw new error_1.FirebaseError(bundle.stderr.toString());
330
330
  }
331
331
  }
@@ -7,7 +7,7 @@ const logger_1 = require("../logger");
7
7
  exports.DEFAULT_VENV_DIR = "venv";
8
8
  function virtualEnvCmd(cwd, venvDir) {
9
9
  const activateScriptPath = process.platform === "win32" ? ["Scripts", "activate.bat"] : ["bin", "activate"];
10
- const venvActivate = path.join(cwd, venvDir, ...activateScriptPath);
10
+ const venvActivate = `"${path.join(cwd, venvDir, ...activateScriptPath)}"`;
11
11
  return {
12
12
  command: process.platform === "win32" ? venvActivate : ".",
13
13
  args: [process.platform === "win32" ? "" : venvActivate],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -617,7 +617,8 @@
617
617
  "nodejs12",
618
618
  "nodejs14",
619
619
  "nodejs16",
620
- "nodejs18"
620
+ "nodejs18",
621
+ "nodejs20"
621
622
  ],
622
623
  "type": "string"
623
624
  },
@@ -672,7 +673,8 @@
672
673
  "nodejs12",
673
674
  "nodejs14",
674
675
  "nodejs16",
675
- "nodejs18"
676
+ "nodejs18",
677
+ "nodejs20"
676
678
  ],
677
679
  "type": "string"
678
680
  },