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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.apphosting = exports.hostingGithub = exports.remoteconfig = exports.project = exports.extensions = exports.emulators = exports.storage = exports.hosting = exports.functions = exports.firestore = exports.database = exports.account = void 0;
|
|
4
4
|
var account_1 = require("./account");
|
|
5
5
|
Object.defineProperty(exports, "account", { enumerable: true, get: function () { return account_1.doSetup; } });
|
|
6
6
|
var database_1 = require("./database");
|
|
@@ -23,5 +23,5 @@ var remoteconfig_1 = require("./remoteconfig");
|
|
|
23
23
|
Object.defineProperty(exports, "remoteconfig", { enumerable: true, get: function () { return remoteconfig_1.doSetup; } });
|
|
24
24
|
var github_1 = require("./hosting/github");
|
|
25
25
|
Object.defineProperty(exports, "hostingGithub", { enumerable: true, get: function () { return github_1.initGitHub; } });
|
|
26
|
-
var
|
|
27
|
-
Object.defineProperty(exports, "
|
|
26
|
+
var apphosting_1 = require("./apphosting");
|
|
27
|
+
Object.defineProperty(exports, "apphosting", { enumerable: true, get: function () { return apphosting_1.doSetup; } });
|
package/lib/init/index.js
CHANGED
|
@@ -6,7 +6,6 @@ const clc = require("colorette");
|
|
|
6
6
|
const error_1 = require("../error");
|
|
7
7
|
const logger_1 = require("../logger");
|
|
8
8
|
const features = require("./features");
|
|
9
|
-
const experiments_1 = require("../experiments");
|
|
10
9
|
const featureFns = new Map([
|
|
11
10
|
["account", features.account],
|
|
12
11
|
["database", features.database],
|
|
@@ -20,9 +19,6 @@ const featureFns = new Map([
|
|
|
20
19
|
["remoteconfig", features.remoteconfig],
|
|
21
20
|
["hosting:github", features.hostingGithub],
|
|
22
21
|
]);
|
|
23
|
-
if ((0, experiments_1.isEnabled)("internalframeworks")) {
|
|
24
|
-
featureFns.set("internalframeworks", features.frameworks);
|
|
25
|
-
}
|
|
26
22
|
async function init(setup, config, options) {
|
|
27
23
|
const nextFeature = setup.features?.shift();
|
|
28
24
|
if (nextFeature) {
|
package/lib/localFunction.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HTTPS_SENTINEL = void 0;
|
|
3
4
|
const uuid = require("uuid");
|
|
4
|
-
const request = require("request");
|
|
5
5
|
const encodeFirestoreValue_1 = require("./firestore/encodeFirestoreValue");
|
|
6
6
|
const utils = require("./utils");
|
|
7
|
+
const apiv2_1 = require("./apiv2");
|
|
8
|
+
exports.HTTPS_SENTINEL = "Request sent to function.";
|
|
7
9
|
class LocalFunction {
|
|
8
10
|
constructor(trigger, urls, controller) {
|
|
9
11
|
this.trigger = trigger;
|
|
@@ -27,15 +29,73 @@ class LocalFunction {
|
|
|
27
29
|
if (opts.instanceIdToken) {
|
|
28
30
|
headers["Firebase-Instance-ID-Token"] = opts.instanceIdToken;
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
if (!this.url) {
|
|
33
|
+
throw new Error("No URL provided");
|
|
34
|
+
}
|
|
35
|
+
const client = new apiv2_1.Client({ urlPrefix: this.url, auth: false });
|
|
36
|
+
void client
|
|
37
|
+
.post("", data, { headers })
|
|
38
|
+
.then((res) => {
|
|
39
|
+
this.requestCallBack(undefined, res, res.body);
|
|
40
|
+
})
|
|
41
|
+
.catch((err) => {
|
|
42
|
+
this.requestCallBack(err);
|
|
37
43
|
});
|
|
38
44
|
}
|
|
45
|
+
constructHttpsFunc() {
|
|
46
|
+
if (!this.url) {
|
|
47
|
+
throw new Error("No URL provided");
|
|
48
|
+
}
|
|
49
|
+
const callClient = new apiv2_1.Client({ urlPrefix: this.url, auth: false });
|
|
50
|
+
const verbFactory = (hasRequestBody, method) => {
|
|
51
|
+
return async (pathOrOptions, options) => {
|
|
52
|
+
const { path, opts } = this.extractArgs(pathOrOptions, options);
|
|
53
|
+
try {
|
|
54
|
+
const res = hasRequestBody
|
|
55
|
+
? await method(path, opts.body, toClientVerbOptions(opts))
|
|
56
|
+
: await method(path, toClientVerbOptions(opts));
|
|
57
|
+
this.requestCallBack(undefined, res, res.body);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
this.requestCallBack(err);
|
|
61
|
+
}
|
|
62
|
+
return exports.HTTPS_SENTINEL;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const shim = verbFactory(true, (path, json, opts) => {
|
|
66
|
+
const req = Object.assign(opts || {}, {
|
|
67
|
+
path: path,
|
|
68
|
+
body: json,
|
|
69
|
+
method: opts?.method || "GET",
|
|
70
|
+
});
|
|
71
|
+
return callClient.request(req);
|
|
72
|
+
});
|
|
73
|
+
const verbs = {
|
|
74
|
+
post: verbFactory(true, (path, json, opts) => callClient.post(path, json, opts)),
|
|
75
|
+
put: verbFactory(true, (path, json, opts) => callClient.put(path, json, opts)),
|
|
76
|
+
patch: verbFactory(true, (path, json, opts) => callClient.patch(path, json, opts)),
|
|
77
|
+
get: verbFactory(false, (path, opts) => callClient.get(path, opts)),
|
|
78
|
+
del: verbFactory(false, (path, opts) => callClient.delete(path, opts)),
|
|
79
|
+
delete: verbFactory(false, (path, opts) => callClient.delete(path, opts)),
|
|
80
|
+
options: verbFactory(false, (path, opts) => callClient.options(path, opts)),
|
|
81
|
+
};
|
|
82
|
+
return Object.assign(shim, verbs);
|
|
83
|
+
}
|
|
84
|
+
extractArgs(pathOrOptions, options) {
|
|
85
|
+
if (!pathOrOptions && !options) {
|
|
86
|
+
return { path: "/", opts: {} };
|
|
87
|
+
}
|
|
88
|
+
if (typeof pathOrOptions === "string") {
|
|
89
|
+
return { path: pathOrOptions, opts: options || {} };
|
|
90
|
+
}
|
|
91
|
+
if (typeof pathOrOptions !== "string" && !!pathOrOptions && !options) {
|
|
92
|
+
return { path: "/", opts: pathOrOptions };
|
|
93
|
+
}
|
|
94
|
+
if (typeof pathOrOptions !== "string" || !options) {
|
|
95
|
+
throw new Error(`Invalid argument combination: Expected a string and/or HttpsOptions, got ${typeof pathOrOptions} and ${typeof options}`);
|
|
96
|
+
}
|
|
97
|
+
return { path: "/", opts: {} };
|
|
98
|
+
}
|
|
39
99
|
constructAuth(auth, authType) {
|
|
40
100
|
if (auth?.admin || auth?.variable) {
|
|
41
101
|
return {
|
|
@@ -98,7 +158,7 @@ class LocalFunction {
|
|
|
98
158
|
if (err) {
|
|
99
159
|
return console.warn("\nERROR SENDING REQUEST: " + err);
|
|
100
160
|
}
|
|
101
|
-
const status = response ? response.
|
|
161
|
+
const status = response ? response.status + ", " : "";
|
|
102
162
|
let bodyString = body;
|
|
103
163
|
if (typeof bodyString === "string") {
|
|
104
164
|
try {
|
|
@@ -206,11 +266,7 @@ class LocalFunction {
|
|
|
206
266
|
return (data, opt) => this.constructCallableFunc(data, opt);
|
|
207
267
|
}
|
|
208
268
|
else {
|
|
209
|
-
return
|
|
210
|
-
callback: (...args) => this.requestCallBack(...args),
|
|
211
|
-
baseUrl: this.url,
|
|
212
|
-
uri: "",
|
|
213
|
-
});
|
|
269
|
+
return this.constructHttpsFunc();
|
|
214
270
|
}
|
|
215
271
|
}
|
|
216
272
|
else {
|
|
@@ -219,3 +275,10 @@ class LocalFunction {
|
|
|
219
275
|
}
|
|
220
276
|
}
|
|
221
277
|
exports.default = LocalFunction;
|
|
278
|
+
function toClientVerbOptions(opts) {
|
|
279
|
+
return {
|
|
280
|
+
method: opts.method,
|
|
281
|
+
headers: opts.headers,
|
|
282
|
+
queryParams: opts.qs,
|
|
283
|
+
};
|
|
284
|
+
}
|
package/lib/utils.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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;
|
|
3
|
+
exports.generateId = 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
|
+
const fs = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
4
6
|
const _ = require("lodash");
|
|
5
7
|
const url = require("url");
|
|
8
|
+
const http = require("http");
|
|
6
9
|
const clc = require("colorette");
|
|
7
10
|
const open = require("open");
|
|
8
11
|
const ora = require("ora");
|
|
@@ -12,6 +15,7 @@ const winston = require("winston");
|
|
|
12
15
|
const triple_beam_1 = require("triple-beam");
|
|
13
16
|
const assert_1 = require("assert");
|
|
14
17
|
const stripAnsi = require("strip-ansi");
|
|
18
|
+
const portfinder_1 = require("portfinder");
|
|
15
19
|
const configstore_1 = require("./configstore");
|
|
16
20
|
const error_1 = require("./error");
|
|
17
21
|
const logger_1 = require("./logger");
|
|
@@ -486,3 +490,48 @@ async function openInBrowser(url) {
|
|
|
486
490
|
await open(url);
|
|
487
491
|
}
|
|
488
492
|
exports.openInBrowser = openInBrowser;
|
|
493
|
+
async function openInBrowserPopup(url, buttonText) {
|
|
494
|
+
const popupPage = fs
|
|
495
|
+
.readFileSync(path.join(__dirname, "../templates/popup.html"), { encoding: "utf-8" })
|
|
496
|
+
.replace("${url}", url)
|
|
497
|
+
.replace("${buttonText}", buttonText);
|
|
498
|
+
const port = await (0, portfinder_1.getPortPromise)();
|
|
499
|
+
const server = http.createServer((req, res) => {
|
|
500
|
+
res.writeHead(200, {
|
|
501
|
+
"Content-Length": popupPage.length,
|
|
502
|
+
"Content-Type": "text/html",
|
|
503
|
+
});
|
|
504
|
+
res.end(popupPage);
|
|
505
|
+
req.socket.destroy();
|
|
506
|
+
});
|
|
507
|
+
server.listen(port);
|
|
508
|
+
const popupPageUri = `http://localhost:${port}`;
|
|
509
|
+
await openInBrowser(popupPageUri);
|
|
510
|
+
return {
|
|
511
|
+
url: popupPageUri,
|
|
512
|
+
cleanup: () => {
|
|
513
|
+
server.close();
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
exports.openInBrowserPopup = openInBrowserPopup;
|
|
518
|
+
function getHostnameFromUrl(url) {
|
|
519
|
+
try {
|
|
520
|
+
return new URL(url).hostname;
|
|
521
|
+
}
|
|
522
|
+
catch (e) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools-with-isolate",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Command-Line Interface for Firebase with
|
|
3
|
+
"version": "13.0.2",
|
|
4
|
+
"description": "Command-Line Interface for Firebase with monorepo support",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"firebase": "lib/bin/firebase.js"
|
|
@@ -64,12 +64,16 @@
|
|
|
64
64
|
"websockets",
|
|
65
65
|
"synchronization"
|
|
66
66
|
],
|
|
67
|
-
"preferGlobal":
|
|
67
|
+
"preferGlobal": true,
|
|
68
68
|
"engines": {
|
|
69
|
-
"node": ">=18.0.0"
|
|
69
|
+
"node": ">=18.0.0 || >=20.0.0"
|
|
70
70
|
},
|
|
71
|
-
"author": "
|
|
71
|
+
"author": "Firebase (https://firebase.google.com/)",
|
|
72
72
|
"license": "MIT",
|
|
73
|
+
"bugs": {
|
|
74
|
+
"url": "https://github.com/firebase/firebase-tools/issues"
|
|
75
|
+
},
|
|
76
|
+
"homepage": "https://github.com/firebase/firebase-tools",
|
|
73
77
|
"nyc": {
|
|
74
78
|
"require": [
|
|
75
79
|
"ts-node/register"
|
|
@@ -113,7 +117,7 @@
|
|
|
113
117
|
"glob": "^7.1.2",
|
|
114
118
|
"google-auth-library": "^7.11.0",
|
|
115
119
|
"inquirer": "^8.2.0",
|
|
116
|
-
"isolate-package": "^1.
|
|
120
|
+
"isolate-package": "^1.8.0",
|
|
117
121
|
"js-yaml": "^3.13.1",
|
|
118
122
|
"jsonwebtoken": "^9.0.0",
|
|
119
123
|
"leven": "^3.1.0",
|
|
@@ -131,7 +135,6 @@
|
|
|
131
135
|
"portfinder": "^1.0.32",
|
|
132
136
|
"progress": "^2.0.3",
|
|
133
137
|
"proxy-agent": "^6.3.0",
|
|
134
|
-
"request": "^2.87.0",
|
|
135
138
|
"retry": "^0.13.1",
|
|
136
139
|
"rimraf": "^3.0.0",
|
|
137
140
|
"semver": "^7.5.2",
|
|
@@ -185,7 +188,6 @@
|
|
|
185
188
|
"@types/puppeteer": "^5.4.2",
|
|
186
189
|
"@types/react": "^18.0.20",
|
|
187
190
|
"@types/react-dom": "^18.0.6",
|
|
188
|
-
"@types/request": "^2.48.1",
|
|
189
191
|
"@types/retry": "^0.12.1",
|
|
190
192
|
"@types/rimraf": "^2.0.3",
|
|
191
193
|
"@types/semver": "^6.0.0",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<head>
|
|
2
|
+
<style>
|
|
3
|
+
div {
|
|
4
|
+
font-family: sans-serif;
|
|
5
|
+
}
|
|
6
|
+
#popup {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
width: 100vw;
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
#popup button {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
border-radius: 0.375rem;
|
|
20
|
+
font-size: 1.5rem;
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
height: 2.5rem;
|
|
23
|
+
padding: 0.5rem 1rem;
|
|
24
|
+
background-color: black;
|
|
25
|
+
color: white;
|
|
26
|
+
outline: none;
|
|
27
|
+
transition: background-color 150ms ease-in-out;
|
|
28
|
+
margin-bottom: 20px;
|
|
29
|
+
}
|
|
30
|
+
#popup button:hover {
|
|
31
|
+
background-color: #333;
|
|
32
|
+
}
|
|
33
|
+
#popup button:disabled {
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
#message {
|
|
38
|
+
height: 20px;
|
|
39
|
+
margin-bottom: 20px;
|
|
40
|
+
color: gray;
|
|
41
|
+
font-size: 1.5rem;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
<div id="popup">
|
|
47
|
+
<button id="popupBtn" onclick="openPopup()">${buttonText}</button>
|
|
48
|
+
<div id="message">(Close this window after authorizing the app)</div>
|
|
49
|
+
</div>
|
|
50
|
+
<script>
|
|
51
|
+
function openPopup() {
|
|
52
|
+
var w = window.open("${url}", "newwindow", "popup=1");
|
|
53
|
+
var m = document.getElementById("message");
|
|
54
|
+
var d = document.getElementById("popupBtn");
|
|
55
|
+
var timer = setInterval(function () {
|
|
56
|
+
if (w.closed) {
|
|
57
|
+
m.innerText = "You can close this page now";
|
|
58
|
+
d.disabled = true;
|
|
59
|
+
clearInterval(timer);
|
|
60
|
+
}
|
|
61
|
+
}, 1000);
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
</body>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.command = void 0;
|
|
4
|
-
const marked_1 = require("marked");
|
|
5
|
-
const TerminalRenderer = require("marked-terminal");
|
|
6
|
-
const command_1 = require("../command");
|
|
7
|
-
const requireAuth_1 = require("../requireAuth");
|
|
8
|
-
const ext_dev_upload_1 = require("./ext-dev-upload");
|
|
9
|
-
const utils_1 = require("../utils");
|
|
10
|
-
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
11
|
-
marked_1.marked.setOptions({
|
|
12
|
-
renderer: new TerminalRenderer(),
|
|
13
|
-
});
|
|
14
|
-
exports.command = new command_1.Command("ext:dev:publish <extensionRef>")
|
|
15
|
-
.description(`Deprecated. Use ext:dev:upload instead`)
|
|
16
|
-
.option(`-s, --stage <stage>`, `release stage (supports "alpha", "beta", "rc", and "stable")`)
|
|
17
|
-
.option(`--repo <repo>`, `Public GitHub repo URI that contains the extension source`)
|
|
18
|
-
.option(`--ref <ref>`, `commit hash, branch, or tag to build from the repo (defaults to HEAD)`)
|
|
19
|
-
.option(`--root <root>`, `root directory that contains this extension (defaults to last uploaded root or "/" if none set)`)
|
|
20
|
-
.withForce()
|
|
21
|
-
.help("if you have not previously uploaded a version of this extension, this will " +
|
|
22
|
-
"create the extension. If you have previously uploaded a version of this extension, this version must " +
|
|
23
|
-
"be greater than previous versions.")
|
|
24
|
-
.before(requireAuth_1.requireAuth)
|
|
25
|
-
.before(extensionsHelper_1.ensureExtensionsPublisherApiEnabled)
|
|
26
|
-
.action(async (extensionRef, options) => {
|
|
27
|
-
(0, utils_1.logLabeledWarning)("Extensions", "ext:dev:publish has been deprecated and will be removed in the future. Please use ext:dev:upload instead.");
|
|
28
|
-
if (!options.repo && !options.ref && !options.root) {
|
|
29
|
-
options.local = true;
|
|
30
|
-
}
|
|
31
|
-
return (0, ext_dev_upload_1.uploadExtensionAction)(extensionRef, options);
|
|
32
|
-
});
|
package/lib/gcp/frameworks.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBuild = exports.deleteBackend = exports.listBackends = exports.getBackend = exports.createBackend = exports.API_VERSION = void 0;
|
|
4
|
-
const apiv2_1 = require("../apiv2");
|
|
5
|
-
const api_1 = require("../api");
|
|
6
|
-
exports.API_VERSION = "v1alpha";
|
|
7
|
-
const client = new apiv2_1.Client({
|
|
8
|
-
urlPrefix: api_1.frameworksOrigin,
|
|
9
|
-
auth: true,
|
|
10
|
-
apiVersion: exports.API_VERSION,
|
|
11
|
-
});
|
|
12
|
-
async function createBackend(projectId, location, backendReqBoby, backendId) {
|
|
13
|
-
const res = await client.post(`projects/${projectId}/locations/${location}/backends`, backendReqBoby, { queryParams: { backendId } });
|
|
14
|
-
return res.body;
|
|
15
|
-
}
|
|
16
|
-
exports.createBackend = createBackend;
|
|
17
|
-
async function getBackend(projectId, location, backendId) {
|
|
18
|
-
const name = `projects/${projectId}/locations/${location}/backends/${backendId}`;
|
|
19
|
-
const res = await client.get(name);
|
|
20
|
-
return res.body;
|
|
21
|
-
}
|
|
22
|
-
exports.getBackend = getBackend;
|
|
23
|
-
async function listBackends(projectId, location) {
|
|
24
|
-
const name = `projects/${projectId}/locations/${location}/backends`;
|
|
25
|
-
const res = await client.get(name);
|
|
26
|
-
return res.body;
|
|
27
|
-
}
|
|
28
|
-
exports.listBackends = listBackends;
|
|
29
|
-
async function deleteBackend(projectId, location, backendId) {
|
|
30
|
-
const name = `projects/${projectId}/locations/${location}/backends/${backendId}`;
|
|
31
|
-
const res = await client.delete(name);
|
|
32
|
-
return res.body;
|
|
33
|
-
}
|
|
34
|
-
exports.deleteBackend = deleteBackend;
|
|
35
|
-
async function createBuild(projectId, location, backendId, buildInput) {
|
|
36
|
-
const buildId = buildInput.name;
|
|
37
|
-
const res = await client.post(`projects/${projectId}/locations/${location}/backends/${backendId}/builds`, buildInput, { queryParams: { buildId } });
|
|
38
|
-
return res.body;
|
|
39
|
-
}
|
|
40
|
-
exports.createBuild = createBuild;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBackend = exports.getOrCreateBackend = exports.doSetup = void 0;
|
|
4
|
-
const clc = require("colorette");
|
|
5
|
-
const utils = require("../../../utils");
|
|
6
|
-
const logger_1 = require("../../../logger");
|
|
7
|
-
const prompt_1 = require("../../../prompt");
|
|
8
|
-
const constants_1 = require("./constants");
|
|
9
|
-
const repo = require("./repo");
|
|
10
|
-
const poller = require("../../../operation-poller");
|
|
11
|
-
const api_1 = require("../../../api");
|
|
12
|
-
const gcp = require("../../../gcp/frameworks");
|
|
13
|
-
const frameworks_1 = require("../../../gcp/frameworks");
|
|
14
|
-
const error_1 = require("../../../error");
|
|
15
|
-
const frameworksPollerOptions = {
|
|
16
|
-
apiOrigin: api_1.frameworksOrigin,
|
|
17
|
-
apiVersion: frameworks_1.API_VERSION,
|
|
18
|
-
masterTimeout: 25 * 60 * 1000,
|
|
19
|
-
maxBackoff: 10000,
|
|
20
|
-
};
|
|
21
|
-
async function doSetup(setup, projectId) {
|
|
22
|
-
setup.frameworks = {};
|
|
23
|
-
utils.logBullet("First we need a few details to create your backend.");
|
|
24
|
-
await (0, prompt_1.promptOnce)({
|
|
25
|
-
name: "serviceName",
|
|
26
|
-
type: "input",
|
|
27
|
-
default: "acme-inc-web",
|
|
28
|
-
message: "Create a name for your backend [1-30 characters]",
|
|
29
|
-
}, setup.frameworks);
|
|
30
|
-
await (0, prompt_1.promptOnce)({
|
|
31
|
-
name: "region",
|
|
32
|
-
type: "list",
|
|
33
|
-
default: constants_1.DEFAULT_REGION,
|
|
34
|
-
message: "Please select a region " +
|
|
35
|
-
`(${clc.yellow("info")}: Your region determines where your backend is located):\n`,
|
|
36
|
-
choices: constants_1.ALLOWED_REGIONS,
|
|
37
|
-
}, setup.frameworks);
|
|
38
|
-
utils.logSuccess(`Region set to ${setup.frameworks.region}.`);
|
|
39
|
-
const backend = await getOrCreateBackend(projectId, setup);
|
|
40
|
-
if (backend) {
|
|
41
|
-
logger_1.logger.info();
|
|
42
|
-
utils.logSuccess(`Successfully created backend:\n ${backend.name}`);
|
|
43
|
-
logger_1.logger.info();
|
|
44
|
-
utils.logSuccess(`Your site is being deployed at:\n https://${backend.uri}`);
|
|
45
|
-
logger_1.logger.info();
|
|
46
|
-
utils.logSuccess(`View the rollout status by running:\n firebase backends:get --backend=${backend.name}`);
|
|
47
|
-
logger_1.logger.info();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.doSetup = doSetup;
|
|
51
|
-
function toBackend(cloudBuildConnRepo) {
|
|
52
|
-
return {
|
|
53
|
-
codebase: {
|
|
54
|
-
repository: `${cloudBuildConnRepo.name}`,
|
|
55
|
-
rootDirectory: "/",
|
|
56
|
-
},
|
|
57
|
-
labels: {},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
async function getOrCreateBackend(projectId, setup) {
|
|
61
|
-
const location = setup.frameworks.region;
|
|
62
|
-
try {
|
|
63
|
-
return await getExistingBackend(projectId, setup, location);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
if (err.status === 404) {
|
|
67
|
-
const cloudBuildConnRepo = await repo.linkGitHubRepository(projectId, location);
|
|
68
|
-
logger_1.logger.info();
|
|
69
|
-
await (0, prompt_1.promptOnce)({
|
|
70
|
-
name: "branchName",
|
|
71
|
-
type: "input",
|
|
72
|
-
default: "main",
|
|
73
|
-
message: "Which branch do you want to deploy?",
|
|
74
|
-
}, setup.frameworks);
|
|
75
|
-
const backendDetails = toBackend(cloudBuildConnRepo);
|
|
76
|
-
logger_1.logger.info(clc.bold(`\n${clc.white("===")} Creating your backend`));
|
|
77
|
-
return await createBackend(projectId, location, backendDetails, setup.frameworks.serviceName);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
throw new error_1.FirebaseError(`Failed to get or create a backend using the given initialization details: ${err}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
exports.getOrCreateBackend = getOrCreateBackend;
|
|
86
|
-
async function getExistingBackend(projectId, setup, location) {
|
|
87
|
-
let backend = await gcp.getBackend(projectId, location, setup.frameworks.serviceName);
|
|
88
|
-
while (backend) {
|
|
89
|
-
setup.frameworks.serviceName = undefined;
|
|
90
|
-
await (0, prompt_1.promptOnce)({
|
|
91
|
-
name: "existingBackend",
|
|
92
|
-
type: "confirm",
|
|
93
|
-
default: true,
|
|
94
|
-
message: "A backend already exists for the given serviceName, do you want to use existing backend? (yes/no)",
|
|
95
|
-
}, setup.frameworks);
|
|
96
|
-
if (setup.frameworks.existingBackend) {
|
|
97
|
-
logger_1.logger.info("Using the existing backend.");
|
|
98
|
-
return backend;
|
|
99
|
-
}
|
|
100
|
-
await (0, prompt_1.promptOnce)({
|
|
101
|
-
name: "serviceName",
|
|
102
|
-
type: "input",
|
|
103
|
-
default: "acme-inc-web",
|
|
104
|
-
message: "Please enter a new service name [1-30 characters]",
|
|
105
|
-
}, setup.frameworks);
|
|
106
|
-
backend = await gcp.getBackend(projectId, location, setup.frameworks.serviceName);
|
|
107
|
-
setup.frameworks.existingBackend = undefined;
|
|
108
|
-
}
|
|
109
|
-
return backend;
|
|
110
|
-
}
|
|
111
|
-
async function createBackend(projectId, location, backendReqBoby, backendId) {
|
|
112
|
-
const op = await gcp.createBackend(projectId, location, backendReqBoby, backendId);
|
|
113
|
-
const backend = await poller.pollOperation({
|
|
114
|
-
...frameworksPollerOptions,
|
|
115
|
-
pollerName: `create-${projectId}-${location}-${backendId}`,
|
|
116
|
-
operationResourceName: op.name,
|
|
117
|
-
});
|
|
118
|
-
return backend;
|
|
119
|
-
}
|
|
120
|
-
exports.createBackend = createBackend;
|