firebase-tools-with-isolate 12.9.1 → 13.0.2
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/README.md +3 -5
- package/lib/api.js +2 -2
- package/lib/apiv2.js +7 -0
- package/lib/auth.js +8 -4
- package/lib/commands/{frameworks-backends-create.js → apphosting-backends-create.js} +6 -3
- package/lib/commands/{frameworks-backends-delete.js → apphosting-backends-delete.js} +9 -7
- package/lib/commands/{frameworks-backends-get.js → apphosting-backends-get.js} +16 -27
- package/lib/commands/{frameworks-backends-list.js → apphosting-backends-list.js} +9 -19
- package/lib/commands/apphosting-builds-create.js +31 -0
- package/lib/commands/apphosting-builds-get.js +18 -0
- package/lib/commands/apphosting-rollouts-create.js +26 -0
- package/lib/commands/apphosting-rollouts-list.js +18 -0
- package/lib/commands/index.js +12 -7
- package/lib/commands/login-use.js +25 -6
- package/lib/config.js +10 -8
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +2 -2
- package/lib/deploy/functions/services/firestore.js +11 -1
- package/lib/deploy/lifecycleHooks.js +5 -0
- package/lib/fetchMOTD.js +1 -1
- package/lib/firestore/api.js +6 -6
- package/lib/frameworks/angular/index.js +5 -3
- package/lib/frameworks/angular/utils.js +33 -4
- package/lib/frameworks/astro/index.js +5 -2
- package/lib/frameworks/astro/utils.js +3 -2
- package/lib/frameworks/constants.js +37 -10
- package/lib/frameworks/index.js +12 -7
- package/lib/frameworks/next/index.js +28 -8
- package/lib/frameworks/next/utils.js +7 -3
- 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 +18 -5
- package/lib/functionsShellCommandAction.js +3 -3
- package/lib/gcp/apphosting.js +89 -0
- package/lib/gcp/cloudbuild.js +28 -3
- package/lib/gcp/storage.js +11 -5
- package/lib/hosting/api.js +19 -1
- package/lib/hosting/runTags.js +2 -1
- package/lib/init/features/{frameworks → apphosting}/constants.js +1 -2
- package/lib/init/features/apphosting/index.js +147 -0
- package/lib/init/features/apphosting/repo.js +225 -0
- package/lib/init/features/hosting/index.js +1 -1
- package/lib/init/features/index.js +3 -3
- package/lib/init/index.js +0 -4
- package/lib/localFunction.js +77 -14
- package/lib/utils.js +50 -1
- package/package.json +10 -8
- package/templates/popup.html +64 -0
- package/lib/commands/ext-dev-publish.js +0 -32
- package/lib/gcp/frameworks.js +0 -40
- package/lib/init/features/frameworks/index.js +0 -120
- package/lib/init/features/frameworks/repo.js +0 -132
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOrCreateRepository = exports.getOrCreateConnection = exports.linkGitHubRepository = void 0;
|
|
4
|
-
const api_1 = require("../../../api");
|
|
5
|
-
const error_1 = require("../../../error");
|
|
6
|
-
const gcb = require("../../../gcp/cloudbuild");
|
|
7
|
-
const logger_1 = require("../../../logger");
|
|
8
|
-
const poller = require("../../../operation-poller");
|
|
9
|
-
const utils = require("../../../utils");
|
|
10
|
-
const prompt_1 = require("../../../prompt");
|
|
11
|
-
const clc = require("colorette");
|
|
12
|
-
const gcbPollerOptions = {
|
|
13
|
-
apiOrigin: api_1.cloudbuildOrigin,
|
|
14
|
-
apiVersion: "v2",
|
|
15
|
-
masterTimeout: 25 * 60 * 1000,
|
|
16
|
-
maxBackoff: 10000,
|
|
17
|
-
};
|
|
18
|
-
function extractRepoSlugFromURI(remoteUri) {
|
|
19
|
-
const match = /github.com\/(.+).git/.exec(remoteUri);
|
|
20
|
-
if (!match) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
return match[1];
|
|
24
|
-
}
|
|
25
|
-
function generateRepositoryId(remoteUri) {
|
|
26
|
-
return extractRepoSlugFromURI(remoteUri)?.replaceAll("/", "-");
|
|
27
|
-
}
|
|
28
|
-
function generateConnectionId(location) {
|
|
29
|
-
return `frameworks-${location}`;
|
|
30
|
-
}
|
|
31
|
-
async function linkGitHubRepository(projectId, location) {
|
|
32
|
-
logger_1.logger.info(clc.bold(`\n${clc.white("===")} Connect a github repository`));
|
|
33
|
-
const connectionId = generateConnectionId(location);
|
|
34
|
-
await getOrCreateConnection(projectId, location, connectionId);
|
|
35
|
-
let remoteUri = await promptRepositoryURI(projectId, location, connectionId);
|
|
36
|
-
while (remoteUri === "") {
|
|
37
|
-
await utils.openInBrowser("https://github.com/apps/google-cloud-build/installations/new");
|
|
38
|
-
await (0, prompt_1.promptOnce)({
|
|
39
|
-
type: "input",
|
|
40
|
-
message: "Press ENTER once you have finished configuring your installation's access settings.",
|
|
41
|
-
});
|
|
42
|
-
remoteUri = await promptRepositoryURI(projectId, location, connectionId);
|
|
43
|
-
}
|
|
44
|
-
const repo = await getOrCreateRepository(projectId, location, connectionId, remoteUri);
|
|
45
|
-
logger_1.logger.info();
|
|
46
|
-
utils.logSuccess(`Successfully linked GitHub repository at remote URI:\n ${remoteUri}`);
|
|
47
|
-
return repo;
|
|
48
|
-
}
|
|
49
|
-
exports.linkGitHubRepository = linkGitHubRepository;
|
|
50
|
-
async function promptRepositoryURI(projectId, location, connectionId) {
|
|
51
|
-
const resp = await gcb.fetchLinkableRepositories(projectId, location, connectionId);
|
|
52
|
-
if (!resp.repositories || resp.repositories.length === 0) {
|
|
53
|
-
throw new error_1.FirebaseError("The GitHub App does not have access to any repositories. Please configure " +
|
|
54
|
-
"your app installation permissions at https://github.com/settings/installations.");
|
|
55
|
-
}
|
|
56
|
-
const choices = resp.repositories.map((repo) => ({
|
|
57
|
-
name: extractRepoSlugFromURI(repo.remoteUri) || repo.remoteUri,
|
|
58
|
-
value: repo.remoteUri,
|
|
59
|
-
}));
|
|
60
|
-
choices.push({
|
|
61
|
-
name: "Missing a repo? Select this option to configure your installation's access settings",
|
|
62
|
-
value: "",
|
|
63
|
-
});
|
|
64
|
-
return await (0, prompt_1.promptOnce)({
|
|
65
|
-
type: "list",
|
|
66
|
-
message: "Which of the following repositories would you like to deploy?",
|
|
67
|
-
choices,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
async function promptConnectionAuth(conn, projectId, location, connectionId) {
|
|
71
|
-
logger_1.logger.info("First, log in to GitHub, install and authorize Cloud Build app:");
|
|
72
|
-
logger_1.logger.info(conn.installationState.actionUri);
|
|
73
|
-
await utils.openInBrowser(conn.installationState.actionUri);
|
|
74
|
-
await (0, prompt_1.promptOnce)({
|
|
75
|
-
type: "input",
|
|
76
|
-
message: "Press Enter once you have authorized the app (Cloud Build) to access your GitHub repo.",
|
|
77
|
-
});
|
|
78
|
-
return await gcb.getConnection(projectId, location, connectionId);
|
|
79
|
-
}
|
|
80
|
-
async function getOrCreateConnection(projectId, location, connectionId) {
|
|
81
|
-
let conn;
|
|
82
|
-
try {
|
|
83
|
-
conn = await gcb.getConnection(projectId, location, connectionId);
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
if (err.status === 404) {
|
|
87
|
-
const op = await gcb.createConnection(projectId, location, connectionId);
|
|
88
|
-
conn = await poller.pollOperation({
|
|
89
|
-
...gcbPollerOptions,
|
|
90
|
-
pollerName: `create-${location}-${connectionId}`,
|
|
91
|
-
operationResourceName: op.name,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
throw err;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
while (conn.installationState.stage !== "COMPLETE") {
|
|
99
|
-
conn = await promptConnectionAuth(conn, projectId, location, connectionId);
|
|
100
|
-
}
|
|
101
|
-
return conn;
|
|
102
|
-
}
|
|
103
|
-
exports.getOrCreateConnection = getOrCreateConnection;
|
|
104
|
-
async function getOrCreateRepository(projectId, location, connectionId, remoteUri) {
|
|
105
|
-
const repositoryId = generateRepositoryId(remoteUri);
|
|
106
|
-
if (!repositoryId) {
|
|
107
|
-
throw new error_1.FirebaseError(`Failed to generate repositoryId for URI "${remoteUri}".`);
|
|
108
|
-
}
|
|
109
|
-
let repo;
|
|
110
|
-
try {
|
|
111
|
-
repo = await gcb.getRepository(projectId, location, connectionId, repositoryId);
|
|
112
|
-
const repoSlug = extractRepoSlugFromURI(repo.remoteUri);
|
|
113
|
-
if (repoSlug) {
|
|
114
|
-
throw new error_1.FirebaseError(`${repoSlug} has already been linked.`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (err) {
|
|
118
|
-
if (err.status === 404) {
|
|
119
|
-
const op = await gcb.createRepository(projectId, location, connectionId, repositoryId, remoteUri);
|
|
120
|
-
repo = await poller.pollOperation({
|
|
121
|
-
...gcbPollerOptions,
|
|
122
|
-
pollerName: `create-${location}-${connectionId}-${repositoryId}`,
|
|
123
|
-
operationResourceName: op.name,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
throw err;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return repo;
|
|
131
|
-
}
|
|
132
|
-
exports.getOrCreateRepository = getOrCreateRepository;
|