firebase-tools 13.0.0-canary.0 → 13.0.1
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/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/commands/frameworks-backends-create.js +2 -0
- package/lib/commands/frameworks-backends-delete.js +2 -0
- package/lib/commands/frameworks-backends-get.js +4 -7
- package/lib/commands/frameworks-backends-list.js +7 -12
- package/lib/deploy/functions/services/firestore.js +11 -1
- package/lib/dynamicImport.js +0 -0
- package/lib/frameworks/angular/index.js +5 -3
- package/lib/frameworks/angular/utils.js +27 -2
- package/lib/frameworks/astro/index.js +5 -2
- package/lib/frameworks/astro/utils.js +3 -2
- package/lib/frameworks/constants.js +36 -9
- package/lib/frameworks/index.js +3 -3
- package/lib/frameworks/next/index.js +6 -4
- package/lib/frameworks/nuxt/index.js +15 -5
- package/lib/frameworks/nuxt2/index.js +5 -4
- package/lib/frameworks/sveltekit/index.js +2 -1
- package/lib/frameworks/utils.js +13 -9
- package/lib/frameworks/vite/index.js +19 -5
- package/lib/gcp/cloudbuild.js +28 -3
- package/lib/gcp/frameworks.js +9 -1
- package/lib/gcp/storage.js +5 -1
- package/lib/init/features/frameworks/index.js +52 -74
- package/lib/init/features/frameworks/repo.js +135 -41
- package/lib/init/features/hosting/index.js +1 -1
- package/lib/utils.js +30 -1
- package/package.json +1 -1
- package/schema/extension-yaml.json +0 -0
- package/schema/firebase-config.json +0 -0
- package/standalone/check.js +0 -0
- package/standalone/config.template.js +0 -0
- package/standalone/firepit.js +0 -0
- package/standalone/package.json +0 -0
- package/standalone/runtime.js +0 -0
- package/standalone/welcome.js +0 -0
- package/templates/_gitignore +0 -0
- package/templates/banner.txt +0 -0
- package/templates/emulators/default_storage.rules +0 -0
- package/templates/extensions/CL-template.md +0 -0
- package/templates/extensions/POSTINSTALL.md +0 -0
- package/templates/extensions/PREINSTALL.md +0 -0
- package/templates/extensions/extension.yaml +0 -0
- package/templates/extensions/integration-test.env +0 -0
- package/templates/extensions/integration-test.json +0 -0
- package/templates/extensions/javascript/WELCOME.md +0 -0
- package/templates/extensions/javascript/_gitignore +0 -0
- package/templates/extensions/javascript/index.js +0 -0
- package/templates/extensions/javascript/integration-test.js +0 -0
- package/templates/extensions/javascript/package.lint.json +0 -0
- package/templates/extensions/javascript/package.nolint.json +0 -0
- package/templates/extensions/typescript/WELCOME.md +0 -0
- package/templates/extensions/typescript/_gitignore +0 -0
- package/templates/extensions/typescript/_mocharc +0 -0
- package/templates/extensions/typescript/index.ts +0 -0
- package/templates/extensions/typescript/integration-test.ts +0 -0
- package/templates/extensions/typescript/package.lint.json +0 -0
- package/templates/extensions/typescript/package.nolint.json +0 -0
- package/templates/extensions/typescript/tsconfig.dev.json +0 -0
- package/templates/extensions/typescript/tsconfig.json +0 -0
- package/templates/firebase.json +0 -0
- package/templates/hosting/init.js +0 -0
- package/templates/init/firestore/firestore.indexes.json +0 -0
- package/templates/init/firestore/firestore.rules +0 -0
- package/templates/init/functions/javascript/_eslintrc +0 -0
- package/templates/init/functions/javascript/_gitignore +0 -0
- package/templates/init/functions/javascript/index.js +0 -0
- package/templates/init/functions/javascript/package.lint.json +0 -0
- package/templates/init/functions/javascript/package.nolint.json +0 -0
- package/templates/init/functions/python/_gitignore +0 -0
- package/templates/init/functions/python/main.py +0 -0
- package/templates/init/functions/python/requirements.txt +0 -0
- package/templates/init/functions/typescript/_eslintrc +0 -0
- package/templates/init/functions/typescript/_gitignore +0 -0
- package/templates/init/functions/typescript/index.ts +0 -0
- package/templates/init/functions/typescript/package.lint.json +0 -0
- package/templates/init/functions/typescript/package.nolint.json +0 -0
- package/templates/init/functions/typescript/tsconfig.dev.json +0 -0
- package/templates/init/functions/typescript/tsconfig.json +0 -0
- package/templates/init/hosting/404.html +0 -0
- package/templates/init/hosting/index.html +0 -0
- package/templates/init/storage/storage.rules +0 -0
- package/templates/loginFailure.html +0 -0
- package/templates/loginSuccess.html +0 -0
- package/templates/loginSuccessGithub.html +0 -0
- package/templates/popup.html +64 -0
- package/templates/setup/web.js +0 -0
- package/standalone/config.js +0 -19
- package/standalone/firepit-log.txt +0 -4
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
|
@@ -5,8 +5,10 @@ const command_1 = require("../command");
|
|
|
5
5
|
const projectUtils_1 = require("../projectUtils");
|
|
6
6
|
const requireInteractive_1 = require("../requireInteractive");
|
|
7
7
|
const frameworks_1 = require("../init/features/frameworks");
|
|
8
|
+
const frameworks_2 = require("../gcp/frameworks");
|
|
8
9
|
exports.command = new command_1.Command("backends:create")
|
|
9
10
|
.description("Create a backend in a Firebase project")
|
|
11
|
+
.before(frameworks_2.ensureApiEnabled)
|
|
10
12
|
.before(requireInteractive_1.default)
|
|
11
13
|
.action(async (options) => {
|
|
12
14
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
@@ -9,6 +9,7 @@ const prompt_1 = require("../prompt");
|
|
|
9
9
|
const utils = require("../utils");
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
11
|
const constants_1 = require("../init/features/frameworks/constants");
|
|
12
|
+
const frameworks_1 = require("../gcp/frameworks");
|
|
12
13
|
const Table = require("cli-table");
|
|
13
14
|
const COLUMN_LENGTH = 20;
|
|
14
15
|
const TABLE_HEAD = [
|
|
@@ -24,6 +25,7 @@ exports.command = new command_1.Command("backends:delete")
|
|
|
24
25
|
.option("-l, --location <location>", "App Backend location", "")
|
|
25
26
|
.option("-s, --backend <backend>", "Backend Id", "")
|
|
26
27
|
.withForce()
|
|
28
|
+
.before(frameworks_1.ensureApiEnabled)
|
|
27
29
|
.action(async (options) => {
|
|
28
30
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
29
31
|
let location = options.location;
|
|
@@ -6,6 +6,7 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
6
6
|
const gcp = require("../gcp/frameworks");
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const logger_1 = require("../logger");
|
|
9
|
+
const frameworks_1 = require("../gcp/frameworks");
|
|
9
10
|
const Table = require("cli-table");
|
|
10
11
|
const COLUMN_LENGTH = 20;
|
|
11
12
|
const TABLE_HEAD = [
|
|
@@ -16,17 +17,13 @@ const TABLE_HEAD = [
|
|
|
16
17
|
"Created Date",
|
|
17
18
|
"Updated Date",
|
|
18
19
|
];
|
|
19
|
-
exports.command = new command_1.Command("backends:get")
|
|
20
|
+
exports.command = new command_1.Command("backends:get <backendId>")
|
|
20
21
|
.description("Get backend details of a Firebase project")
|
|
21
22
|
.option("-l, --location <location>", "App Backend location", "-")
|
|
22
|
-
.
|
|
23
|
-
.action(async (options) => {
|
|
23
|
+
.before(frameworks_1.ensureApiEnabled)
|
|
24
|
+
.action(async (backendId, options) => {
|
|
24
25
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
26
|
const location = options.location;
|
|
26
|
-
const backendId = options.backend;
|
|
27
|
-
if (!backendId) {
|
|
28
|
-
throw new error_1.FirebaseError("Backend id can't be empty.");
|
|
29
|
-
}
|
|
30
27
|
let backendsList = [];
|
|
31
28
|
const table = new Table({
|
|
32
29
|
head: TABLE_HEAD,
|
|
@@ -7,19 +7,14 @@ const gcp = require("../gcp/frameworks");
|
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const logger_1 = require("../logger");
|
|
9
9
|
const colorette_1 = require("colorette");
|
|
10
|
+
const frameworks_1 = require("../gcp/frameworks");
|
|
10
11
|
const Table = require("cli-table");
|
|
11
12
|
const COLUMN_LENGTH = 20;
|
|
12
|
-
const TABLE_HEAD = [
|
|
13
|
-
"Backend Id",
|
|
14
|
-
"Repository Name",
|
|
15
|
-
"Location",
|
|
16
|
-
"URL",
|
|
17
|
-
"Created Date",
|
|
18
|
-
"Updated Date",
|
|
19
|
-
];
|
|
13
|
+
const TABLE_HEAD = ["Backend Id", "Repository", "Location", "URL", "Created Date", "Updated Date"];
|
|
20
14
|
exports.command = new command_1.Command("backends:list")
|
|
21
15
|
.description("List backends of a Firebase project.")
|
|
22
16
|
.option("-l, --location <location>", "App Backend location", "-")
|
|
17
|
+
.before(frameworks_1.ensureApiEnabled)
|
|
23
18
|
.action(async (options) => {
|
|
24
19
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
20
|
const location = options.location;
|
|
@@ -31,8 +26,8 @@ exports.command = new command_1.Command("backends:list")
|
|
|
31
26
|
const backendsList = [];
|
|
32
27
|
try {
|
|
33
28
|
const backendsPerRegion = await gcp.listBackends(projectId, location);
|
|
34
|
-
backendsList.push(backendsPerRegion);
|
|
35
|
-
populateTable(
|
|
29
|
+
backendsList.push(...backendsPerRegion.backends);
|
|
30
|
+
populateTable(backendsList, table);
|
|
36
31
|
logger_1.logger.info();
|
|
37
32
|
logger_1.logger.info(`Backends for project ${(0, colorette_1.bold)(projectId)}`);
|
|
38
33
|
logger_1.logger.info();
|
|
@@ -43,9 +38,9 @@ exports.command = new command_1.Command("backends:list")
|
|
|
43
38
|
}
|
|
44
39
|
return backendsList;
|
|
45
40
|
});
|
|
46
|
-
function populateTable(
|
|
41
|
+
function populateTable(backends, table) {
|
|
47
42
|
var _a;
|
|
48
|
-
for (const backend of
|
|
43
|
+
for (const backend of backends) {
|
|
49
44
|
const [location, , backendId] = backend.name.split("/").slice(3, 6);
|
|
50
45
|
const entry = [
|
|
51
46
|
backendId,
|
|
@@ -3,9 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ensureFirestoreTriggerRegion = void 0;
|
|
4
4
|
const firestore = require("../../../gcp/firestore");
|
|
5
5
|
const error_1 = require("../../../error");
|
|
6
|
+
const dbCache = new Map();
|
|
7
|
+
async function getDatabase(project, databaseId) {
|
|
8
|
+
const key = `${project}/${databaseId}`;
|
|
9
|
+
if (dbCache.has(key)) {
|
|
10
|
+
return dbCache.get(key);
|
|
11
|
+
}
|
|
12
|
+
const db = await firestore.getDatabase(project, databaseId);
|
|
13
|
+
dbCache.set(key, db);
|
|
14
|
+
return db;
|
|
15
|
+
}
|
|
6
16
|
async function ensureFirestoreTriggerRegion(endpoint) {
|
|
7
17
|
var _a;
|
|
8
|
-
const db = await
|
|
18
|
+
const db = await getDatabase(endpoint.project, ((_a = endpoint.eventTrigger.eventFilters) === null || _a === void 0 ? void 0 : _a.database) || "(default)");
|
|
9
19
|
const dbRegion = db.locationId;
|
|
10
20
|
if (!endpoint.eventTrigger.region) {
|
|
11
21
|
endpoint.eventTrigger.region = dbRegion;
|
package/lib/dynamicImport.js
CHANGED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ɵcodegenFunctionsDirectory = exports.shouldUseDevModeHandle = exports.getValidBuildTargets = exports.ɵcodegenPublicDirectory = exports.getDevModeHandle = exports.build = exports.init = exports.discover = exports.docsUrl = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.ɵcodegenFunctionsDirectory = exports.shouldUseDevModeHandle = exports.getValidBuildTargets = exports.ɵcodegenPublicDirectory = exports.getDevModeHandle = exports.build = exports.init = exports.discover = exports.supportedRange = exports.docsUrl = exports.type = exports.support = exports.name = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const cross_spawn_1 = require("cross-spawn");
|
|
@@ -15,16 +15,18 @@ exports.support = "preview";
|
|
|
15
15
|
exports.type = 3;
|
|
16
16
|
exports.docsUrl = "https://firebase.google.com/docs/hosting/frameworks/angular";
|
|
17
17
|
const DEFAULT_BUILD_SCRIPT = ["ng build"];
|
|
18
|
+
exports.supportedRange = "14 - 17";
|
|
18
19
|
async function discover(dir) {
|
|
19
20
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "package.json"))))
|
|
20
21
|
return;
|
|
21
22
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "angular.json"))))
|
|
22
23
|
return;
|
|
23
|
-
|
|
24
|
+
const version = (0, utils_2.getAngularVersion)(dir);
|
|
25
|
+
return { mayWantBackend: true, publicDirectory: (0, path_1.join)(dir, "src", "assets"), version };
|
|
24
26
|
}
|
|
25
27
|
exports.discover = discover;
|
|
26
28
|
function init(setup, config) {
|
|
27
|
-
(0, child_process_1.execSync)(`npx --yes -p @angular/cli@
|
|
29
|
+
(0, child_process_1.execSync)(`npx --yes -p @angular/cli@"${exports.supportedRange}" ng new ${setup.projectId} --directory ${setup.hosting.source} --skip-git`, {
|
|
28
30
|
stdio: "inherit",
|
|
29
31
|
cwd: config.projectDir,
|
|
30
32
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBuildConfig = exports.getServerConfig = exports.getBrowserConfig = exports.getContext = exports.getAllTargets = void 0;
|
|
3
|
+
exports.getAngularVersion = exports.getBuildConfig = exports.getServerConfig = exports.getBrowserConfig = exports.getContext = exports.getAllTargets = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const error_1 = require("../../error");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const assert_1 = require("assert");
|
|
8
8
|
const utils_2 = require("../../utils");
|
|
9
|
+
const semver_1 = require("semver");
|
|
9
10
|
async function localesForTarget(dir, architectHost, target, workspaceProject) {
|
|
10
11
|
var _a;
|
|
11
12
|
const { targetStringFromTarget } = (0, utils_1.relativeRequire)(dir, "@angular-devkit/architect");
|
|
@@ -56,6 +57,7 @@ async function localesForTarget(dir, architectHost, target, workspaceProject) {
|
|
|
56
57
|
const DEV_SERVER_TARGETS = [
|
|
57
58
|
"@angular-devkit/build-angular:dev-server",
|
|
58
59
|
"@nguniversal/builders:ssr-dev-server",
|
|
60
|
+
"@angular-devkit/build-angular:ssr-dev-server",
|
|
59
61
|
];
|
|
60
62
|
function getValidBuilders(purpose) {
|
|
61
63
|
return [
|
|
@@ -63,6 +65,7 @@ function getValidBuilders(purpose) {
|
|
|
63
65
|
"@angular-devkit/build-angular:browser-esbuild",
|
|
64
66
|
"@angular/fire:deploy",
|
|
65
67
|
"@angular-devkit/build-angular:browser",
|
|
68
|
+
"@angular-devkit/build-angular:prerender",
|
|
66
69
|
"@nguniversal/builders:prerender",
|
|
67
70
|
...(purpose === "deploy" ? [] : DEV_SERVER_TARGETS),
|
|
68
71
|
];
|
|
@@ -156,11 +159,13 @@ async function getContext(dir, targetOrConfiguration) {
|
|
|
156
159
|
case "@angular-devkit/build-angular:browser":
|
|
157
160
|
browserTarget = overrideTarget;
|
|
158
161
|
break;
|
|
162
|
+
case "@angular-devkit/build-angular:prerender":
|
|
159
163
|
case "@nguniversal/builders:prerender":
|
|
160
164
|
prerenderTarget = overrideTarget;
|
|
161
165
|
break;
|
|
162
166
|
case "@angular-devkit/build-angular:dev-server":
|
|
163
167
|
case "@nguniversal/builders:ssr-dev-server":
|
|
168
|
+
case "@angular-devkit/build-angular:ssr-dev-server":
|
|
164
169
|
serveTarget = overrideTarget;
|
|
165
170
|
break;
|
|
166
171
|
default:
|
|
@@ -178,7 +183,9 @@ async function getContext(dir, targetOrConfiguration) {
|
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
if (deployTarget) {
|
|
181
|
-
const options = await architectHost
|
|
186
|
+
const options = await architectHost
|
|
187
|
+
.getOptionsForTarget(deployTarget)
|
|
188
|
+
.catch(() => { var _a; return (_a = workspaceProject.targets.get(deployTarget.target)) === null || _a === void 0 ? void 0 : _a.options; });
|
|
182
189
|
if (!options)
|
|
183
190
|
throw new error_1.FirebaseError("Unable to get options for ng-deploy.");
|
|
184
191
|
if (options.buildTarget) {
|
|
@@ -197,6 +204,10 @@ async function getContext(dir, targetOrConfiguration) {
|
|
|
197
204
|
(0, utils_2.assertIsString)(options.serverTarget);
|
|
198
205
|
serverTarget = targetFromTargetString(options.serverTarget);
|
|
199
206
|
}
|
|
207
|
+
if (options.serveTarget) {
|
|
208
|
+
(0, utils_2.assertIsString)(options.serveTarget);
|
|
209
|
+
serveTarget = targetFromTargetString(options.serveTarget);
|
|
210
|
+
}
|
|
200
211
|
if (options.serveOptimizedImages) {
|
|
201
212
|
serveOptimizedImages = true;
|
|
202
213
|
}
|
|
@@ -299,12 +310,16 @@ async function getContext(dir, targetOrConfiguration) {
|
|
|
299
310
|
continue;
|
|
300
311
|
if (target === browserTarget && builder === "@angular-devkit/build-angular:browser")
|
|
301
312
|
continue;
|
|
313
|
+
if (target === prerenderTarget && builder === "@angular-devkit/build-angular:prerender")
|
|
314
|
+
continue;
|
|
302
315
|
if (target === prerenderTarget && builder === "@nguniversal/builders:prerender")
|
|
303
316
|
continue;
|
|
304
317
|
if (target === serverTarget && builder === "@angular-devkit/build-angular:server")
|
|
305
318
|
continue;
|
|
306
319
|
if (target === serveTarget && builder === "@nguniversal/builders:ssr-dev-server")
|
|
307
320
|
continue;
|
|
321
|
+
if (target === serveTarget && builder === "@angular-devkit/build-angular:ssr-dev-server")
|
|
322
|
+
continue;
|
|
308
323
|
if (target === serveTarget && builder === "@angular-devkit/build-angular:dev-server")
|
|
309
324
|
continue;
|
|
310
325
|
throw new error_1.FirebaseError(`${definition.builder} (${targetString}) is not a recognized builder. Please check your angular.json`);
|
|
@@ -433,3 +448,13 @@ async function getBuildConfig(sourceDir, configuration) {
|
|
|
433
448
|
};
|
|
434
449
|
}
|
|
435
450
|
exports.getBuildConfig = getBuildConfig;
|
|
451
|
+
function getAngularVersion(cwd) {
|
|
452
|
+
const dependency = (0, utils_1.findDependency)("@angular/core", { cwd, depth: 0, omitDev: false });
|
|
453
|
+
if (!dependency)
|
|
454
|
+
return undefined;
|
|
455
|
+
const angularVersionSemver = (0, semver_1.coerce)(dependency.version);
|
|
456
|
+
if (!angularVersionSemver)
|
|
457
|
+
return dependency.version;
|
|
458
|
+
return angularVersionSemver.toString();
|
|
459
|
+
}
|
|
460
|
+
exports.getAngularVersion = getAngularVersion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.supportedRange = exports.type = exports.support = 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");
|
|
@@ -10,15 +10,18 @@ const utils_2 = require("./utils");
|
|
|
10
10
|
exports.name = "Astro";
|
|
11
11
|
exports.support = "experimental";
|
|
12
12
|
exports.type = 2;
|
|
13
|
+
exports.supportedRange = "2 - 3";
|
|
13
14
|
async function discover(dir) {
|
|
14
15
|
if (!(0, fs_extra_1.existsSync)((0, path_1.join)(dir, "package.json")))
|
|
15
16
|
return;
|
|
16
|
-
|
|
17
|
+
const version = (0, utils_2.getAstroVersion)(dir);
|
|
18
|
+
if (!version)
|
|
17
19
|
return;
|
|
18
20
|
const { output, publicDir: publicDirectory } = await (0, utils_2.getConfig)(dir);
|
|
19
21
|
return {
|
|
20
22
|
mayWantBackend: output !== "static",
|
|
21
23
|
publicDirectory,
|
|
24
|
+
version,
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
exports.discover = discover;
|
|
@@ -4,6 +4,7 @@ exports.getAstroVersion = exports.getConfig = exports.getBootstrapScript = void
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
|
+
const url_1 = require("url");
|
|
7
8
|
const { dynamicImport } = require(true && "../../dynamicImport");
|
|
8
9
|
function getBootstrapScript() {
|
|
9
10
|
return `const entry = import('./entry.mjs');\nexport const handle = async (req, res) => (await entry).handler(req, res)`;
|
|
@@ -26,8 +27,8 @@ async function getConfig(cwd) {
|
|
|
26
27
|
config = astroConfig;
|
|
27
28
|
}
|
|
28
29
|
return {
|
|
29
|
-
outDir: (0, path_1.relative)(cwd, config.outDir
|
|
30
|
-
publicDir: (0, path_1.relative)(cwd, config.publicDir
|
|
30
|
+
outDir: (0, path_1.relative)(cwd, (0, url_1.fileURLToPath)(config.outDir)),
|
|
31
|
+
publicDir: (0, path_1.relative)(cwd, (0, url_1.fileURLToPath)(config.publicDir)),
|
|
31
32
|
output: config.output,
|
|
32
33
|
adapter: config.adapter,
|
|
33
34
|
};
|
|
@@ -2,32 +2,59 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_SHOULD_USE_DEV_MODE_HANDLE = exports.GET_DEFAULT_BUILD_TARGETS = exports.I18N_ROOT = exports.ALLOWED_SSR_REGIONS = exports.DEFAULT_REGION = exports.VALID_LOCALE_FORMATS = exports.VALID_ENGINES = exports.NODE_VERSION = exports.SHARP_VERSION = exports.FIREBASE_ADMIN_VERSION = exports.FIREBASE_FUNCTIONS_VERSION = exports.FIREBASE_FRAMEWORKS_VERSION = exports.MAILING_LIST_URL = exports.FEATURE_REQUEST_URL = exports.FILE_BUG_URL = exports.DEFAULT_DOCS_URL = exports.SupportLevelWarnings = exports.NPM_COMMAND_TIMEOUT_MILLIES = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
|
+
const experiments = require("../experiments");
|
|
5
6
|
exports.NPM_COMMAND_TIMEOUT_MILLIES = 10000;
|
|
6
7
|
exports.SupportLevelWarnings = {
|
|
7
8
|
["experimental"]: (framework) => `Thank you for trying our ${clc.italic("experimental")} support for ${framework} on Firebase Hosting.
|
|
8
|
-
${clc.
|
|
9
|
+
${clc.red(`While this integration is maintained by Googlers it is not a supported Firebase product.
|
|
9
10
|
Issues filed on GitHub will be addressed on a best-effort basis by maintainers and other community members.`)}`,
|
|
10
11
|
["preview"]: (framework) => `Thank you for trying our ${clc.italic("early preview")} of ${framework} support on Firebase Hosting.
|
|
11
|
-
${clc.
|
|
12
|
+
${clc.red("During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.")}`,
|
|
12
13
|
};
|
|
13
14
|
exports.DEFAULT_DOCS_URL = "https://firebase.google.com/docs/hosting/frameworks/frameworks-overview";
|
|
14
15
|
exports.FILE_BUG_URL = "https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md";
|
|
15
16
|
exports.FEATURE_REQUEST_URL = "https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md";
|
|
16
17
|
exports.MAILING_LIST_URL = "https://goo.gle/41enW5X";
|
|
17
|
-
|
|
18
|
+
const DEFAULT_FIREBASE_FRAMEWORKS_VERSION = "^0.11.0";
|
|
19
|
+
exports.FIREBASE_FRAMEWORKS_VERSION = (experiments.isEnabled("internaltesting") && process.env.FIREBASE_FRAMEWORKS_VERSION) ||
|
|
20
|
+
DEFAULT_FIREBASE_FRAMEWORKS_VERSION;
|
|
18
21
|
exports.FIREBASE_FUNCTIONS_VERSION = "^4.5.0";
|
|
19
22
|
exports.FIREBASE_ADMIN_VERSION = "^11.11.1";
|
|
20
|
-
exports.SHARP_VERSION = "^0.
|
|
23
|
+
exports.SHARP_VERSION = "^0.32.1";
|
|
21
24
|
exports.NODE_VERSION = parseInt(process.versions.node, 10);
|
|
22
25
|
exports.VALID_ENGINES = { node: [16, 18, 20] };
|
|
23
26
|
exports.VALID_LOCALE_FORMATS = [/^ALL_[a-z]+$/, /^[a-z]+_ALL$/, /^[a-z]+(_[a-z]+)?$/];
|
|
24
27
|
exports.DEFAULT_REGION = "us-central1";
|
|
25
28
|
exports.ALLOWED_SSR_REGIONS = [
|
|
26
|
-
{ name: "us-central1 (Iowa)", value: "us-central1" },
|
|
27
|
-
{ name: "us-
|
|
28
|
-
{ name: "us-
|
|
29
|
-
{ name: "
|
|
30
|
-
{ name: "
|
|
29
|
+
{ name: "us-central1 (Iowa)", value: "us-central1", recommended: true },
|
|
30
|
+
{ name: "us-east1 (South Carolina)", value: "us-east1", recommended: true },
|
|
31
|
+
{ name: "us-east4 (Northern Virginia)", value: "us-east4" },
|
|
32
|
+
{ name: "us-west1 (Oregon)", value: "us-west1", recommended: true },
|
|
33
|
+
{ name: "us-west2 (Los Angeles)", value: "us-west2" },
|
|
34
|
+
{ name: "us-west3 (Salt Lake City)", value: "us-west3" },
|
|
35
|
+
{ name: "us-west4 (Las Vegas)", value: "us-west4" },
|
|
36
|
+
{ name: "asia-east1 (Taiwan)", value: "asia-east1", recommended: true },
|
|
37
|
+
{ name: "asia-east2 (Hong Kong)", value: "asia-east2" },
|
|
38
|
+
{ name: "asia-northeast1 (Tokyo)", value: "asia-northeast1" },
|
|
39
|
+
{ name: "asia-northeast2 (Osaka)", value: "asia-northeast2" },
|
|
40
|
+
{ name: "asia-northeast3 (Seoul)", value: "asia-northeast3" },
|
|
41
|
+
{ name: "asia-south1 (Mumbai)", value: "asia-south1" },
|
|
42
|
+
{ name: "asia-south2 (Delhi)", value: "asia-south2" },
|
|
43
|
+
{ name: "asia-southeast1 (Singapore)", value: "asia-southeast1" },
|
|
44
|
+
{ name: "asia-southeast2 (Jakarta)", value: "asia-southeast2" },
|
|
45
|
+
{ name: "australia-southeast1 (Sydney)", value: "australia-southeast1" },
|
|
46
|
+
{ name: "australia-southeast2 (Melbourne)", value: "australia-southeast2" },
|
|
47
|
+
{ name: "europe-central2 (Warsaw)", value: "europe-central2" },
|
|
48
|
+
{ name: "europe-north1 (Finland)", value: "europe-north1" },
|
|
49
|
+
{ name: "europe-west1 (Belgium)", value: "europe-west1", recommended: true },
|
|
50
|
+
{ name: "europe-west2 (London)", value: "europe-west2" },
|
|
51
|
+
{ name: "europe-west3 (Frankfurt)", value: "europe-west3" },
|
|
52
|
+
{ name: "europe-west4 (Netherlands)", value: "europe-west4" },
|
|
53
|
+
{ name: "europe-west6 (Zurich)", value: "europe-west6" },
|
|
54
|
+
{ name: "northamerica-northeast1 (Montreal)", value: "northamerica-northeast1" },
|
|
55
|
+
{ name: "northamerica-northeast2 (Toronto)", value: "northamerica-northeast2" },
|
|
56
|
+
{ name: "southamerica-east1 (São Paulo)", value: "southamerica-east1" },
|
|
57
|
+
{ name: "southamerica-west1 (Santiago)", value: "southamerica-west1" },
|
|
31
58
|
];
|
|
32
59
|
exports.I18N_ROOT = "/";
|
|
33
60
|
function GET_DEFAULT_BUILD_TARGETS() {
|
package/lib/frameworks/index.js
CHANGED
|
@@ -119,7 +119,7 @@ async function prepareFrameworks(purpose, targetNames, context, options, emulato
|
|
|
119
119
|
throw new error_1.FirebaseError(`Hosting config for site ${site} places server-side content in region ${ssrRegion} which is not known. Valid regions are ${validRegions}`);
|
|
120
120
|
}
|
|
121
121
|
const getProjectPath = (...args) => (0, path_1.join)(projectRoot, source, ...args);
|
|
122
|
-
const functionId = `ssr${site.toLowerCase().replace(/-/g, "")}`;
|
|
122
|
+
const functionId = `ssr${site.toLowerCase().replace(/-/g, "").substring(0, 20)}`;
|
|
123
123
|
const usesFirebaseAdminSdk = !!(0, utils_1.findDependency)("firebase-admin", { cwd: getProjectPath() });
|
|
124
124
|
const usesFirebaseJsSdk = !!(0, utils_1.findDependency)("@firebase/app", { cwd: getProjectPath() });
|
|
125
125
|
if (usesFirebaseAdminSdk) {
|
|
@@ -190,8 +190,8 @@ async function prepareFrameworks(purpose, targetNames, context, options, emulato
|
|
|
190
190
|
throw new error_1.FirebaseError((0, utils_1.frameworksCallToAction)("Unable to detect the web framework in use, check firebase-debug.log for more info."));
|
|
191
191
|
}
|
|
192
192
|
const { framework, mayWantBackend, publicDirectory } = results;
|
|
193
|
-
const { build, ɵcodegenPublicDirectory, ɵcodegenFunctionsDirectory: codegenProdModeFunctionsDirectory, getDevModeHandle, name, support, docsUrl, getValidBuildTargets = constants_2.GET_DEFAULT_BUILD_TARGETS, shouldUseDevModeHandle = constants_2.DEFAULT_SHOULD_USE_DEV_MODE_HANDLE, } = frameworks_1.WebFrameworks[framework];
|
|
194
|
-
logger_1.logger.info(`\n${(0, utils_1.frameworksCallToAction)(constants_2.SupportLevelWarnings[support](name), docsUrl, " ")}\n`);
|
|
193
|
+
const { build, ɵcodegenPublicDirectory, ɵcodegenFunctionsDirectory: codegenProdModeFunctionsDirectory, getDevModeHandle, name, support, docsUrl, supportedRange, getValidBuildTargets = constants_2.GET_DEFAULT_BUILD_TARGETS, shouldUseDevModeHandle = constants_2.DEFAULT_SHOULD_USE_DEV_MODE_HANDLE, } = frameworks_1.WebFrameworks[framework];
|
|
194
|
+
logger_1.logger.info(`\n${(0, utils_1.frameworksCallToAction)(constants_2.SupportLevelWarnings[support](name), docsUrl, " ", name, results.version, supportedRange, results.vite)}\n`);
|
|
195
195
|
const hostingEmulatorInfo = emulators.find((e) => e.name === types_1.Emulators.HOSTING);
|
|
196
196
|
const validBuildTargets = await getValidBuildTargets(purpose, getProjectPath());
|
|
197
197
|
const frameworksBuildTarget = (0, utils_1.getFrameworksBuildTarget)(purpose, validBuildTargets);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.init = exports.build = exports.discover = exports.docsUrl = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.init = exports.build = exports.discover = exports.docsUrl = exports.type = exports.support = exports.name = exports.supportedRange = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const cross_spawn_1 = require("cross-spawn");
|
|
6
6
|
const promises_1 = require("fs/promises");
|
|
@@ -25,6 +25,7 @@ const api_1 = require("../../hosting/api");
|
|
|
25
25
|
const logger_1 = require("../../logger");
|
|
26
26
|
const DEFAULT_BUILD_SCRIPT = ["next build"];
|
|
27
27
|
const PUBLIC_DIR = "public";
|
|
28
|
+
exports.supportedRange = "12 - 14.0";
|
|
28
29
|
exports.name = "Next.js";
|
|
29
30
|
exports.support = "preview";
|
|
30
31
|
exports.type = 2;
|
|
@@ -38,9 +39,10 @@ function getReactVersion(cwd) {
|
|
|
38
39
|
async function discover(dir) {
|
|
39
40
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "package.json"))))
|
|
40
41
|
return;
|
|
41
|
-
|
|
42
|
+
const version = (0, utils_2.getNextVersion)(dir);
|
|
43
|
+
if (!(await (0, fs_extra_1.pathExists)("next.config.js")) && !version)
|
|
42
44
|
return;
|
|
43
|
-
return { mayWantBackend: true, publicDirectory: (0, path_1.join)(dir, PUBLIC_DIR) };
|
|
45
|
+
return { mayWantBackend: true, publicDirectory: (0, path_1.join)(dir, PUBLIC_DIR), version };
|
|
44
46
|
}
|
|
45
47
|
exports.discover = discover;
|
|
46
48
|
async function build(dir) {
|
|
@@ -186,7 +188,7 @@ async function init(setup, config) {
|
|
|
186
188
|
message: "What language would you like to use?",
|
|
187
189
|
choices: ["JavaScript", "TypeScript"],
|
|
188
190
|
});
|
|
189
|
-
(0, child_process_1.execSync)(`npx --yes create-next-app@
|
|
191
|
+
(0, child_process_1.execSync)(`npx --yes create-next-app@"${exports.supportedRange}" -e hello-world ${setup.hosting.source} --use-npm ${language === "TypeScript" ? "--ts" : "--js"}`, { stdio: "inherit", cwd: config.projectDir });
|
|
190
192
|
}
|
|
191
193
|
exports.init = init;
|
|
192
194
|
async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConfig = exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.init = exports.getConfig = exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.supportedRange = exports.type = exports.support = exports.name = void 0;
|
|
4
4
|
const fs_extra_1 = require("fs-extra");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -11,20 +11,22 @@ const utils_2 = require("./utils");
|
|
|
11
11
|
exports.name = "Nuxt";
|
|
12
12
|
exports.support = "experimental";
|
|
13
13
|
exports.type = 4;
|
|
14
|
+
exports.supportedRange = "3";
|
|
14
15
|
const utils_3 = require("./utils");
|
|
15
16
|
const error_1 = require("../../error");
|
|
17
|
+
const child_process_1 = require("child_process");
|
|
16
18
|
const DEFAULT_BUILD_SCRIPT = ["nuxt build", "nuxi build"];
|
|
17
19
|
async function discover(dir) {
|
|
18
20
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "package.json"))))
|
|
19
21
|
return;
|
|
20
22
|
const anyConfigFileExists = await (0, utils_3.nuxtConfigFilesExist)(dir);
|
|
21
|
-
const
|
|
22
|
-
if (!anyConfigFileExists && !
|
|
23
|
+
const version = (0, utils_2.getNuxtVersion)(dir);
|
|
24
|
+
if (!anyConfigFileExists && !version)
|
|
23
25
|
return;
|
|
24
|
-
if (
|
|
26
|
+
if (version && (0, semver_1.lt)(version, "3.0.0-0"))
|
|
25
27
|
return;
|
|
26
28
|
const { dir: { public: publicDirectory }, ssr: mayWantBackend, } = await getConfig(dir);
|
|
27
|
-
return { publicDirectory, mayWantBackend };
|
|
29
|
+
return { publicDirectory, mayWantBackend, version };
|
|
28
30
|
}
|
|
29
31
|
exports.discover = discover;
|
|
30
32
|
async function build(cwd) {
|
|
@@ -90,3 +92,11 @@ async function getConfig(dir) {
|
|
|
90
92
|
return await loadNuxtConfig(dir);
|
|
91
93
|
}
|
|
92
94
|
exports.getConfig = getConfig;
|
|
95
|
+
function init(setup, config) {
|
|
96
|
+
(0, child_process_1.execSync)(`npx --yes nuxi@"${exports.supportedRange}" init ${setup.hosting.source}`, {
|
|
97
|
+
stdio: "inherit",
|
|
98
|
+
cwd: config.projectDir,
|
|
99
|
+
});
|
|
100
|
+
return Promise.resolve();
|
|
101
|
+
}
|
|
102
|
+
exports.init = init;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.getDevModeHandle = exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.supportedRange = exports.type = exports.support = exports.name = void 0;
|
|
4
4
|
const fs_extra_1 = require("fs-extra");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -12,6 +12,7 @@ const cross_spawn_1 = require("cross-spawn");
|
|
|
12
12
|
exports.name = "Nuxt";
|
|
13
13
|
exports.support = "experimental";
|
|
14
14
|
exports.type = 2;
|
|
15
|
+
exports.supportedRange = "2";
|
|
15
16
|
async function getAndLoadNuxt(options) {
|
|
16
17
|
const nuxt = await (0, utils_1.relativeRequire)(options.rootDir, "nuxt/dist/nuxt.js");
|
|
17
18
|
const app = await nuxt.loadNuxt(options);
|
|
@@ -21,11 +22,11 @@ async function getAndLoadNuxt(options) {
|
|
|
21
22
|
async function discover(rootDir) {
|
|
22
23
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(rootDir, "package.json"))))
|
|
23
24
|
return;
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
25
|
+
const version = (0, utils_2.getNuxtVersion)(rootDir);
|
|
26
|
+
if (!version || (version && (0, semver_1.gte)(version, "3.0.0-0")))
|
|
26
27
|
return;
|
|
27
28
|
const { app } = await getAndLoadNuxt({ rootDir, for: "build" });
|
|
28
|
-
return { mayWantBackend: true, publicDirectory: app.options.dir.static };
|
|
29
|
+
return { mayWantBackend: true, publicDirectory: app.options.dir.static, version };
|
|
29
30
|
}
|
|
30
31
|
exports.discover = discover;
|
|
31
32
|
async function build(rootDir) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.getDevModeHandle = exports.discover = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.ɵcodegenFunctionsDirectory = exports.ɵcodegenPublicDirectory = exports.build = exports.supportedRange = exports.getDevModeHandle = exports.discover = exports.type = exports.support = exports.name = void 0;
|
|
4
4
|
const fs_extra_1 = require("fs-extra");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const vite_1 = require("../vite");
|
|
@@ -12,6 +12,7 @@ exports.type = 2;
|
|
|
12
12
|
exports.discover = (0, vite_1.viteDiscoverWithNpmDependency)("@sveltejs/kit");
|
|
13
13
|
var vite_2 = require("../vite");
|
|
14
14
|
Object.defineProperty(exports, "getDevModeHandle", { enumerable: true, get: function () { return vite_2.getDevModeHandle; } });
|
|
15
|
+
Object.defineProperty(exports, "supportedRange", { enumerable: true, get: function () { return vite_2.supportedRange; } });
|
|
15
16
|
async function build(root) {
|
|
16
17
|
var _a;
|
|
17
18
|
const config = await getConfig(root);
|
package/lib/frameworks/utils.js
CHANGED
|
@@ -7,6 +7,7 @@ const promises_1 = require("fs/promises");
|
|
|
7
7
|
const http_1 = require("http");
|
|
8
8
|
const cross_spawn_1 = require("cross-spawn");
|
|
9
9
|
const clc = require("colorette");
|
|
10
|
+
const semver_1 = require("semver");
|
|
10
11
|
const logger_1 = require("../logger");
|
|
11
12
|
const error_1 = require("../error");
|
|
12
13
|
const fsutils_1 = require("../fsutils");
|
|
@@ -206,20 +207,23 @@ function relativeRequire(dir, mod) {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
exports.relativeRequire = relativeRequire;
|
|
209
|
-
function conjoinOptions(
|
|
210
|
-
if (!
|
|
211
|
-
return;
|
|
210
|
+
function conjoinOptions(_opts, conjunction = "and", separator = ",") {
|
|
211
|
+
if (!_opts.length)
|
|
212
|
+
return "";
|
|
213
|
+
const opts = _opts.map((it) => it.toString().trim());
|
|
212
214
|
if (opts.length === 1)
|
|
213
|
-
return opts[0]
|
|
215
|
+
return opts[0];
|
|
214
216
|
if (opts.length === 2)
|
|
215
|
-
return `${opts[0]
|
|
216
|
-
const lastElement = opts.slice(-1)[0]
|
|
217
|
-
const allButLast = opts.slice(0, -1)
|
|
217
|
+
return `${opts[0]} ${conjunction} ${opts[1]}`;
|
|
218
|
+
const lastElement = opts.slice(-1)[0];
|
|
219
|
+
const allButLast = opts.slice(0, -1);
|
|
218
220
|
return `${allButLast.join(`${separator} `)}${separator} ${conjunction} ${lastElement}`;
|
|
219
221
|
}
|
|
220
222
|
exports.conjoinOptions = conjoinOptions;
|
|
221
|
-
function frameworksCallToAction(message, docsUrl = constants_1.DEFAULT_DOCS_URL, prefix = "") {
|
|
222
|
-
return `${prefix}${message}
|
|
223
|
+
function frameworksCallToAction(message, docsUrl = constants_1.DEFAULT_DOCS_URL, prefix = "", framework, version, supportedRange, vite = false) {
|
|
224
|
+
return `${prefix}${message}${framework && supportedRange && (!version || !(0, semver_1.satisfies)(version, supportedRange))
|
|
225
|
+
? clc.yellow(`\n${prefix}The integration is known to work with ${vite ? "Vite" : framework} version ${clc.italic(conjoinOptions(supportedRange.split("||")))}. You may encounter errors.`)
|
|
226
|
+
: ``}
|
|
223
227
|
|
|
224
228
|
${prefix}${clc.bold("Documentation:")} ${docsUrl}
|
|
225
229
|
${prefix}${clc.bold("File a bug:")} ${constants_1.FILE_BUG_URL}
|