firebase-tools 10.3.0 → 10.4.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/lib/accountExporter.js +95 -84
- package/lib/commands/deploy.js +1 -1
- package/lib/commands/experimental-functions-shell.js +1 -1
- package/lib/commands/ext-configure.js +13 -6
- package/lib/commands/ext-export.js +7 -1
- package/lib/commands/ext-install.js +12 -7
- package/lib/commands/ext-update.js +5 -3
- package/lib/commands/functions-config-export.js +5 -3
- package/lib/commands/functions-shell.js +1 -1
- package/lib/commands/hosting-channel-create.js +2 -2
- package/lib/commands/hosting-channel-delete.js +2 -2
- package/lib/commands/hosting-channel-deploy.js +2 -2
- package/lib/commands/hosting-channel-list.js +2 -2
- package/lib/commands/hosting-channel-open.js +2 -2
- package/lib/commands/hosting-sites-delete.js +2 -2
- package/lib/commands/serve.js +1 -1
- package/lib/commands/target-apply.js +2 -2
- package/lib/commands/target-clear.js +2 -2
- package/lib/commands/target-remove.js +2 -2
- package/lib/commands/target.js +2 -2
- package/lib/config.js +14 -4
- package/lib/deploy/extensions/planner.js +9 -3
- package/lib/deploy/functions/deploy.js +3 -7
- package/lib/deploy/functions/prepare.js +7 -5
- package/lib/deploy/functions/prepareFunctionsUpload.js +7 -13
- package/lib/deploy/functions/release/fabricator.js +13 -1
- package/lib/deploy/functions/release/index.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +12 -5
- package/lib/deploy/hosting/deploy.js +10 -0
- package/lib/emulator/auth/apiSpec.js +37 -0
- package/lib/emulator/commandUtils.js +2 -2
- package/lib/emulator/controller.js +14 -8
- package/lib/emulator/downloadableEmulators.js +5 -5
- package/lib/emulator/extensionsEmulator.js +3 -0
- package/lib/emulator/functionsEmulator.js +4 -4
- package/lib/emulator/functionsEmulatorShared.js +17 -1
- package/lib/emulator/storage/apis/firebase.js +4 -6
- package/lib/emulator/storage/files.js +5 -5
- package/lib/emulator/storage/index.js +6 -9
- package/lib/emulator/storage/rules/config.js +6 -5
- package/lib/emulator/storage/rules/manager.js +49 -32
- package/lib/emulator/storage/rules/runtime.js +4 -0
- package/lib/emulator/storage/rules/utils.js +2 -2
- package/lib/emulator/storage/server.js +1 -1
- package/lib/extensions/askUserForParam.js +103 -28
- package/lib/extensions/manifest.js +38 -6
- package/lib/extensions/paramHelper.js +28 -6
- package/lib/fsutils.js +14 -1
- package/lib/functions/projectConfig.js +34 -0
- package/lib/gcp/cloudfunctions.js +5 -4
- package/lib/init/features/functions/index.js +4 -2
- package/lib/init/features/hosting/index.js +32 -41
- package/lib/init/features/index.js +22 -12
- package/lib/init/index.js +28 -11
- package/lib/requireConfig.js +11 -9
- package/lib/serve/functions.js +5 -5
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schema/firebase-config.json +93 -36
- package/lib/prepareUpload.js +0 -44
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeAndValidate = exports.validate = exports.normalize = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
function normalize(config) {
|
|
6
|
+
if (!config) {
|
|
7
|
+
throw new error_1.FirebaseError("No valid functions configuration detected in firebase.json");
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(config)) {
|
|
10
|
+
if (config.length < 1) {
|
|
11
|
+
throw new error_1.FirebaseError("Requires at least one functions.source in firebase.json.");
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
return [config];
|
|
16
|
+
}
|
|
17
|
+
exports.normalize = normalize;
|
|
18
|
+
function validateSingle(config) {
|
|
19
|
+
if (!config.source) {
|
|
20
|
+
throw new error_1.FirebaseError("functions.source must be specified");
|
|
21
|
+
}
|
|
22
|
+
return Object.assign(Object.assign({}, config), { source: config.source });
|
|
23
|
+
}
|
|
24
|
+
function validate(config) {
|
|
25
|
+
if (config.length > 1) {
|
|
26
|
+
throw new error_1.FirebaseError("More than one functions.source detected in firebase.json.");
|
|
27
|
+
}
|
|
28
|
+
return [validateSingle(config[0])];
|
|
29
|
+
}
|
|
30
|
+
exports.validate = validate;
|
|
31
|
+
function normalizeAndValidate(config) {
|
|
32
|
+
return validate(normalize(config));
|
|
33
|
+
}
|
|
34
|
+
exports.normalizeAndValidate = normalizeAndValidate;
|
|
@@ -202,7 +202,7 @@ async function listAllFunctions(projectId) {
|
|
|
202
202
|
}
|
|
203
203
|
exports.listAllFunctions = listAllFunctions;
|
|
204
204
|
function endpointFromFunction(gcfFunction) {
|
|
205
|
-
var _a, _b, _c, _d;
|
|
205
|
+
var _a, _b, _c, _d, _e;
|
|
206
206
|
const [, project, , region, , id] = gcfFunction.name.split("/");
|
|
207
207
|
let trigger;
|
|
208
208
|
let uri;
|
|
@@ -217,7 +217,8 @@ function endpointFromFunction(gcfFunction) {
|
|
|
217
217
|
taskQueueTrigger: {},
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
else if ((_c = gcfFunction.labels) === null || _c === void 0 ? void 0 : _c["deployment-callable"])
|
|
220
|
+
else if (((_c = gcfFunction.labels) === null || _c === void 0 ? void 0 : _c["deployment-callable"]) ||
|
|
221
|
+
((_d = gcfFunction.labels) === null || _d === void 0 ? void 0 : _d["deployment-callabled"])) {
|
|
221
222
|
trigger = {
|
|
222
223
|
callableTrigger: {},
|
|
223
224
|
};
|
|
@@ -237,7 +238,7 @@ function endpointFromFunction(gcfFunction) {
|
|
|
237
238
|
value: gcfFunction.eventTrigger.resource,
|
|
238
239
|
},
|
|
239
240
|
],
|
|
240
|
-
retry: !!((
|
|
241
|
+
retry: !!((_e = gcfFunction.eventTrigger.failurePolicy) === null || _e === void 0 ? void 0 : _e.retry),
|
|
241
242
|
},
|
|
242
243
|
};
|
|
243
244
|
}
|
|
@@ -304,7 +305,7 @@ function functionFromEndpoint(endpoint, sourceUploadUrl) {
|
|
|
304
305
|
else {
|
|
305
306
|
gcfFunction.httpsTrigger = {};
|
|
306
307
|
if (backend.isCallableTriggered(endpoint)) {
|
|
307
|
-
gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { "deployment-
|
|
308
|
+
gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { "deployment-callable": "true" });
|
|
308
309
|
}
|
|
309
310
|
if (endpoint.securityLevel) {
|
|
310
311
|
gcfFunction.httpsTrigger.securityLevel = endpoint.securityLevel;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doSetup = void 0;
|
|
3
4
|
const clc = require("cli-color");
|
|
4
5
|
const logger_1 = require("../../../logger");
|
|
5
6
|
const prompt_1 = require("../../../prompt");
|
|
6
7
|
const requirePermissions_1 = require("../../../requirePermissions");
|
|
7
8
|
const previews_1 = require("../../../previews");
|
|
8
9
|
const ensureApiEnabled_1 = require("../../../ensureApiEnabled");
|
|
9
|
-
|
|
10
|
+
async function doSetup(setup, config, options) {
|
|
10
11
|
var _a, _b;
|
|
11
12
|
logger_1.logger.info();
|
|
12
13
|
logger_1.logger.info("A " + clc.bold("functions") + " directory will be created in your project with sample code");
|
|
@@ -44,4 +45,5 @@ module.exports = async function (setup, config, options) {
|
|
|
44
45
|
choices,
|
|
45
46
|
});
|
|
46
47
|
return require("./" + language)(setup, config);
|
|
47
|
-
}
|
|
48
|
+
}
|
|
49
|
+
exports.doSetup = doSetup;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doSetup = void 0;
|
|
2
4
|
const clc = require("cli-color");
|
|
3
5
|
const fs = require("fs");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const apiv2_1 = require("../../../apiv2");
|
|
7
|
+
const github_1 = require("./github");
|
|
8
|
+
const prompt_1 = require("../../../prompt");
|
|
9
|
+
const logger_1 = require("../../../logger");
|
|
8
10
|
const INDEX_TEMPLATE = fs.readFileSync(__dirname + "/../../../../templates/init/hosting/index.html", "utf8");
|
|
9
11
|
const MISSING_TEMPLATE = fs.readFileSync(__dirname + "/../../../../templates/init/hosting/404.html", "utf8");
|
|
10
12
|
const DEFAULT_IGNORES = ["firebase.json", "**/.*", "**/node_modules/**"];
|
|
11
|
-
|
|
13
|
+
async function doSetup(setup, config, options) {
|
|
12
14
|
setup.hosting = {};
|
|
13
|
-
logger.info();
|
|
14
|
-
logger.info(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
logger.info(
|
|
18
|
-
|
|
19
|
-
logger.info();
|
|
20
|
-
return prompt(setup.hosting, [
|
|
15
|
+
logger_1.logger.info();
|
|
16
|
+
logger_1.logger.info(`Your ${clc.bold("public")} directory is the folder (relative to your project directory) that`);
|
|
17
|
+
logger_1.logger.info(`will contain Hosting assets to be uploaded with ${clc.bold("firebase deploy")}. If you`);
|
|
18
|
+
logger_1.logger.info("have a build process for your assets, use your build's output directory.");
|
|
19
|
+
logger_1.logger.info();
|
|
20
|
+
await (0, prompt_1.prompt)(setup.hosting, [
|
|
21
21
|
{
|
|
22
22
|
name: "public",
|
|
23
23
|
type: "input",
|
|
@@ -36,31 +36,22 @@ module.exports = function (setup, config, options) {
|
|
|
36
36
|
default: false,
|
|
37
37
|
message: "Set up automatic builds and deploys with GitHub?",
|
|
38
38
|
},
|
|
39
|
-
])
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return config.askWriteProjectFile(setup.hosting.public + "/index.html", INDEX_TEMPLATE.replace(/{{VERSION}}/g, response.body.current.version));
|
|
59
|
-
})
|
|
60
|
-
.then(() => {
|
|
61
|
-
if (setup.hosting.github) {
|
|
62
|
-
return initGitHub(setup, config, options);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
39
|
+
]);
|
|
40
|
+
setup.config.hosting = {
|
|
41
|
+
public: setup.hosting.public,
|
|
42
|
+
ignore: DEFAULT_IGNORES,
|
|
43
|
+
};
|
|
44
|
+
if (setup.hosting.spa) {
|
|
45
|
+
setup.config.hosting.rewrites = [{ source: "**", destination: "/index.html" }];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
await config.askWriteProjectFile(`${setup.hosting.public}/404.html`, MISSING_TEMPLATE);
|
|
49
|
+
}
|
|
50
|
+
const c = new apiv2_1.Client({ urlPrefix: "https://www.gstatic.com", auth: false });
|
|
51
|
+
const response = await c.get("/firebasejs/releases.json");
|
|
52
|
+
await config.askWriteProjectFile(`${setup.hosting.public}/index.html`, INDEX_TEMPLATE.replace(/{{VERSION}}/g, response.body.current.version));
|
|
53
|
+
if (setup.hosting.github) {
|
|
54
|
+
return (0, github_1.initGitHub)(setup, config, options);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.doSetup = doSetup;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hostingGithub = exports.remoteconfig = exports.project = exports.emulators = exports.storage = exports.hosting = exports.functions = exports.firestore = exports.database = exports.account = void 0;
|
|
4
|
+
var account_1 = require("./account");
|
|
5
|
+
Object.defineProperty(exports, "account", { enumerable: true, get: function () { return account_1.doSetup; } });
|
|
6
|
+
var database_1 = require("./database");
|
|
7
|
+
Object.defineProperty(exports, "database", { enumerable: true, get: function () { return database_1.doSetup; } });
|
|
8
|
+
var firestore_1 = require("./firestore");
|
|
9
|
+
Object.defineProperty(exports, "firestore", { enumerable: true, get: function () { return firestore_1.doSetup; } });
|
|
10
|
+
var functions_1 = require("./functions");
|
|
11
|
+
Object.defineProperty(exports, "functions", { enumerable: true, get: function () { return functions_1.doSetup; } });
|
|
12
|
+
var hosting_1 = require("./hosting");
|
|
13
|
+
Object.defineProperty(exports, "hosting", { enumerable: true, get: function () { return hosting_1.doSetup; } });
|
|
14
|
+
var storage_1 = require("./storage");
|
|
15
|
+
Object.defineProperty(exports, "storage", { enumerable: true, get: function () { return storage_1.doSetup; } });
|
|
16
|
+
var emulators_1 = require("./emulators");
|
|
17
|
+
Object.defineProperty(exports, "emulators", { enumerable: true, get: function () { return emulators_1.doSetup; } });
|
|
18
|
+
var project_1 = require("./project");
|
|
19
|
+
Object.defineProperty(exports, "project", { enumerable: true, get: function () { return project_1.doSetup; } });
|
|
20
|
+
var remoteconfig_1 = require("./remoteconfig");
|
|
21
|
+
Object.defineProperty(exports, "remoteconfig", { enumerable: true, get: function () { return remoteconfig_1.doSetup; } });
|
|
22
|
+
var github_1 = require("./hosting/github");
|
|
23
|
+
Object.defineProperty(exports, "hostingGithub", { enumerable: true, get: function () { return github_1.initGitHub; } });
|
package/lib/init/index.js
CHANGED
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.init = void 0;
|
|
4
|
-
const
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
|
+
const error_1 = require("../error");
|
|
6
7
|
const logger_1 = require("../logger");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const features = require("./features");
|
|
9
|
+
const featureFns = new Map([
|
|
10
|
+
["account", features.account],
|
|
11
|
+
["database", features.database],
|
|
12
|
+
["firestore", features.firestore],
|
|
13
|
+
["functions", features.functions],
|
|
14
|
+
["hosting", features.hosting],
|
|
15
|
+
["storage", features.storage],
|
|
16
|
+
["emulators", features.emulators],
|
|
17
|
+
["project", features.project],
|
|
18
|
+
["remoteconfig", features.remoteconfig],
|
|
19
|
+
["hosting:github", features.hostingGithub],
|
|
20
|
+
]);
|
|
10
21
|
async function init(setup, config, options) {
|
|
11
|
-
|
|
22
|
+
var _a;
|
|
23
|
+
const nextFeature = (_a = setup.features) === null || _a === void 0 ? void 0 : _a.shift();
|
|
12
24
|
if (nextFeature) {
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
if (!featureFns.has(nextFeature)) {
|
|
26
|
+
const availableFeatures = Object.keys(features)
|
|
27
|
+
.filter((f) => f !== "project")
|
|
28
|
+
.join(", ");
|
|
29
|
+
throw new error_1.FirebaseError(`${clc.bold(nextFeature)} is not a valid feature. Must be one of ${availableFeatures}`);
|
|
17
30
|
}
|
|
18
|
-
logger_1.logger.info(clc.bold(
|
|
19
|
-
|
|
31
|
+
logger_1.logger.info(clc.bold(`\n${clc.white("===")} ${(0, lodash_1.capitalize)(nextFeature)} Setup`));
|
|
32
|
+
const fn = featureFns.get(nextFeature);
|
|
33
|
+
if (!fn) {
|
|
34
|
+
throw new error_1.FirebaseError(`We've lost the function to init ${nextFeature}`, { exit: 2 });
|
|
35
|
+
}
|
|
36
|
+
await fn(setup, config, options);
|
|
20
37
|
return init(setup, config, options);
|
|
21
38
|
}
|
|
22
39
|
}
|
package/lib/requireConfig.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requireConfig = void 0;
|
|
4
|
+
const error_1 = require("./error");
|
|
5
|
+
async function requireConfig(options) {
|
|
6
|
+
await Promise.resolve();
|
|
7
|
+
if (!options.config) {
|
|
8
|
+
throw options.configError
|
|
9
|
+
? options.configError
|
|
10
|
+
: new error_1.FirebaseError("Not in a Firebase project directory (could not locate firebase.json)");
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exit: 1,
|
|
10
|
-
}));
|
|
11
|
-
};
|
|
12
|
+
}
|
|
13
|
+
exports.requireConfig = requireConfig;
|
package/lib/serve/functions.js
CHANGED
|
@@ -7,6 +7,7 @@ const emulatorServer_1 = require("../emulator/emulatorServer");
|
|
|
7
7
|
const functionsEmulatorUtils_1 = require("../emulator/functionsEmulatorUtils");
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const auth_1 = require("../auth");
|
|
10
|
+
const projectConfig = require("../functions/projectConfig");
|
|
10
11
|
const utils = require("../utils");
|
|
11
12
|
class FunctionsServer {
|
|
12
13
|
constructor() {
|
|
@@ -20,11 +21,10 @@ class FunctionsServer {
|
|
|
20
21
|
}
|
|
21
22
|
async start(options, partialArgs) {
|
|
22
23
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const functionsDir = path.join(options.config.projectDir, options.config.src.functions.source);
|
|
24
|
+
const config = projectConfig.normalizeAndValidate(options.config.src.functions)[0];
|
|
25
|
+
const functionsDir = path.join(options.config.projectDir, config.source);
|
|
26
26
|
const account = (0, auth_1.getProjectDefaultAccount)(options.config.projectDir);
|
|
27
|
-
const nodeMajorVersion = (0, functionsEmulatorUtils_1.parseRuntimeVersion)(
|
|
27
|
+
const nodeMajorVersion = (0, functionsEmulatorUtils_1.parseRuntimeVersion)(config.runtime);
|
|
28
28
|
this.backend = {
|
|
29
29
|
functionsDir,
|
|
30
30
|
nodeMajorVersion,
|
|
@@ -40,7 +40,7 @@ class FunctionsServer {
|
|
|
40
40
|
utils.assertIsNumber(options.port);
|
|
41
41
|
const targets = options.targets;
|
|
42
42
|
const port = options.port;
|
|
43
|
-
const hostingRunning = targets && targets.
|
|
43
|
+
const hostingRunning = targets && targets.includes("hosting");
|
|
44
44
|
if (hostingRunning) {
|
|
45
45
|
args.port = port + 1;
|
|
46
46
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "firebase-tools",
|
|
9
|
-
"version": "10.
|
|
9
|
+
"version": "10.4.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@google-cloud/pubsub": "^2.18.4",
|
package/package.json
CHANGED
|
@@ -326,54 +326,111 @@
|
|
|
326
326
|
"type": "object"
|
|
327
327
|
},
|
|
328
328
|
"functions": {
|
|
329
|
-
"
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
"
|
|
333
|
-
"
|
|
334
|
-
},
|
|
335
|
-
"type": "array"
|
|
336
|
-
},
|
|
337
|
-
"postdeploy": {
|
|
338
|
-
"anyOf": [
|
|
339
|
-
{
|
|
329
|
+
"anyOf": [
|
|
330
|
+
{
|
|
331
|
+
"additionalProperties": false,
|
|
332
|
+
"properties": {
|
|
333
|
+
"ignore": {
|
|
340
334
|
"items": {
|
|
341
335
|
"type": "string"
|
|
342
336
|
},
|
|
343
337
|
"type": "array"
|
|
344
338
|
},
|
|
345
|
-
{
|
|
339
|
+
"postdeploy": {
|
|
340
|
+
"anyOf": [
|
|
341
|
+
{
|
|
342
|
+
"items": {
|
|
343
|
+
"type": "string"
|
|
344
|
+
},
|
|
345
|
+
"type": "array"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"type": "string"
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
"predeploy": {
|
|
353
|
+
"anyOf": [
|
|
354
|
+
{
|
|
355
|
+
"items": {
|
|
356
|
+
"type": "string"
|
|
357
|
+
},
|
|
358
|
+
"type": "array"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"type": "string"
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
"runtime": {
|
|
366
|
+
"enum": [
|
|
367
|
+
"nodejs10",
|
|
368
|
+
"nodejs12",
|
|
369
|
+
"nodejs14",
|
|
370
|
+
"nodejs16"
|
|
371
|
+
],
|
|
372
|
+
"type": "string"
|
|
373
|
+
},
|
|
374
|
+
"source": {
|
|
346
375
|
"type": "string"
|
|
347
376
|
}
|
|
348
|
-
|
|
377
|
+
},
|
|
378
|
+
"type": "object"
|
|
349
379
|
},
|
|
350
|
-
|
|
351
|
-
"
|
|
352
|
-
|
|
353
|
-
|
|
380
|
+
{
|
|
381
|
+
"items": {
|
|
382
|
+
"additionalProperties": false,
|
|
383
|
+
"properties": {
|
|
384
|
+
"ignore": {
|
|
385
|
+
"items": {
|
|
386
|
+
"type": "string"
|
|
387
|
+
},
|
|
388
|
+
"type": "array"
|
|
389
|
+
},
|
|
390
|
+
"postdeploy": {
|
|
391
|
+
"anyOf": [
|
|
392
|
+
{
|
|
393
|
+
"items": {
|
|
394
|
+
"type": "string"
|
|
395
|
+
},
|
|
396
|
+
"type": "array"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"type": "string"
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
},
|
|
403
|
+
"predeploy": {
|
|
404
|
+
"anyOf": [
|
|
405
|
+
{
|
|
406
|
+
"items": {
|
|
407
|
+
"type": "string"
|
|
408
|
+
},
|
|
409
|
+
"type": "array"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"type": "string"
|
|
413
|
+
}
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
"runtime": {
|
|
417
|
+
"enum": [
|
|
418
|
+
"nodejs10",
|
|
419
|
+
"nodejs12",
|
|
420
|
+
"nodejs14",
|
|
421
|
+
"nodejs16"
|
|
422
|
+
],
|
|
354
423
|
"type": "string"
|
|
355
424
|
},
|
|
356
|
-
"
|
|
425
|
+
"source": {
|
|
426
|
+
"type": "string"
|
|
427
|
+
}
|
|
357
428
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
]
|
|
362
|
-
},
|
|
363
|
-
"runtime": {
|
|
364
|
-
"enum": [
|
|
365
|
-
"nodejs10",
|
|
366
|
-
"nodejs12",
|
|
367
|
-
"nodejs14",
|
|
368
|
-
"nodejs16"
|
|
369
|
-
],
|
|
370
|
-
"type": "string"
|
|
371
|
-
},
|
|
372
|
-
"source": {
|
|
373
|
-
"type": "string"
|
|
429
|
+
"type": "object"
|
|
430
|
+
},
|
|
431
|
+
"type": "array"
|
|
374
432
|
}
|
|
375
|
-
|
|
376
|
-
"type": "object"
|
|
433
|
+
]
|
|
377
434
|
},
|
|
378
435
|
"hosting": {
|
|
379
436
|
"anyOf": [
|
package/lib/prepareUpload.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var path = require("path");
|
|
4
|
-
var tar = require("tar");
|
|
5
|
-
var tmp = require("tmp");
|
|
6
|
-
var { listFiles } = require("./listFiles");
|
|
7
|
-
var { FirebaseError } = require("./error");
|
|
8
|
-
var fsutils = require("./fsutils");
|
|
9
|
-
module.exports = function (options) {
|
|
10
|
-
var hostingConfig = options.config.get("hosting");
|
|
11
|
-
var publicDir = options.config.path(hostingConfig.public);
|
|
12
|
-
var indexPath = path.join(publicDir, "index.html");
|
|
13
|
-
var tmpFile = tmp.fileSync({
|
|
14
|
-
prefix: "firebase-upload-",
|
|
15
|
-
postfix: ".tar.gz",
|
|
16
|
-
});
|
|
17
|
-
var manifest = listFiles(publicDir, hostingConfig.ignore);
|
|
18
|
-
return tar
|
|
19
|
-
.c({
|
|
20
|
-
gzip: true,
|
|
21
|
-
file: tmpFile.name,
|
|
22
|
-
cwd: publicDir,
|
|
23
|
-
prefix: "public",
|
|
24
|
-
follow: true,
|
|
25
|
-
noDirRecurse: true,
|
|
26
|
-
portable: true,
|
|
27
|
-
}, manifest.slice(0))
|
|
28
|
-
.then(function () {
|
|
29
|
-
var stats = fs.statSync(tmpFile.name);
|
|
30
|
-
return {
|
|
31
|
-
file: tmpFile.name,
|
|
32
|
-
stream: fs.createReadStream(tmpFile.name),
|
|
33
|
-
manifest: manifest,
|
|
34
|
-
foundIndex: fsutils.fileExistsSync(indexPath),
|
|
35
|
-
size: stats.size,
|
|
36
|
-
};
|
|
37
|
-
})
|
|
38
|
-
.catch(function (err) {
|
|
39
|
-
return Promise.reject(new FirebaseError("There was an issue preparing Hosting files for upload.", {
|
|
40
|
-
original: err,
|
|
41
|
-
exit: 2,
|
|
42
|
-
}));
|
|
43
|
-
});
|
|
44
|
-
};
|