firebase-tools 13.0.3 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/appdistribution/client.js +36 -28
- package/lib/appdistribution/options-parser-util.js +80 -1
- package/lib/appdistribution/types.js +31 -0
- package/lib/commands/appdistribution-distribute.js +70 -10
- package/lib/commands/apphosting-backends-list.js +20 -36
- package/lib/commands/apphosting-builds-create.js +2 -2
- package/lib/commands/apphosting-rollouts-create.js +2 -2
- package/lib/commands/apphosting-rollouts-list.js +4 -1
- package/lib/commands/functions-config-export.js +4 -2
- package/lib/commands/use.js +4 -1
- package/lib/deploy/hosting/convertConfig.js +5 -0
- package/lib/deploy/hosting/prepare.js +2 -1
- package/lib/emulator/auth/handlers.js +1 -1
- package/lib/emulator/auth/operations.js +43 -14
- package/lib/emulator/auth/state.js +15 -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 +84 -15
- package/lib/gcp/cloudfunctionsv2.js +2 -4
- package/lib/hosting/api.js +6 -9
- package/lib/init/features/apphosting/index.js +28 -11
- package/lib/utils.js +1 -12
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ const error_1 = require("../../../error");
|
|
|
12
12
|
const prompt_1 = require("../../../prompt");
|
|
13
13
|
const constants_1 = require("./constants");
|
|
14
14
|
const ensureApiEnabled_1 = require("../../../ensureApiEnabled");
|
|
15
|
+
const deploymentTool = require("../../../deploymentTool");
|
|
15
16
|
const apphostingPollerOptions = {
|
|
16
17
|
apiOrigin: api_1.apphostingOrigin,
|
|
17
18
|
apiVersion: apphosting_1.API_VERSION,
|
|
@@ -54,6 +55,25 @@ async function doSetup(setup, projectId) {
|
|
|
54
55
|
(0, utils_1.logWarning)(`Backend with id ${backendId} already exists in ${location}`);
|
|
55
56
|
}
|
|
56
57
|
const backend = await onboardBackend(projectId, location, backendId);
|
|
58
|
+
const branch = await (0, prompt_1.promptOnce)({
|
|
59
|
+
name: "branch",
|
|
60
|
+
type: "input",
|
|
61
|
+
default: "main",
|
|
62
|
+
message: "Pick a branch for continuous deployment",
|
|
63
|
+
});
|
|
64
|
+
const traffic = {
|
|
65
|
+
rolloutPolicy: {
|
|
66
|
+
codebaseBranch: branch,
|
|
67
|
+
stages: [
|
|
68
|
+
{
|
|
69
|
+
progression: "IMMEDIATE",
|
|
70
|
+
targetPercent: 100,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
const op = await apphosting.updateTraffic(projectId, location, backendId, traffic);
|
|
76
|
+
await poller.pollOperation(Object.assign(Object.assign({}, apphostingPollerOptions), { pollerName: `updateTraffic-${projectId}-${location}-${backendId}`, operationResourceName: op.name }));
|
|
57
77
|
const confirmRollout = await (0, prompt_1.promptOnce)({
|
|
58
78
|
type: "confirm",
|
|
59
79
|
name: "rollout",
|
|
@@ -65,12 +85,6 @@ async function doSetup(setup, projectId) {
|
|
|
65
85
|
(0, utils_1.logSuccess)(`Your site will be deployed at:\n\thttps://${backend.uri}`);
|
|
66
86
|
return;
|
|
67
87
|
}
|
|
68
|
-
const branch = await (0, prompt_1.promptOnce)({
|
|
69
|
-
name: "branch",
|
|
70
|
-
type: "input",
|
|
71
|
-
default: "main",
|
|
72
|
-
message: "Which branch do you want to deploy?",
|
|
73
|
-
});
|
|
74
88
|
const { build } = await onboardRollout(projectId, location, backendId, {
|
|
75
89
|
source: {
|
|
76
90
|
codebase: {
|
|
@@ -79,6 +93,10 @@ async function doSetup(setup, projectId) {
|
|
|
79
93
|
},
|
|
80
94
|
});
|
|
81
95
|
if (build.state !== "READY") {
|
|
96
|
+
if (!build.buildLogsUri) {
|
|
97
|
+
throw new error_1.FirebaseError("Failed to build your app, but failed to get build logs as well. " +
|
|
98
|
+
"This is an internal error and should be reported");
|
|
99
|
+
}
|
|
82
100
|
throw new error_1.FirebaseError(`Failed to build your app. Please inspect the build logs at ${build.buildLogsUri}.`, { children: [build.error] });
|
|
83
101
|
}
|
|
84
102
|
(0, utils_1.logSuccess)(`Successfully created backend:\n\t${backend.name}`);
|
|
@@ -103,7 +121,7 @@ function toBackend(cloudBuildConnRepo) {
|
|
|
103
121
|
repository: `${cloudBuildConnRepo.name}`,
|
|
104
122
|
rootDirectory: "/",
|
|
105
123
|
},
|
|
106
|
-
labels:
|
|
124
|
+
labels: deploymentTool.labels(),
|
|
107
125
|
};
|
|
108
126
|
}
|
|
109
127
|
async function onboardBackend(projectId, location, backendId) {
|
|
@@ -120,13 +138,12 @@ async function createBackend(projectId, location, backendReqBoby, backendId) {
|
|
|
120
138
|
exports.createBackend = createBackend;
|
|
121
139
|
async function onboardRollout(projectId, location, backendId, buildInput) {
|
|
122
140
|
(0, utils_1.logBullet)("Starting a new rollout... this may take a few minutes.");
|
|
123
|
-
const buildId = (
|
|
141
|
+
const buildId = await apphosting.getNextRolloutId(projectId, location, backendId, 1);
|
|
124
142
|
const buildOp = await apphosting.createBuild(projectId, location, backendId, buildId, buildInput);
|
|
125
|
-
const
|
|
126
|
-
const rolloutOp = await apphosting.createRollout(projectId, location, backendId, rolloutId, {
|
|
143
|
+
const rolloutOp = await apphosting.createRollout(projectId, location, backendId, buildId, {
|
|
127
144
|
build: `projects/${projectId}/locations/${location}/backends/${backendId}/builds/${buildId}`,
|
|
128
145
|
});
|
|
129
|
-
const rolloutPoll = poller.pollOperation(Object.assign(Object.assign({}, apphostingPollerOptions), { pollerName: `create-${projectId}-${location}-backend-${backendId}-rollout-${
|
|
146
|
+
const rolloutPoll = poller.pollOperation(Object.assign(Object.assign({}, apphostingPollerOptions), { pollerName: `create-${projectId}-${location}-backend-${backendId}-rollout-${buildId}`, operationResourceName: rolloutOp.name }));
|
|
130
147
|
const buildPoll = poller.pollOperation(Object.assign(Object.assign({}, apphostingPollerOptions), { pollerName: `create-${projectId}-${location}-backend-${backendId}-build-${buildId}`, operationResourceName: buildOp.name }));
|
|
131
148
|
const [rollout, build] = await Promise.all([rolloutPoll, buildPoll]);
|
|
132
149
|
(0, utils_1.logSuccess)("Rollout completed.");
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getHostnameFromUrl = exports.openInBrowserPopup = exports.openInBrowser = exports.connectableHostname = exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isVSCodeExtension = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.withTimeout = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.getInheritedOption = exports.consoleUrl = exports.envOverrides = void 0;
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const _ = require("lodash");
|
|
@@ -524,14 +524,3 @@ function getHostnameFromUrl(url) {
|
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
exports.getHostnameFromUrl = getHostnameFromUrl;
|
|
527
|
-
function generateId(n = 6) {
|
|
528
|
-
const letters = "abcdefghijklmnopqrstuvwxyz";
|
|
529
|
-
const allChars = "01234567890-abcdefghijklmnopqrstuvwxyz";
|
|
530
|
-
let id = letters[Math.floor(Math.random() * letters.length)];
|
|
531
|
-
for (let i = 1; i < n; i++) {
|
|
532
|
-
const idx = Math.floor(Math.random() * allChars.length);
|
|
533
|
-
id += allChars[idx];
|
|
534
|
-
}
|
|
535
|
-
return id;
|
|
536
|
-
}
|
|
537
|
-
exports.generateId = generateId;
|