firebase-tools 13.0.3 → 13.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.
- package/lib/commands/apphosting-backends-list.js +20 -36
- package/lib/deploy/hosting/convertConfig.js +5 -0
- package/lib/emulator/auth/handlers.js +1 -1
- package/lib/emulator/auth/operations.js +1 -1
- package/lib/frameworks/angular/index.js +2 -2
- package/lib/frameworks/angular/utils.js +14 -10
- package/lib/frameworks/astro/index.js +1 -2
- package/lib/frameworks/flutter/index.js +1 -1
- package/lib/frameworks/index.js +2 -3
- package/lib/frameworks/next/index.js +5 -3
- package/lib/frameworks/nuxt/index.js +2 -2
- package/lib/frameworks/nuxt2/index.js +1 -2
- package/lib/frameworks/sveltekit/index.js +2 -2
- package/lib/frameworks/utils.js +11 -2
- package/lib/frameworks/vite/index.js +8 -4
- package/lib/gcp/apphosting.js +1 -1
- package/lib/gcp/cloudfunctionsv2.js +2 -4
- package/lib/hosting/api.js +6 -9
- package/package.json +1 -1
|
@@ -1,58 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
|
+
const Table = require("cli-table");
|
|
4
5
|
const command_1 = require("../command");
|
|
5
|
-
const
|
|
6
|
+
const utils_1 = require("../utils");
|
|
6
7
|
const error_1 = require("../error");
|
|
7
8
|
const logger_1 = require("../logger");
|
|
9
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
10
|
const apphosting = require("../gcp/apphosting");
|
|
9
|
-
const
|
|
10
|
-
const COLUMN_LENGTH = 20;
|
|
11
|
-
const TABLE_HEAD = ["Backend Id", "Repository", "Location", "URL", "Created Date", "Updated Date"];
|
|
11
|
+
const TABLE_HEAD = ["Backend ID", "Repository", "Location", "URL", "Created Date", "Updated Date"];
|
|
12
12
|
exports.command = new command_1.Command("apphosting:backends:list")
|
|
13
13
|
.description("List backends of a Firebase project.")
|
|
14
14
|
.option("-l, --location <location>", "App Backend location", "-")
|
|
15
15
|
.before(apphosting.ensureApiEnabled)
|
|
16
16
|
.action(async (options) => {
|
|
17
|
+
var _a, _b, _c;
|
|
17
18
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
18
19
|
const location = options.location;
|
|
19
|
-
const table = new Table({
|
|
20
|
-
|
|
21
|
-
style: { head: ["green"] },
|
|
22
|
-
});
|
|
23
|
-
table.colWidths = COLUMN_LENGTH;
|
|
24
|
-
const backendsList = [];
|
|
20
|
+
const table = new Table({ head: TABLE_HEAD, style: { head: ["green"] } });
|
|
21
|
+
let backendRes;
|
|
25
22
|
try {
|
|
26
|
-
|
|
27
|
-
backendsList.push(...(backendsPerRegion.backends || []));
|
|
28
|
-
populateTable(backendsList, table);
|
|
29
|
-
logger_1.logger.info(table.toString());
|
|
23
|
+
backendRes = await apphosting.listBackends(projectId, location);
|
|
30
24
|
}
|
|
31
25
|
catch (err) {
|
|
32
26
|
throw new error_1.FirebaseError(`Unable to list backends present for project: ${projectId}. Please check the parameters you have provided.`, { original: err });
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
function populateTable(backends, table) {
|
|
37
|
-
var _a, _b;
|
|
28
|
+
const backends = backendRes === null || backendRes === void 0 ? void 0 : backendRes.backends;
|
|
38
29
|
for (const backend of backends) {
|
|
39
|
-
const [
|
|
40
|
-
|
|
30
|
+
const [backendLocation, , backendId] = backend.name.split("/").slice(3, 6);
|
|
31
|
+
table.push([
|
|
41
32
|
backendId,
|
|
42
|
-
(_b = (_a = backend.codebase) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.split("/").pop(),
|
|
43
|
-
|
|
44
|
-
backend.uri,
|
|
45
|
-
backend.createTime,
|
|
46
|
-
backend.updateTime,
|
|
47
|
-
];
|
|
48
|
-
const newRow = entry.map((name) => {
|
|
49
|
-
const maxCellWidth = COLUMN_LENGTH - 2;
|
|
50
|
-
const chunks = [];
|
|
51
|
-
for (let i = 0; name && i < name.length; i += maxCellWidth) {
|
|
52
|
-
chunks.push(name.substring(i, i + maxCellWidth));
|
|
53
|
-
}
|
|
54
|
-
return chunks.join("\n");
|
|
55
|
-
});
|
|
56
|
-
table.push(newRow);
|
|
33
|
+
(_c = (_b = (_a = backend.codebase) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.split("/").pop()) !== null && _c !== void 0 ? _c : "",
|
|
34
|
+
backendLocation,
|
|
35
|
+
backend.uri.startsWith("https:") ? backend.uri : "https://" + backend.uri,
|
|
36
|
+
(0, utils_1.datetimeString)(new Date(backend.createTime)),
|
|
37
|
+
(0, utils_1.datetimeString)(new Date(backend.updateTime)),
|
|
38
|
+
]);
|
|
57
39
|
}
|
|
58
|
-
|
|
40
|
+
logger_1.logger.info(table.toString());
|
|
41
|
+
return backends;
|
|
42
|
+
});
|
|
@@ -125,6 +125,11 @@ async function convertConfig(context, functionsPayload, deploy) {
|
|
|
125
125
|
region: endpoint.region,
|
|
126
126
|
} });
|
|
127
127
|
if (rewrite.function.pinTag) {
|
|
128
|
+
if (endpoint.minInstances) {
|
|
129
|
+
throw new error_1.FirebaseError(`Function ${endpoint.id} has minInstances set and is in a rewrite ` +
|
|
130
|
+
"pinTags=true. These features are not currently compatible with each " +
|
|
131
|
+
"other.");
|
|
132
|
+
}
|
|
128
133
|
experiments.assertEnabled("pintags", "pin a function version");
|
|
129
134
|
apiRewrite.run.tag = runTags.TODO_TAG_NAME;
|
|
130
135
|
}
|
|
@@ -159,7 +159,7 @@ function registerHandlers(app, getProjectStateByApiKey) {
|
|
|
159
159
|
res.set("Content-Type", "text/html; charset=utf-8");
|
|
160
160
|
const apiKey = req.query.apiKey;
|
|
161
161
|
const providerId = req.query.providerId;
|
|
162
|
-
const tenantId = req.query.tenantId;
|
|
162
|
+
const tenantId = (req.query.tenantId || req.query.tid);
|
|
163
163
|
if (!apiKey || !providerId) {
|
|
164
164
|
return res.status(400).json({
|
|
165
165
|
authEmulator: {
|
|
@@ -1151,7 +1151,7 @@ async function signInWithIdp(state, reqBody) {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
else {
|
|
1153
1153
|
if (!response.localId) {
|
|
1154
|
-
throw new Error("Internal assertion error: localId not set for
|
|
1154
|
+
throw new Error("Internal assertion error: localId not set for existing user.");
|
|
1155
1155
|
}
|
|
1156
1156
|
const maybeUser = state.getUserByLocalId(response.localId);
|
|
1157
1157
|
(0, errors_1.assert)(maybeUser, "USER_NOT_FOUND");
|
|
@@ -22,7 +22,7 @@ async function discover(dir) {
|
|
|
22
22
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "angular.json"))))
|
|
23
23
|
return;
|
|
24
24
|
const version = (0, utils_2.getAngularVersion)(dir);
|
|
25
|
-
return { mayWantBackend: true,
|
|
25
|
+
return { mayWantBackend: true, version };
|
|
26
26
|
}
|
|
27
27
|
exports.discover = discover;
|
|
28
28
|
function init(setup, config) {
|
|
@@ -59,7 +59,7 @@ async function build(dir, configuration) {
|
|
|
59
59
|
}
|
|
60
60
|
exports.build = build;
|
|
61
61
|
async function getDevModeHandle(dir, configuration) {
|
|
62
|
-
const { targetStringFromTarget } = (0, utils_1.relativeRequire)(dir, "@angular-devkit/architect");
|
|
62
|
+
const { targetStringFromTarget } = await (0, utils_1.relativeRequire)(dir, "@angular-devkit/architect");
|
|
63
63
|
const { serveTarget } = await (0, utils_2.getContext)(dir, configuration);
|
|
64
64
|
if (!serveTarget)
|
|
65
65
|
throw new Error("Could not find the serveTarget");
|
|
@@ -9,7 +9,7 @@ const utils_2 = require("../../utils");
|
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
10
|
async function localesForTarget(dir, architectHost, target, workspaceProject) {
|
|
11
11
|
var _a;
|
|
12
|
-
const { targetStringFromTarget } = (0, utils_1.relativeRequire)(dir, "@angular-devkit/architect");
|
|
12
|
+
const { targetStringFromTarget } = await (0, utils_1.relativeRequire)(dir, "@angular-devkit/architect");
|
|
13
13
|
const targetOptions = await architectHost.getOptionsForTarget(target);
|
|
14
14
|
if (!targetOptions) {
|
|
15
15
|
const targetString = targetStringFromTarget(target);
|
|
@@ -72,9 +72,11 @@ function getValidBuilders(purpose) {
|
|
|
72
72
|
}
|
|
73
73
|
async function getAllTargets(purpose, dir) {
|
|
74
74
|
const validBuilders = getValidBuilders(purpose);
|
|
75
|
-
const { NodeJsAsyncHost }
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const [{ NodeJsAsyncHost }, { workspaces }, { targetStringFromTarget }] = await Promise.all([
|
|
76
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/core/node"),
|
|
77
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/core"),
|
|
78
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/architect"),
|
|
79
|
+
]);
|
|
78
80
|
const host = workspaces.createWorkspaceHost(new NodeJsAsyncHost());
|
|
79
81
|
const { workspace } = await workspaces.readWorkspace(dir, host);
|
|
80
82
|
const targets = [];
|
|
@@ -98,11 +100,13 @@ async function getAllTargets(purpose, dir) {
|
|
|
98
100
|
}
|
|
99
101
|
exports.getAllTargets = getAllTargets;
|
|
100
102
|
async function getContext(dir, targetOrConfiguration) {
|
|
101
|
-
const { NodeJsAsyncHost }
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
const [{ NodeJsAsyncHost }, { workspaces }, { WorkspaceNodeModulesArchitectHost }, { Architect, targetFromTargetString, targetStringFromTarget }, { parse },] = await Promise.all([
|
|
104
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/core/node"),
|
|
105
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/core"),
|
|
106
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/architect/node"),
|
|
107
|
+
(0, utils_1.relativeRequire)(dir, "@angular-devkit/architect"),
|
|
108
|
+
(0, utils_1.relativeRequire)(dir, "jsonc-parser"),
|
|
109
|
+
]);
|
|
106
110
|
const host = workspaces.createWorkspaceHost(new NodeJsAsyncHost());
|
|
107
111
|
const { workspace } = await workspaces.readWorkspace(dir, host);
|
|
108
112
|
const architectHost = new WorkspaceNodeModulesArchitectHost(workspace, dir);
|
|
@@ -427,7 +431,7 @@ async function getServerConfig(sourceDir, configuration) {
|
|
|
427
431
|
}
|
|
428
432
|
exports.getServerConfig = getServerConfig;
|
|
429
433
|
async function getBuildConfig(sourceDir, configuration) {
|
|
430
|
-
const { targetStringFromTarget } = (0, utils_1.relativeRequire)(sourceDir, "@angular-devkit/architect");
|
|
434
|
+
const { targetStringFromTarget } = await (0, utils_1.relativeRequire)(sourceDir, "@angular-devkit/architect");
|
|
431
435
|
const { buildTarget, browserTarget, baseHref, prerenderTarget, serverTarget, architectHost, workspaceProject, serveOptimizedImages, ssr, } = await getContext(sourceDir, configuration);
|
|
432
436
|
const targets = (buildTarget
|
|
433
437
|
? [buildTarget]
|
|
@@ -17,10 +17,9 @@ async function discover(dir) {
|
|
|
17
17
|
const version = (0, utils_2.getAstroVersion)(dir);
|
|
18
18
|
if (!version)
|
|
19
19
|
return;
|
|
20
|
-
const { output
|
|
20
|
+
const { output } = await (0, utils_2.getConfig)(dir);
|
|
21
21
|
return {
|
|
22
22
|
mayWantBackend: output !== "static",
|
|
23
|
-
publicDirectory,
|
|
24
23
|
version,
|
|
25
24
|
};
|
|
26
25
|
}
|
|
@@ -23,7 +23,7 @@ async function discover(dir) {
|
|
|
23
23
|
const usingFlutter = (_a = pubSpec.dependencies) === null || _a === void 0 ? void 0 : _a.flutter;
|
|
24
24
|
if (!usingFlutter)
|
|
25
25
|
return;
|
|
26
|
-
return { mayWantBackend: false
|
|
26
|
+
return { mayWantBackend: false };
|
|
27
27
|
}
|
|
28
28
|
exports.discover = discover;
|
|
29
29
|
function init(setup, config) {
|
package/lib/frameworks/index.js
CHANGED
|
@@ -189,7 +189,7 @@ async function prepareFrameworks(purpose, targetNames, context, options, emulato
|
|
|
189
189
|
if (!results) {
|
|
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
|
-
const { framework, mayWantBackend
|
|
192
|
+
const { framework, mayWantBackend } = results;
|
|
193
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
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);
|
|
@@ -211,7 +211,6 @@ async function prepareFrameworks(purpose, targetNames, context, options, emulato
|
|
|
211
211
|
getDevModeHandle &&
|
|
212
212
|
(await getDevModeHandle(getProjectPath(), frameworksBuildTarget, hostingEmulatorInfo));
|
|
213
213
|
if (devModeHandle) {
|
|
214
|
-
config.public = (0, path_1.relative)(projectRoot, publicDirectory);
|
|
215
214
|
options.frameworksDevModeHandle = devModeHandle;
|
|
216
215
|
if (mayWantBackend && firebaseDefaults) {
|
|
217
216
|
codegenFunctionsDirectory = codegenDevModeFunctionsDirectory;
|
|
@@ -239,10 +238,10 @@ async function prepareFrameworks(purpose, targetNames, context, options, emulato
|
|
|
239
238
|
project,
|
|
240
239
|
site,
|
|
241
240
|
});
|
|
242
|
-
config.public = (0, path_1.relative)(projectRoot, hostingDist);
|
|
243
241
|
if (wantsBackend && !omitCloudFunction)
|
|
244
242
|
codegenFunctionsDirectory = codegenProdModeFunctionsDirectory;
|
|
245
243
|
}
|
|
244
|
+
config.public = (0, path_1.relative)(projectRoot, hostingDist);
|
|
246
245
|
config.webFramework = `${framework}${codegenFunctionsDirectory ? "_ssr" : ""}`;
|
|
247
246
|
if (codegenFunctionsDirectory) {
|
|
248
247
|
if (firebaseDefaults) {
|
|
@@ -379,7 +379,7 @@ async function getDevModeHandle(dir, _, hostingEmulatorInfo) {
|
|
|
379
379
|
throw new error_1.FirebaseError(`${clc.bold("firebase serve")} does not support Next.js Middleware. Please use ${clc.bold("firebase emulators:start")} instead.`);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
let next = (0, utils_1.relativeRequire)(dir, "next");
|
|
382
|
+
let next = await (0, utils_1.relativeRequire)(dir, "next");
|
|
383
383
|
if ("default" in next)
|
|
384
384
|
next = next.default;
|
|
385
385
|
const nextApp = next({
|
|
@@ -405,8 +405,10 @@ async function getConfig(dir) {
|
|
|
405
405
|
if (!version)
|
|
406
406
|
throw new Error("Unable to find the next dep, try NPM installing?");
|
|
407
407
|
if ((0, semver_1.gte)(version, "12.0.0")) {
|
|
408
|
-
const { default: loadConfig } =
|
|
409
|
-
|
|
408
|
+
const [{ default: loadConfig }, { PHASE_PRODUCTION_BUILD }] = await Promise.all([
|
|
409
|
+
(0, utils_1.relativeRequire)(dir, "next/dist/server/config"),
|
|
410
|
+
(0, utils_1.relativeRequire)(dir, "next/constants"),
|
|
411
|
+
]);
|
|
410
412
|
config = await loadConfig(PHASE_PRODUCTION_BUILD, dir);
|
|
411
413
|
}
|
|
412
414
|
else {
|
|
@@ -25,8 +25,8 @@ async function discover(dir) {
|
|
|
25
25
|
return;
|
|
26
26
|
if (version && (0, semver_1.lt)(version, "3.0.0-0"))
|
|
27
27
|
return;
|
|
28
|
-
const {
|
|
29
|
-
return {
|
|
28
|
+
const { ssr: mayWantBackend } = await getConfig(dir);
|
|
29
|
+
return { mayWantBackend, version };
|
|
30
30
|
}
|
|
31
31
|
exports.discover = discover;
|
|
32
32
|
async function build(cwd) {
|
|
@@ -25,8 +25,7 @@ async function discover(rootDir) {
|
|
|
25
25
|
const version = (0, utils_2.getNuxtVersion)(rootDir);
|
|
26
26
|
if (!version || (version && (0, semver_1.gte)(version, "3.0.0-0")))
|
|
27
27
|
return;
|
|
28
|
-
|
|
29
|
-
return { mayWantBackend: true, publicDirectory: app.options.dir.static, version };
|
|
28
|
+
return { mayWantBackend: true, version };
|
|
30
29
|
}
|
|
31
30
|
exports.discover = discover;
|
|
32
31
|
async function build(rootDir) {
|
|
@@ -13,11 +13,11 @@ 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
15
|
Object.defineProperty(exports, "supportedRange", { enumerable: true, get: function () { return vite_2.supportedRange; } });
|
|
16
|
-
async function build(root) {
|
|
16
|
+
async function build(root, target) {
|
|
17
17
|
var _a;
|
|
18
18
|
const config = await getConfig(root);
|
|
19
19
|
const wantsBackend = ((_a = config.kit.adapter) === null || _a === void 0 ? void 0 : _a.name) !== "@sveltejs/adapter-static";
|
|
20
|
-
await (0, vite_1.build)(root);
|
|
20
|
+
await (0, vite_1.build)(root, target);
|
|
21
21
|
return { wantsBackend };
|
|
22
22
|
}
|
|
23
23
|
exports.build = build;
|
package/lib/frameworks/utils.js
CHANGED
|
@@ -189,11 +189,20 @@ function findDependency(name, options = {}) {
|
|
|
189
189
|
return scanDependencyTree(name, json.dependencies);
|
|
190
190
|
}
|
|
191
191
|
exports.findDependency = findDependency;
|
|
192
|
-
function relativeRequire(dir, mod) {
|
|
192
|
+
async function relativeRequire(dir, mod) {
|
|
193
193
|
try {
|
|
194
194
|
const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
|
|
195
195
|
const path = requireFunc.resolve(mod, { paths: [dir] });
|
|
196
|
-
|
|
196
|
+
let packageJson;
|
|
197
|
+
let isEsm = (0, path_1.extname)(path) === ".mjs";
|
|
198
|
+
if (!isEsm) {
|
|
199
|
+
packageJson = await readJSON((0, path_1.join)((0, path_1.dirname)(path), "package.json")).catch(() => undefined);
|
|
200
|
+
isEsm = (packageJson === null || packageJson === void 0 ? void 0 : packageJson.type) === "module";
|
|
201
|
+
}
|
|
202
|
+
if (isEsm) {
|
|
203
|
+
if ((0, path_1.extname)(path) === ".cjs" && (packageJson === null || packageJson === void 0 ? void 0 : packageJson.main)) {
|
|
204
|
+
return dynamicImport((0, path_1.join)((0, path_1.dirname)(path), packageJson.main));
|
|
205
|
+
}
|
|
197
206
|
return dynamicImport((0, url_1.pathToFileURL)(path).toString());
|
|
198
207
|
}
|
|
199
208
|
else {
|
|
@@ -68,13 +68,17 @@ async function discover(dir, plugin, npmDependency) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
exports.discover = discover;
|
|
71
|
-
async function build(root) {
|
|
72
|
-
const { build } = (0, utils_1.relativeRequire)(root, "vite");
|
|
71
|
+
async function build(root, target) {
|
|
72
|
+
const { build } = await (0, utils_1.relativeRequire)(root, "vite");
|
|
73
73
|
await (0, utils_1.warnIfCustomBuildScript)(root, exports.name, exports.DEFAULT_BUILD_SCRIPT);
|
|
74
74
|
const cwd = process.cwd();
|
|
75
75
|
process.chdir(root);
|
|
76
|
-
|
|
76
|
+
const originalNodeEnv = process.env.NODE_ENV;
|
|
77
|
+
const envKey = "NODE_ENV";
|
|
78
|
+
process.env[envKey] = target;
|
|
79
|
+
await build({ root, mode: target });
|
|
77
80
|
process.chdir(cwd);
|
|
81
|
+
process.env[envKey] = originalNodeEnv;
|
|
78
82
|
return { rewrites: [{ source: "**", destination: "/index.html" }] };
|
|
79
83
|
}
|
|
80
84
|
exports.build = build;
|
|
@@ -104,7 +108,7 @@ async function getDevModeHandle(dir) {
|
|
|
104
108
|
}
|
|
105
109
|
exports.getDevModeHandle = getDevModeHandle;
|
|
106
110
|
async function getConfig(root) {
|
|
107
|
-
const { resolveConfig } = (0, utils_1.relativeRequire)(root, "vite");
|
|
111
|
+
const { resolveConfig } = await (0, utils_1.relativeRequire)(root, "vite");
|
|
108
112
|
const cwd = process.cwd();
|
|
109
113
|
process.chdir(root);
|
|
110
114
|
const config = await resolveConfig({ root }, "build", "production");
|
package/lib/gcp/apphosting.js
CHANGED
|
@@ -31,7 +31,7 @@ async function listBackends(projectId, location) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.listBackends = listBackends;
|
|
33
33
|
async function deleteBackend(projectId, location, backendId) {
|
|
34
|
-
const name = `projects/${projectId}/locations/${location}/backends/${backendId}`;
|
|
34
|
+
const name = `projects/${projectId}/locations/${location}/backends/${backendId}?force=true`;
|
|
35
35
|
const res = await client.delete(name);
|
|
36
36
|
return res.body;
|
|
37
37
|
}
|
|
@@ -91,7 +91,7 @@ async function createFunction(cloudFunction) {
|
|
|
91
91
|
const components = cloudFunction.name.split("/");
|
|
92
92
|
const functionId = components.splice(-1, 1)[0];
|
|
93
93
|
cloudFunction.buildConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.buildConfig.environmentVariables), { GOOGLE_NODE_RUN_SCRIPTS: "" });
|
|
94
|
-
cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET:
|
|
94
|
+
cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", ".") });
|
|
95
95
|
try {
|
|
96
96
|
const res = await client.post(components.join("/"), cloudFunction, { queryParams: { functionId } });
|
|
97
97
|
return res.body;
|
|
@@ -144,12 +144,10 @@ async function listFunctionsInternal(projectId, region) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
async function updateFunction(cloudFunction) {
|
|
147
|
-
const components = cloudFunction.name.split("/");
|
|
148
|
-
const functionId = components.splice(-1, 1)[0];
|
|
149
147
|
const fieldMasks = proto.fieldMasks(cloudFunction, "labels", "serviceConfig.environmentVariables", "serviceConfig.secretEnvironmentVariables");
|
|
150
148
|
cloudFunction.buildConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.buildConfig.environmentVariables), { GOOGLE_NODE_RUN_SCRIPTS: "" });
|
|
151
149
|
fieldMasks.push("buildConfig.buildEnvironmentVariables");
|
|
152
|
-
cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET:
|
|
150
|
+
cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", ".") });
|
|
153
151
|
try {
|
|
154
152
|
const queryParams = {
|
|
155
153
|
updateMask: fieldMasks.join(","),
|
package/lib/hosting/api.js
CHANGED
|
@@ -46,15 +46,13 @@ async function getChannel(project = "-", site, channelId) {
|
|
|
46
46
|
}
|
|
47
47
|
exports.getChannel = getChannel;
|
|
48
48
|
async function listChannels(project = "-", site) {
|
|
49
|
+
var _a;
|
|
49
50
|
const channels = [];
|
|
50
51
|
let nextPageToken = "";
|
|
51
52
|
for (;;) {
|
|
52
53
|
try {
|
|
53
54
|
const res = await apiClient.get(`/projects/${project}/sites/${site}/channels`, { queryParams: { pageToken: nextPageToken, pageSize: 10 } });
|
|
54
|
-
|
|
55
|
-
if (c) {
|
|
56
|
-
channels.push(...c);
|
|
57
|
-
}
|
|
55
|
+
channels.push(...((_a = res.body.channels) !== null && _a !== void 0 ? _a : []));
|
|
58
56
|
nextPageToken = res.body.nextPageToken || "";
|
|
59
57
|
if (!nextPageToken) {
|
|
60
58
|
return channels;
|
|
@@ -100,6 +98,7 @@ async function updateVersion(site, versionId, version) {
|
|
|
100
98
|
}
|
|
101
99
|
exports.updateVersion = updateVersion;
|
|
102
100
|
async function listVersions(site) {
|
|
101
|
+
var _a;
|
|
103
102
|
let pageToken = undefined;
|
|
104
103
|
const versions = [];
|
|
105
104
|
do {
|
|
@@ -110,7 +109,7 @@ async function listVersions(site) {
|
|
|
110
109
|
const res = await apiClient.get(`projects/-/sites/${site}/versions`, {
|
|
111
110
|
queryParams,
|
|
112
111
|
});
|
|
113
|
-
versions.push(...res.body.versions);
|
|
112
|
+
versions.push(...((_a = res.body.versions) !== null && _a !== void 0 ? _a : []));
|
|
114
113
|
pageToken = res.body.nextPageToken;
|
|
115
114
|
} while (pageToken);
|
|
116
115
|
return versions;
|
|
@@ -137,15 +136,13 @@ async function createRelease(site, channel, version, partialRelease) {
|
|
|
137
136
|
}
|
|
138
137
|
exports.createRelease = createRelease;
|
|
139
138
|
async function listSites(project) {
|
|
139
|
+
var _a;
|
|
140
140
|
const sites = [];
|
|
141
141
|
let nextPageToken = "";
|
|
142
142
|
for (;;) {
|
|
143
143
|
try {
|
|
144
144
|
const res = await apiClient.get(`/projects/${project}/sites`, { queryParams: { pageToken: nextPageToken, pageSize: 10 } });
|
|
145
|
-
|
|
146
|
-
if (c) {
|
|
147
|
-
sites.push(...c);
|
|
148
|
-
}
|
|
145
|
+
sites.push(...((_a = res.body.sites) !== null && _a !== void 0 ? _a : []));
|
|
149
146
|
nextPageToken = res.body.nextPageToken || "";
|
|
150
147
|
if (!nextPageToken) {
|
|
151
148
|
return sites;
|