firebase-tools 11.4.2 → 11.7.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/accountImporter.js +1 -1
- package/lib/auth.js +3 -4
- package/lib/bin/firebase.js +4 -4
- package/lib/command.js +35 -10
- package/lib/commands/apps-android-sha-create.js +1 -1
- package/lib/commands/apps-android-sha-delete.js +1 -1
- package/lib/commands/apps-create.js +1 -1
- package/lib/commands/apps-list.js +1 -1
- package/lib/commands/auth-export.js +1 -1
- package/lib/commands/auth-import.js +1 -1
- package/lib/commands/crashlytics-mappingfile-generateid.js +26 -0
- package/lib/commands/crashlytics-mappingfile-upload.js +46 -0
- package/lib/commands/crashlytics-symbols-upload.js +18 -87
- package/lib/commands/database-instances-list.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +1 -1
- package/lib/commands/database-set.js +1 -1
- package/lib/commands/database-update.js +1 -1
- package/lib/commands/emulators-exec.js +4 -1
- package/lib/commands/emulators-export.js +5 -2
- package/lib/commands/emulators-start.js +24 -18
- package/lib/commands/ext-dev-deprecate.js +1 -1
- package/lib/commands/ext-dev-emulators-exec.js +1 -1
- package/lib/commands/ext-dev-emulators-start.js +1 -1
- package/lib/commands/ext-dev-extension-delete.js +1 -1
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +4 -1
- package/lib/commands/ext-dev-register.js +1 -1
- package/lib/commands/ext-dev-undeprecate.js +1 -1
- package/lib/commands/ext-dev-unpublish.js +1 -1
- package/lib/commands/ext-dev-usage.js +1 -1
- package/lib/commands/ext-info.js +1 -1
- package/lib/commands/ext-install.js +2 -2
- package/lib/commands/ext-update.js +1 -1
- package/lib/commands/ext.js +1 -1
- package/lib/commands/firestore-delete.js +2 -2
- package/lib/commands/firestore-indexes-list.js +3 -3
- package/lib/commands/functions-config-clone.js +1 -1
- package/lib/commands/functions-config-export.js +1 -1
- package/lib/commands/functions-config-set.js +1 -1
- package/lib/commands/functions-config-unset.js +1 -1
- package/lib/commands/functions-delete.js +3 -1
- package/lib/commands/functions-secrets-get.js +2 -0
- package/lib/commands/functions-secrets-set.js +1 -1
- package/lib/commands/help.js +1 -1
- package/lib/commands/hosting-channel-create.js +5 -5
- package/lib/commands/hosting-channel-delete.js +3 -3
- package/lib/commands/hosting-channel-deploy.js +6 -6
- package/lib/commands/hosting-channel-list.js +2 -2
- package/lib/commands/hosting-channel-open.js +2 -2
- package/lib/commands/hosting-clone.js +8 -8
- package/lib/commands/hosting-disable.js +1 -1
- package/lib/commands/hosting-sites-create.js +4 -4
- package/lib/commands/hosting-sites-delete.js +4 -4
- package/lib/commands/hosting-sites-list.js +2 -2
- package/lib/commands/index.js +3 -0
- package/lib/commands/init.js +5 -5
- package/lib/commands/login-add.js +1 -1
- package/lib/commands/login-ci.js +2 -2
- package/lib/commands/login-list.js +1 -1
- package/lib/commands/login-use.js +1 -1
- package/lib/commands/login.js +3 -3
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +3 -3
- package/lib/commands/projects-list.js +2 -2
- package/lib/commands/serve.js +1 -1
- package/lib/commands/target-apply.js +1 -1
- package/lib/commands/target-clear.js +1 -1
- package/lib/commands/target-remove.js +1 -1
- package/lib/commands/target.js +1 -1
- package/lib/commands/use.js +7 -7
- package/lib/config.js +1 -1
- package/lib/crashlytics/buildToolsJarHelper.js +51 -0
- package/lib/deploy/database/prepare.js +3 -3
- package/lib/deploy/database/release.js +3 -3
- package/lib/deploy/extensions/deploymentSummary.js +1 -1
- package/lib/deploy/extensions/errors.js +1 -1
- package/lib/deploy/extensions/secrets.js +1 -1
- package/lib/deploy/extensions/tasks.js +2 -2
- package/lib/deploy/firestore/deploy.js +2 -2
- package/lib/deploy/firestore/prepare.js +2 -2
- package/lib/deploy/functions/backend.js +4 -4
- package/lib/deploy/functions/build.js +78 -8
- package/lib/deploy/functions/checkIam.js +9 -8
- package/lib/deploy/functions/containerCleaner.js +2 -2
- package/lib/deploy/functions/deploy.js +2 -2
- package/lib/deploy/functions/ensure.js +1 -1
- package/lib/deploy/functions/params.js +15 -15
- package/lib/deploy/functions/prepare.js +1 -1
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -2
- package/lib/deploy/functions/prompts.js +1 -1
- package/lib/deploy/functions/release/fabricator.js +24 -7
- package/lib/deploy/functions/release/index.js +3 -1
- package/lib/deploy/functions/release/reporter.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/index.js +1 -16
- package/lib/deploy/functions/runtimes/discovery/parsing.js +16 -0
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +59 -131
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +2 -6
- package/lib/deploy/functions/runtimes/node/versioning.js +4 -4
- package/lib/deploy/functions/validate.js +1 -1
- package/lib/deploy/hosting/deploy.js +10 -9
- package/lib/deploy/hosting/uploader.js +2 -2
- package/lib/deploy/hosting/validate.js +2 -2
- package/lib/deploy/index.js +7 -7
- package/lib/deploy/lifecycleHooks.js +5 -2
- package/lib/deploy/storage/prepare.js +5 -3
- package/lib/deploy/storage/release.js +7 -6
- package/lib/emulator/auth/index.js +7 -2
- package/lib/emulator/auth/operations.js +10 -10
- package/lib/emulator/commandUtils.js +33 -16
- package/lib/emulator/constants.js +14 -6
- package/lib/emulator/controller.js +50 -18
- package/lib/emulator/databaseEmulator.js +1 -1
- package/lib/emulator/downloadableEmulators.js +8 -8
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/eventarcEmulator.js +148 -0
- package/lib/emulator/extensionsEmulator.js +5 -3
- package/lib/emulator/firestoreEmulator.js +1 -1
- package/lib/emulator/functionsEmulator.js +66 -14
- package/lib/emulator/functionsEmulatorRuntime.js +12 -23
- package/lib/emulator/functionsEmulatorShared.js +6 -1
- package/lib/emulator/hub.js +7 -3
- package/lib/emulator/hubClient.js +2 -2
- package/lib/emulator/hubExport.js +22 -2
- package/lib/emulator/loggingEmulator.js +2 -2
- package/lib/emulator/registry.js +1 -0
- package/lib/emulator/storage/apis/firebase.js +26 -12
- package/lib/emulator/storage/apis/gcloud.js +15 -8
- package/lib/emulator/storage/files.js +21 -4
- package/lib/emulator/storage/multipart.js +6 -5
- package/lib/emulator/storage/rules/runtime.js +3 -3
- package/lib/emulator/storage/rules/utils.js +4 -2
- package/lib/emulator/storage/server.js +2 -1
- package/lib/emulator/storage/upload.js +1 -0
- package/lib/emulator/types.js +4 -0
- package/lib/emulator/ui.js +7 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/extensions/askUserForConsent.js +1 -1
- package/lib/extensions/askUserForEventsConfig.js +1 -1
- package/lib/extensions/askUserForParam.js +1 -1
- package/lib/extensions/changelog.js +2 -2
- package/lib/extensions/checkProjectBilling.js +2 -2
- package/lib/extensions/displayExtensionInfo.js +1 -1
- package/lib/extensions/extensionsApi.js +3 -2
- package/lib/extensions/extensionsHelper.js +30 -2
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/manifest.js +1 -1
- package/lib/extensions/metricsUtils.js +1 -1
- package/lib/extensions/paramHelper.js +1 -1
- package/lib/extensions/updateHelper.js +2 -2
- package/lib/extensions/warnings.js +2 -2
- package/lib/fetchMOTD.js +1 -1
- package/lib/firestore/delete.js +1 -1
- package/lib/firestore/indexes.js +2 -2
- package/lib/firestore/validator.js +1 -1
- package/lib/functions/env.js +11 -11
- package/lib/functions/runtimeConfigExport.js +1 -1
- package/lib/functionsConfig.js +1 -1
- package/lib/functionsConfigClone.js +1 -1
- package/lib/functionsShellCommandAction.js +1 -1
- package/lib/gcp/cloudfunctions.js +3 -3
- package/lib/gcp/cloudfunctionsv2.js +5 -5
- package/lib/gcp/cloudscheduler.js +63 -22
- package/lib/gcp/cloudtasks.js +17 -1
- package/lib/gcp/serviceusage.js +2 -2
- package/lib/handlePreviewToggles.js +4 -4
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/index.js +2 -2
- package/lib/init/features/database.js +1 -1
- package/lib/init/features/emulators.js +1 -1
- package/lib/init/features/firestore/index.js +2 -2
- package/lib/init/features/firestore/indexes.js +1 -1
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/golang.js +1 -1
- package/lib/init/features/functions/index.js +8 -1
- package/lib/init/features/hosting/github.js +9 -9
- package/lib/init/features/hosting/index.js +1 -1
- package/lib/init/features/project.js +1 -1
- package/lib/init/features/remoteconfig.js +1 -1
- package/lib/init/features/storage.js +1 -1
- package/lib/init/index.js +1 -1
- package/lib/logError.js +3 -3
- package/lib/management/projects.js +1 -1
- package/lib/parseBoltRules.js +1 -1
- package/lib/profileReport.js +2 -2
- package/lib/projectUtils.js +1 -1
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +1 -1
- package/lib/requireDatabaseInstance.js +2 -2
- package/lib/requirePermissions.js +2 -2
- package/lib/rulesDeploy.js +11 -12
- package/lib/serve/hosting.js +2 -1
- package/lib/serve/index.js +15 -0
- package/lib/track.js +122 -3
- package/lib/utils.js +24 -11
- package/npm-shrinkwrap.json +523 -294
- package/package.json +6 -4
- package/schema/firebase-config.json +12 -0
- package/templates/extensions/CHANGELOG.md +1 -7
- package/templates/hosting/init.js +6 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const backend = require("../../backend");
|
|
3
|
+
exports.buildFromV1Alpha1 = void 0;
|
|
5
4
|
const build = require("../../build");
|
|
6
5
|
const proto_1 = require("../../../../gcp/proto");
|
|
7
6
|
const parsing_1 = require("./parsing");
|
|
@@ -27,33 +26,13 @@ function buildFromV1Alpha1(yaml, project, region, runtime) {
|
|
|
27
26
|
bd.requiredAPIs = parseRequiredAPIs(manifest);
|
|
28
27
|
for (const id of Object.keys(manifest.endpoints)) {
|
|
29
28
|
const me = manifest.endpoints[id];
|
|
30
|
-
|
|
29
|
+
assertBuildEndpoint(me, id);
|
|
31
30
|
const be = parseEndpointForBuild(id, me, project, region, runtime);
|
|
32
31
|
bd.endpoints[id] = be;
|
|
33
32
|
}
|
|
34
33
|
return bd;
|
|
35
34
|
}
|
|
36
35
|
exports.buildFromV1Alpha1 = buildFromV1Alpha1;
|
|
37
|
-
function backendFromV1Alpha1(yaml, project, region, runtime) {
|
|
38
|
-
const manifest = JSON.parse(JSON.stringify(yaml));
|
|
39
|
-
const bkend = backend.empty();
|
|
40
|
-
bkend.requiredAPIs = parseRequiredAPIs(manifest);
|
|
41
|
-
(0, parsing_1.requireKeys)("", manifest, "endpoints");
|
|
42
|
-
(0, parsing_1.assertKeyTypes)("", manifest, {
|
|
43
|
-
specVersion: "string",
|
|
44
|
-
params: "array",
|
|
45
|
-
requiredAPIs: "array",
|
|
46
|
-
endpoints: "object",
|
|
47
|
-
});
|
|
48
|
-
for (const id of Object.keys(manifest.endpoints)) {
|
|
49
|
-
for (const parsed of parseEndpoints(manifest, id, project, region, runtime)) {
|
|
50
|
-
bkend.endpoints[parsed.region] = bkend.endpoints[parsed.region] || {};
|
|
51
|
-
bkend.endpoints[parsed.region][parsed.id] = parsed;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return bkend;
|
|
55
|
-
}
|
|
56
|
-
exports.backendFromV1Alpha1 = backendFromV1Alpha1;
|
|
57
36
|
function parseRequiredAPIs(manifest) {
|
|
58
37
|
const requiredAPIs = manifest.requiredAPIs || [];
|
|
59
38
|
for (const { api, reason } of requiredAPIs) {
|
|
@@ -66,22 +45,22 @@ function parseRequiredAPIs(manifest) {
|
|
|
66
45
|
}
|
|
67
46
|
return requiredAPIs;
|
|
68
47
|
}
|
|
69
|
-
function
|
|
48
|
+
function assertBuildEndpoint(ep, id) {
|
|
70
49
|
const prefix = `endpoints[${id}]`;
|
|
71
50
|
(0, parsing_1.assertKeyTypes)(prefix, ep, {
|
|
72
51
|
region: "array",
|
|
73
|
-
platform: (platform) =>
|
|
52
|
+
platform: (platform) => build.AllFunctionsPlatforms.includes(platform),
|
|
74
53
|
entryPoint: "string",
|
|
75
|
-
availableMemoryMb: (mem) => mem === null ||
|
|
76
|
-
maxInstances: "number
|
|
77
|
-
minInstances: "number
|
|
78
|
-
concurrency: "number
|
|
54
|
+
availableMemoryMb: (mem) => mem === null || isCEL(mem) || build.isValidMemoryOption(mem),
|
|
55
|
+
maxInstances: "Field<number>?",
|
|
56
|
+
minInstances: "Field<number>?",
|
|
57
|
+
concurrency: "Field<number>?",
|
|
79
58
|
serviceAccount: "string?",
|
|
80
59
|
serviceAccountEmail: "string?",
|
|
81
|
-
timeoutSeconds: "number
|
|
60
|
+
timeoutSeconds: "Field<number>?",
|
|
82
61
|
vpc: "object?",
|
|
83
62
|
labels: "object?",
|
|
84
|
-
ingressSettings: (setting) => setting === null ||
|
|
63
|
+
ingressSettings: (setting) => setting === null || build.AllIngressSettings.includes(setting),
|
|
85
64
|
environmentVariables: "object?",
|
|
86
65
|
secretEnvironmentVariables: "array?",
|
|
87
66
|
httpsTrigger: "object",
|
|
@@ -90,12 +69,12 @@ function assertManifestEndpoint(ep, id) {
|
|
|
90
69
|
scheduleTrigger: "object",
|
|
91
70
|
taskQueueTrigger: "object",
|
|
92
71
|
blockingTrigger: "object",
|
|
93
|
-
cpu: (cpu) => cpu === null ||
|
|
72
|
+
cpu: (cpu) => cpu === null || isCEL(cpu) || cpu === "gcf_gen1" || typeof cpu === "number",
|
|
94
73
|
});
|
|
95
74
|
if (ep.vpc) {
|
|
96
75
|
(0, parsing_1.assertKeyTypes)(prefix + ".vpc", ep.vpc, {
|
|
97
76
|
connector: "string",
|
|
98
|
-
egressSettings: (setting) => setting === null ||
|
|
77
|
+
egressSettings: (setting) => setting === null || build.AllVpcEgressSettings.includes(setting),
|
|
99
78
|
});
|
|
100
79
|
(0, parsing_1.requireKeys)(prefix + ".vpc", ep.vpc, "connector");
|
|
101
80
|
}
|
|
@@ -124,44 +103,46 @@ function assertManifestEndpoint(ep, id) {
|
|
|
124
103
|
if (triggerCount > 1) {
|
|
125
104
|
throw new error_1.FirebaseError("Multiple triggers defined for endpoint" + id);
|
|
126
105
|
}
|
|
127
|
-
if (
|
|
106
|
+
if (build.isEventTriggered(ep)) {
|
|
128
107
|
(0, parsing_1.requireKeys)(prefix + ".eventTrigger", ep.eventTrigger, "eventType", "eventFilters");
|
|
129
108
|
(0, parsing_1.assertKeyTypes)(prefix + ".eventTrigger", ep.eventTrigger, {
|
|
130
109
|
eventFilters: "object",
|
|
131
110
|
eventFilterPathPatterns: "object",
|
|
132
111
|
eventType: "string",
|
|
133
|
-
retry: "boolean",
|
|
134
|
-
region: "string",
|
|
112
|
+
retry: "Field<boolean>",
|
|
113
|
+
region: "Field<string>",
|
|
135
114
|
serviceAccount: "string?",
|
|
136
115
|
serviceAccountEmail: "string?",
|
|
137
116
|
channel: "string",
|
|
138
117
|
});
|
|
139
118
|
}
|
|
140
|
-
else if (
|
|
119
|
+
else if (build.isHttpsTriggered(ep)) {
|
|
141
120
|
(0, parsing_1.assertKeyTypes)(prefix + ".httpsTrigger", ep.httpsTrigger, {
|
|
142
121
|
invoker: "array?",
|
|
143
122
|
});
|
|
144
123
|
}
|
|
145
|
-
else if (
|
|
124
|
+
else if (build.isCallableTriggered(ep)) {
|
|
146
125
|
}
|
|
147
|
-
else if (
|
|
126
|
+
else if (build.isScheduleTriggered(ep)) {
|
|
148
127
|
(0, parsing_1.assertKeyTypes)(prefix + ".scheduleTrigger", ep.scheduleTrigger, {
|
|
149
|
-
schedule: "string",
|
|
150
|
-
timeZone: "string
|
|
128
|
+
schedule: "Field<string>",
|
|
129
|
+
timeZone: "Field<string>?",
|
|
151
130
|
retryConfig: "object?",
|
|
152
131
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
132
|
+
if (ep.scheduleTrigger.retryConfig) {
|
|
133
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".scheduleTrigger.retryConfig", ep.scheduleTrigger.retryConfig, {
|
|
134
|
+
retryCount: "Field<number>?",
|
|
135
|
+
maxDoublings: "Field<number>?",
|
|
136
|
+
minBackoffSeconds: "Field<number>?",
|
|
137
|
+
maxBackoffSeconds: "Field<number>?",
|
|
138
|
+
maxRetrySeconds: "Field<number>?",
|
|
139
|
+
maxRetryDuration: "string?",
|
|
140
|
+
minBackoffDuration: "string?",
|
|
141
|
+
maxBackoffDuration: "string?",
|
|
142
|
+
});
|
|
143
|
+
}
|
|
163
144
|
}
|
|
164
|
-
else if (
|
|
145
|
+
else if (build.isTaskQueueTriggered(ep)) {
|
|
165
146
|
(0, parsing_1.assertKeyTypes)(prefix + ".taskQueueTrigger", ep.taskQueueTrigger, {
|
|
166
147
|
rateLimits: "object?",
|
|
167
148
|
retryConfig: "object?",
|
|
@@ -169,21 +150,21 @@ function assertManifestEndpoint(ep, id) {
|
|
|
169
150
|
});
|
|
170
151
|
if (ep.taskQueueTrigger.rateLimits) {
|
|
171
152
|
(0, parsing_1.assertKeyTypes)(prefix + ".taskQueueTrigger.rateLimits", ep.taskQueueTrigger.rateLimits, {
|
|
172
|
-
maxConcurrentDispatches: "number
|
|
173
|
-
maxDispatchesPerSecond: "number
|
|
153
|
+
maxConcurrentDispatches: "Field<number>?",
|
|
154
|
+
maxDispatchesPerSecond: "Field<number>?",
|
|
174
155
|
});
|
|
175
156
|
}
|
|
176
157
|
if (ep.taskQueueTrigger.retryConfig) {
|
|
177
158
|
(0, parsing_1.assertKeyTypes)(prefix + ".taskQueueTrigger.retryConfig", ep.taskQueueTrigger.retryConfig, {
|
|
178
|
-
maxAttempts: "number
|
|
179
|
-
maxRetrySeconds: "number
|
|
180
|
-
minBackoffSeconds: "number
|
|
181
|
-
maxBackoffSeconds: "number
|
|
182
|
-
maxDoublings: "number
|
|
159
|
+
maxAttempts: "Field<number>?",
|
|
160
|
+
maxRetrySeconds: "Field<number>?",
|
|
161
|
+
minBackoffSeconds: "Field<number>?",
|
|
162
|
+
maxBackoffSeconds: "Field<number>?",
|
|
163
|
+
maxDoublings: "Field<number>?",
|
|
183
164
|
});
|
|
184
165
|
}
|
|
185
166
|
}
|
|
186
|
-
else if (
|
|
167
|
+
else if (build.isBlockingTriggered(ep)) {
|
|
187
168
|
(0, parsing_1.requireKeys)(prefix + ".blockingTrigger", ep.blockingTrigger, "eventType");
|
|
188
169
|
(0, parsing_1.assertKeyTypes)(prefix + ".blockingTrigger", ep.blockingTrigger, {
|
|
189
170
|
eventType: "string",
|
|
@@ -198,12 +179,14 @@ function assertManifestEndpoint(ep, id) {
|
|
|
198
179
|
function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
199
180
|
var _a;
|
|
200
181
|
let triggered;
|
|
201
|
-
if (
|
|
182
|
+
if (build.isEventTriggered(ep)) {
|
|
202
183
|
const eventTrigger = {
|
|
203
184
|
eventType: ep.eventTrigger.eventType,
|
|
204
185
|
retry: ep.eventTrigger.retry,
|
|
205
186
|
};
|
|
206
|
-
|
|
187
|
+
if ("serviceAccountEmail" in ep.eventTrigger) {
|
|
188
|
+
eventTrigger.serviceAccount = ep.eventTrigger.serviceAccountEmail;
|
|
189
|
+
}
|
|
207
190
|
(0, proto_1.copyIfPresent)(eventTrigger, ep.eventTrigger, "serviceAccount", "eventFilterPathPatterns", "region");
|
|
208
191
|
(0, proto_1.convertIfPresent)(eventTrigger, ep.eventTrigger, "channel", (c) => resolveChannelName(project, c, defaultRegion));
|
|
209
192
|
(0, proto_1.convertIfPresent)(eventTrigger, ep.eventTrigger, "eventFilters", (filters) => {
|
|
@@ -215,20 +198,23 @@ function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
|
215
198
|
});
|
|
216
199
|
triggered = { eventTrigger };
|
|
217
200
|
}
|
|
218
|
-
else if (
|
|
201
|
+
else if (build.isHttpsTriggered(ep)) {
|
|
219
202
|
triggered = { httpsTrigger: {} };
|
|
220
203
|
(0, proto_1.copyIfPresent)(triggered.httpsTrigger, ep.httpsTrigger, "invoker");
|
|
221
204
|
}
|
|
222
|
-
else if (
|
|
205
|
+
else if (build.isCallableTriggered(ep)) {
|
|
223
206
|
triggered = { callableTrigger: {} };
|
|
224
207
|
}
|
|
225
|
-
else if (
|
|
208
|
+
else if (build.isScheduleTriggered(ep)) {
|
|
226
209
|
const st = {
|
|
227
210
|
schedule: ep.scheduleTrigger.schedule || "",
|
|
228
211
|
timeZone: (_a = ep.scheduleTrigger.timeZone) !== null && _a !== void 0 ? _a : null,
|
|
229
212
|
};
|
|
230
213
|
if (ep.scheduleTrigger.retryConfig) {
|
|
231
214
|
st.retryConfig = {};
|
|
215
|
+
(0, proto_1.convertIfPresent)(st.retryConfig, ep.scheduleTrigger.retryConfig, "maxBackoffSeconds", "maxBackoffDuration", (duration) => (duration === null ? null : (0, proto_1.secondsFromDuration)(duration)));
|
|
216
|
+
(0, proto_1.convertIfPresent)(st.retryConfig, ep.scheduleTrigger.retryConfig, "minBackoffSeconds", "minBackoffDuration", (duration) => (duration === null ? null : (0, proto_1.secondsFromDuration)(duration)));
|
|
217
|
+
(0, proto_1.convertIfPresent)(st.retryConfig, ep.scheduleTrigger.retryConfig, "maxRetrySeconds", "maxRetryDuration", (duration) => (duration === null ? null : (0, proto_1.secondsFromDuration)(duration)));
|
|
232
218
|
(0, proto_1.copyIfPresent)(st.retryConfig, ep.scheduleTrigger.retryConfig, "retryCount", "minBackoffSeconds", "maxBackoffSeconds", "maxRetrySeconds", "maxDoublings");
|
|
233
219
|
(0, proto_1.convertIfPresent)(st.retryConfig, ep.scheduleTrigger.retryConfig, "minBackoffSeconds", "minBackoffDuration", (0, functional_1.nullsafeVisitor)(proto_1.secondsFromDuration));
|
|
234
220
|
(0, proto_1.convertIfPresent)(st.retryConfig, ep.scheduleTrigger.retryConfig, "maxBackoffSeconds", "maxBackoffDuration", (0, functional_1.nullsafeVisitor)(proto_1.secondsFromDuration));
|
|
@@ -239,7 +225,7 @@ function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
|
239
225
|
}
|
|
240
226
|
triggered = { scheduleTrigger: st };
|
|
241
227
|
}
|
|
242
|
-
else if (
|
|
228
|
+
else if (build.isTaskQueueTriggered(ep)) {
|
|
243
229
|
const tq = {};
|
|
244
230
|
if (ep.taskQueueTrigger.invoker) {
|
|
245
231
|
tq.invoker = ep.taskQueueTrigger.invoker;
|
|
@@ -261,7 +247,7 @@ function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
|
261
247
|
}
|
|
262
248
|
triggered = { taskQueueTrigger: tq };
|
|
263
249
|
}
|
|
264
|
-
else if (
|
|
250
|
+
else if (ep.blockingTrigger) {
|
|
265
251
|
triggered = { blockingTrigger: ep.blockingTrigger };
|
|
266
252
|
}
|
|
267
253
|
else {
|
|
@@ -270,7 +256,9 @@ function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
|
270
256
|
}
|
|
271
257
|
const parsed = Object.assign({ platform: ep.platform || "gcfv2", region: ep.region || [defaultRegion], project,
|
|
272
258
|
runtime, entryPoint: ep.entryPoint }, triggered);
|
|
273
|
-
|
|
259
|
+
if ("serviceAccountEmail" in ep) {
|
|
260
|
+
parsed.serviceAccount = ep.serviceAccountEmail;
|
|
261
|
+
}
|
|
274
262
|
(0, proto_1.copyIfPresent)(parsed, ep, "availableMemoryMb", "cpu", "maxInstances", "minInstances", "concurrency", "timeoutSeconds", "vpc", "labels", "ingressSettings", "environmentVariables", "serviceAccount");
|
|
275
263
|
(0, proto_1.convertIfPresent)(parsed, ep, "secretEnvironmentVariables", (senvs) => {
|
|
276
264
|
if (!senvs) {
|
|
@@ -282,69 +270,6 @@ function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
|
282
270
|
});
|
|
283
271
|
return parsed;
|
|
284
272
|
}
|
|
285
|
-
function parseEndpoints(manifest, id, project, defaultRegion, runtime) {
|
|
286
|
-
const allParsed = [];
|
|
287
|
-
const prefix = `endpoints[${id}]`;
|
|
288
|
-
const ep = manifest.endpoints[id];
|
|
289
|
-
assertManifestEndpoint(ep, id);
|
|
290
|
-
for (const region of ep.region || [defaultRegion]) {
|
|
291
|
-
let triggered;
|
|
292
|
-
if (backend.isEventTriggered(ep)) {
|
|
293
|
-
const eventTrigger = {
|
|
294
|
-
eventType: ep.eventTrigger.eventType,
|
|
295
|
-
retry: false,
|
|
296
|
-
};
|
|
297
|
-
(0, proto_1.renameIfPresent)(eventTrigger, ep.eventTrigger, "serviceAccount", "serviceAccountEmail");
|
|
298
|
-
(0, proto_1.copyIfPresent)(eventTrigger, ep.eventTrigger, "eventFilterPathPatterns", "retry", "serviceAccount", "region");
|
|
299
|
-
(0, proto_1.convertIfPresent)(eventTrigger, ep.eventTrigger, "channel", (c) => resolveChannelName(project, c, defaultRegion));
|
|
300
|
-
(0, proto_1.convertIfPresent)(eventTrigger, ep.eventTrigger, "eventFilters", (filters) => {
|
|
301
|
-
const copy = Object.assign({}, filters);
|
|
302
|
-
if (copy["topic"] && !copy["topic"].startsWith("projects/")) {
|
|
303
|
-
copy["topic"] = `projects/${project}/topics/${copy["topic"]}`;
|
|
304
|
-
}
|
|
305
|
-
return copy;
|
|
306
|
-
});
|
|
307
|
-
triggered = { eventTrigger };
|
|
308
|
-
}
|
|
309
|
-
else if (backend.isHttpsTriggered(ep)) {
|
|
310
|
-
triggered = { httpsTrigger: {} };
|
|
311
|
-
(0, proto_1.copyIfPresent)(triggered.httpsTrigger, ep.httpsTrigger, "invoker");
|
|
312
|
-
}
|
|
313
|
-
else if (backend.isCallableTriggered(ep)) {
|
|
314
|
-
triggered = { callableTrigger: {} };
|
|
315
|
-
}
|
|
316
|
-
else if (backend.isScheduleTriggered(ep)) {
|
|
317
|
-
triggered = { scheduleTrigger: ep.scheduleTrigger };
|
|
318
|
-
}
|
|
319
|
-
else if (backend.isTaskQueueTriggered(ep)) {
|
|
320
|
-
triggered = { taskQueueTrigger: ep.taskQueueTrigger };
|
|
321
|
-
}
|
|
322
|
-
else if (backend.isBlockingTriggered(ep)) {
|
|
323
|
-
triggered = { blockingTrigger: ep.blockingTrigger };
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
throw new error_1.FirebaseError(`Do not recognize trigger type for endpoint ${id}. Try upgrading ` +
|
|
327
|
-
"firebase-tools with npm install -g firebase-tools@latest");
|
|
328
|
-
}
|
|
329
|
-
(0, parsing_1.requireKeys)(prefix, ep, "entryPoint");
|
|
330
|
-
const parsed = Object.assign({ platform: ep.platform || "gcfv2", id,
|
|
331
|
-
region,
|
|
332
|
-
project,
|
|
333
|
-
runtime, entryPoint: ep.entryPoint }, triggered);
|
|
334
|
-
(0, proto_1.renameIfPresent)(parsed, ep, "serviceAccount", "serviceAccountEmail");
|
|
335
|
-
(0, proto_1.copyIfPresent)(parsed, ep, "availableMemoryMb", "maxInstances", "minInstances", "concurrency", "serviceAccount", "timeoutSeconds", "vpc", "labels", "ingressSettings", "environmentVariables", "cpu");
|
|
336
|
-
(0, proto_1.convertIfPresent)(parsed, ep, "secretEnvironmentVariables", (senvs) => {
|
|
337
|
-
if (!senvs) {
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
return senvs.map(({ key, secret }) => {
|
|
341
|
-
return { key, secret: secret || key, projectId: project };
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
allParsed.push(parsed);
|
|
345
|
-
}
|
|
346
|
-
return allParsed;
|
|
347
|
-
}
|
|
348
273
|
function resolveChannelName(projectId, channel, defaultRegion) {
|
|
349
274
|
if (!channel.includes("/")) {
|
|
350
275
|
const location = defaultRegion;
|
|
@@ -365,3 +290,6 @@ function resolveChannelName(projectId, channel, defaultRegion) {
|
|
|
365
290
|
return "projects/" + projectId + "/locations/" + location + "/channels/" + channelId;
|
|
366
291
|
}
|
|
367
292
|
}
|
|
293
|
+
function isCEL(expr) {
|
|
294
|
+
return typeof expr === "string" && expr.includes("{{") && expr.includes("}}");
|
|
295
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRuntimeChoice = exports.DEPRECATED_NODE_VERSION_INFO = exports.UNSUPPORTED_NODE_VERSION_PACKAGE_JSON_MSG = exports.UNSUPPORTED_NODE_VERSION_FIREBASE_JSON_MSG = exports.RUNTIME_NOT_SET = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const error_1 = require("../../../../error");
|
|
7
7
|
const track_1 = require("../../../../track");
|
|
8
8
|
const runtimes = require("../../runtimes");
|
|
@@ -116,7 +116,7 @@ function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
|
116
116
|
proto.copyIfPresent(triggered.taskQueueTrigger.retryConfig, annotation.taskQueueTrigger.retryConfig, "maxAttempts", "maxDoublings");
|
|
117
117
|
proto.convertIfPresent(triggered.taskQueueTrigger.retryConfig, annotation.taskQueueTrigger.retryConfig, "minBackoffSeconds", "minBackoff", toSeconds);
|
|
118
118
|
proto.convertIfPresent(triggered.taskQueueTrigger.retryConfig, annotation.taskQueueTrigger.retryConfig, "maxBackoffSeconds", "maxBackoff", toSeconds);
|
|
119
|
-
proto.convertIfPresent(triggered.taskQueueTrigger.retryConfig, annotation.taskQueueTrigger.retryConfig, "
|
|
119
|
+
proto.convertIfPresent(triggered.taskQueueTrigger.retryConfig, annotation.taskQueueTrigger.retryConfig, "maxRetrySeconds", "maxRetryDuration", toSeconds);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
else if (annotation.httpsTrigger) {
|
|
@@ -185,11 +185,7 @@ function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
|
185
185
|
const endpoint = Object.assign({ platform: annotation.platform || "gcfv1", region: regions, project: projectId, entryPoint: annotation.entryPoint, runtime: runtime }, triggered);
|
|
186
186
|
proto.renameIfPresent(endpoint, annotation, "serviceAccount", "serviceAccountEmail");
|
|
187
187
|
if (annotation.vpcConnector != null) {
|
|
188
|
-
|
|
189
|
-
if (maybeId && !maybeId.includes("/")) {
|
|
190
|
-
maybeId = `projects/${projectId}/locations/$REGION/connectors/${maybeId}`;
|
|
191
|
-
}
|
|
192
|
-
endpoint.vpc = { connector: maybeId };
|
|
188
|
+
endpoint.vpc = { connector: annotation.vpcConnector };
|
|
193
189
|
proto.renameIfPresent(endpoint.vpc, annotation, "egressSettings", "vpcConnectorEgressSettings");
|
|
194
190
|
}
|
|
195
191
|
proto.copyIfPresent(endpoint, annotation, "concurrency", "labels", "maxInstances", "minInstances", "availableMemoryMb");
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkFunctionsSDKVersion = exports.getLatestSDKVersion = exports.getFunctionsSDKVersion = exports.FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const semver = require("semver");
|
|
7
7
|
const spawn = require("cross-spawn");
|
|
8
8
|
const utils = require("../../../../utils");
|
|
9
9
|
const logger_1 = require("../../../../logger");
|
|
10
10
|
const track_1 = require("../../../../track");
|
|
11
11
|
const MIN_SDK_VERSION = "2.0.0";
|
|
12
|
-
exports.FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = clc.bold.yellow("functions: ") +
|
|
12
|
+
exports.FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = clc.bold(clc.yellow("functions: ")) +
|
|
13
13
|
"You must have a " +
|
|
14
14
|
clc.bold("firebase-functions") +
|
|
15
15
|
" version that is at least 2.0.0. Please run " +
|
|
@@ -62,12 +62,12 @@ function checkFunctionsSDKVersion(currentVersion) {
|
|
|
62
62
|
if (semver.eq(currentVersion, latest)) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
utils.logWarning(clc.bold.yellow("functions: ") +
|
|
65
|
+
utils.logWarning(clc.bold(clc.yellow("functions: ")) +
|
|
66
66
|
"package.json indicates an outdated version of firebase-functions. Please upgrade using " +
|
|
67
67
|
clc.bold("npm install --save firebase-functions@latest") +
|
|
68
68
|
" in your functions directory.");
|
|
69
69
|
if (semver.major(currentVersion) < semver.major(latest)) {
|
|
70
|
-
utils.logWarning(clc.bold.yellow("functions: ") +
|
|
70
|
+
utils.logWarning(clc.bold(clc.yellow("functions: ")) +
|
|
71
71
|
"Please note that there will be breaking changes when you upgrade.");
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.secretsAreValid = exports.functionIdsAreValid = exports.functionsDirectoryExists = exports.endpointsAreUnique = exports.cpuConfigIsValid = exports.endpointsAreValid = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const secretManager_1 = require("../../gcp/secretManager");
|
|
8
8
|
const logger_1 = require("../../logger");
|
|
@@ -7,24 +7,21 @@ const listFiles_1 = require("../../listFiles");
|
|
|
7
7
|
const logger_1 = require("../../logger");
|
|
8
8
|
const track_1 = require("../../track");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const _ERASE_LINE = "\x1b[2K";
|
|
10
|
+
const colorette_1 = require("colorette");
|
|
11
|
+
const ora = require("ora");
|
|
13
12
|
async function deploy(context, options) {
|
|
14
13
|
var _a, _b;
|
|
15
14
|
if (!((_a = context.hosting) === null || _a === void 0 ? void 0 : _a.deploys)) {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
const spinner = ora();
|
|
19
18
|
function updateSpinner(newMessage, debugging) {
|
|
20
19
|
if (debugging) {
|
|
21
20
|
(0, utils_1.logLabeledBullet)("hosting", newMessage);
|
|
22
21
|
}
|
|
23
22
|
else {
|
|
24
|
-
|
|
25
|
-
process.stdout.write(clc.bold.cyan(SPINNER[spins % SPINNER.length] + " hosting: ") + newMessage);
|
|
23
|
+
spinner.text = `${(0, colorette_1.bold)((0, colorette_1.cyan)(" hosting:"))} ${newMessage}`;
|
|
26
24
|
}
|
|
27
|
-
spins++;
|
|
28
25
|
}
|
|
29
26
|
async function runDeploys(deploys, debugging) {
|
|
30
27
|
var _a;
|
|
@@ -40,7 +37,7 @@ async function deploy(context, options) {
|
|
|
40
37
|
const t0 = Date.now();
|
|
41
38
|
const publicDir = options.config.path(deploy.config.public);
|
|
42
39
|
const files = (0, listFiles_1.listFiles)(publicDir, deploy.config.ignore);
|
|
43
|
-
(0, utils_1.logLabeledBullet)(`hosting[${deploy.site}]`, `found ${files.length} files in ${
|
|
40
|
+
(0, utils_1.logLabeledBullet)(`hosting[${deploy.site}]`, `found ${files.length} files in ${(0, colorette_1.bold)(deploy.config.public)}`);
|
|
44
41
|
let concurrency = 200;
|
|
45
42
|
const envConcurrency = (0, utils_1.envOverride)("FIREBASE_HOSTING_UPLOAD_CONCURRENCY", "");
|
|
46
43
|
if (envConcurrency) {
|
|
@@ -59,6 +56,9 @@ async function deploy(context, options) {
|
|
|
59
56
|
uploadConcurrency: concurrency,
|
|
60
57
|
});
|
|
61
58
|
const progressInterval = setInterval(() => updateSpinner(uploader.statusMessage(), debugging), debugging ? 2000 : 200);
|
|
59
|
+
if (!debugging) {
|
|
60
|
+
spinner.start();
|
|
61
|
+
}
|
|
62
62
|
try {
|
|
63
63
|
await uploader.start();
|
|
64
64
|
}
|
|
@@ -68,9 +68,10 @@ async function deploy(context, options) {
|
|
|
68
68
|
}
|
|
69
69
|
finally {
|
|
70
70
|
clearInterval(progressInterval);
|
|
71
|
+
updateSpinner(uploader.statusMessage(), debugging);
|
|
71
72
|
}
|
|
72
73
|
if (!debugging) {
|
|
73
|
-
|
|
74
|
+
spinner.stop();
|
|
74
75
|
}
|
|
75
76
|
(0, utils_1.logLabeledSuccess)("hosting[" + deploy.site + "]", "file upload complete");
|
|
76
77
|
const dt = Date.now() - t0;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Uploader = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const abort_controller_1 = require("abort-controller");
|
|
6
|
-
const clc = require("
|
|
6
|
+
const clc = require("colorette");
|
|
7
7
|
const crypto = require("crypto");
|
|
8
8
|
const fs = require("fs");
|
|
9
9
|
const path = require("path");
|
|
@@ -19,7 +19,7 @@ const MAX_UPLOAD_TIMEOUT = 7200000;
|
|
|
19
19
|
function progressMessage(message, current, total) {
|
|
20
20
|
current = Math.min(current, total);
|
|
21
21
|
const percent = Math.floor(((current * 1.0) / total) * 100).toString();
|
|
22
|
-
return `${message} [${current}/${total}] (${clc.bold.green(`${percent}%`)})`;
|
|
22
|
+
return `${message} [${current}/${total}] (${clc.bold(clc.green(`${percent}%`))})`;
|
|
23
23
|
}
|
|
24
24
|
class Uploader {
|
|
25
25
|
constructor(options) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateDeploy = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const projectPath_1 = require("../../projectPath");
|
|
8
8
|
const fsutils_1 = require("../../fsutils");
|
|
@@ -33,7 +33,7 @@ function validateDeploy(deploy, options) {
|
|
|
33
33
|
else {
|
|
34
34
|
const i18nPath = path.join(cfg.public, cfg.i18n.root);
|
|
35
35
|
if (!(0, fsutils_1.dirExistsSync)((0, projectPath_1.resolveProjectPath)(options, i18nPath))) {
|
|
36
|
-
(0, utils_1.logLabeledWarning)("hosting", `Couldn't find specified i18n root directory ${clc.bold(cfg.i18n.root)} in public directory ${clc.bold(cfg.public)}.`);
|
|
36
|
+
(0, utils_1.logLabeledWarning)("hosting", `Couldn't find specified i18n root directory ${clc.bold(cfg.i18n.root)} in public directory ${clc.bold(cfg.public || "")}.`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
package/lib/deploy/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deploy = void 0;
|
|
4
4
|
const logger_1 = require("../logger");
|
|
5
5
|
const api_1 = require("../api");
|
|
6
|
-
const
|
|
6
|
+
const colorette_1 = require("colorette");
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
@@ -52,7 +52,7 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
52
52
|
for (const targetName of targetNames) {
|
|
53
53
|
const target = TARGETS[targetName];
|
|
54
54
|
if (!target) {
|
|
55
|
-
return Promise.reject(new error_1.FirebaseError(`${(0,
|
|
55
|
+
return Promise.reject(new error_1.FirebaseError(`${(0, colorette_1.bold)(targetName)} is not a valid deploy target`));
|
|
56
56
|
}
|
|
57
57
|
predeploys.push((0, lifecycleHooks_1.lifecycleHooks)(targetName, "predeploy"));
|
|
58
58
|
prepares.push(target.prepare);
|
|
@@ -61,9 +61,9 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
61
61
|
postdeploys.push((0, lifecycleHooks_1.lifecycleHooks)(targetName, "postdeploy"));
|
|
62
62
|
}
|
|
63
63
|
logger_1.logger.info();
|
|
64
|
-
logger_1.logger.info((0,
|
|
64
|
+
logger_1.logger.info((0, colorette_1.bold)((0, colorette_1.white)("===") + " Deploying to '" + projectId + "'..."));
|
|
65
65
|
logger_1.logger.info();
|
|
66
|
-
(0, utils_1.logBullet)("deploying " + (0,
|
|
66
|
+
(0, utils_1.logBullet)("deploying " + (0, colorette_1.bold)(targetNames.join(", ")));
|
|
67
67
|
await chain(predeploys, context, options, payload);
|
|
68
68
|
await chain(prepares, context, options, payload);
|
|
69
69
|
await chain(deploys, context, options, payload);
|
|
@@ -75,13 +75,13 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
75
75
|
const duration = Date.now() - startTime;
|
|
76
76
|
await (0, track_1.track)("Product Deploy", [...targetNames].sort().join(","), duration);
|
|
77
77
|
logger_1.logger.info();
|
|
78
|
-
(0, utils_1.logSuccess)(
|
|
78
|
+
(0, utils_1.logSuccess)((0, colorette_1.bold)((0, colorette_1.underline)("Deploy complete!")));
|
|
79
79
|
logger_1.logger.info();
|
|
80
80
|
const deployedHosting = (0, lodash_1.includes)(targetNames, "hosting");
|
|
81
|
-
logger_1.logger.info((0,
|
|
81
|
+
logger_1.logger.info((0, colorette_1.bold)("Project Console:"), (0, utils_1.consoleUrl)(options.project, "/overview"));
|
|
82
82
|
if (deployedHosting) {
|
|
83
83
|
(0, lodash_1.each)(context.hosting.deploys, (deploy) => {
|
|
84
|
-
logger_1.logger.info((0,
|
|
84
|
+
logger_1.logger.info((0, colorette_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)(api_1.hostingOrigin, deploy.site));
|
|
85
85
|
});
|
|
86
86
|
const versionNames = context.hosting.deploys.map((deploy) => deploy.version);
|
|
87
87
|
return { hosting: versionNames.length === 1 ? versionNames[0] : versionNames };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lifecycleHooks = void 0;
|
|
4
4
|
const utils = require("../utils");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const childProcess = require("child_process");
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const needProjectId = require("../projectUtils").needProjectId;
|
|
@@ -82,7 +82,10 @@ function runTargetCommands(target, hook, overallOptions, config) {
|
|
|
82
82
|
}
|
|
83
83
|
return runAllCommands
|
|
84
84
|
.then(() => {
|
|
85
|
-
utils.logSuccess(clc.green.bold(logIdentifier + ":")
|
|
85
|
+
utils.logSuccess(clc.green(clc.bold(logIdentifier + ":")) +
|
|
86
|
+
" Finished running " +
|
|
87
|
+
clc.bold(hook) +
|
|
88
|
+
" script.");
|
|
86
89
|
})
|
|
87
90
|
.catch((err) => {
|
|
88
91
|
throw new error_1.FirebaseError(logIdentifier + " " + hook + " error: " + err.message);
|
|
@@ -24,13 +24,11 @@ async function default_1(context, options) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
_.set(context, "storage.rules", rulesConfig);
|
|
28
27
|
const rulesDeploy = new rulesDeploy_1.RulesDeploy(options, rulesDeploy_1.RulesetServiceType.FIREBASE_STORAGE);
|
|
29
|
-
|
|
28
|
+
const rulesConfigsToDeploy = [];
|
|
30
29
|
if (!Array.isArray(rulesConfig)) {
|
|
31
30
|
const defaultBucket = await gcp.storage.getDefaultBucket(options.project);
|
|
32
31
|
rulesConfig = [Object.assign(rulesConfig, { bucket: defaultBucket })];
|
|
33
|
-
_.set(context, "storage.rules", rulesConfig);
|
|
34
32
|
}
|
|
35
33
|
for (const ruleConfig of rulesConfig) {
|
|
36
34
|
const target = ruleConfig.target;
|
|
@@ -39,12 +37,16 @@ async function default_1(context, options) {
|
|
|
39
37
|
}
|
|
40
38
|
if (allStorage || onlyTargets.has(target)) {
|
|
41
39
|
rulesDeploy.addFile(ruleConfig.rules);
|
|
40
|
+
rulesConfigsToDeploy.push(ruleConfig);
|
|
42
41
|
onlyTargets.delete(target);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
if (!allStorage && onlyTargets.size !== 0) {
|
|
46
45
|
throw new error_1.FirebaseError(`Could not find rules for the following storage targets: ${[...onlyTargets].join(", ")}`);
|
|
47
46
|
}
|
|
47
|
+
_.set(context, "storage.rules", rulesConfig);
|
|
48
|
+
_.set(context, "storage.rulesConfigsToDeploy", rulesConfigsToDeploy);
|
|
49
|
+
_.set(context, "storage.rulesDeploy", rulesDeploy);
|
|
48
50
|
await rulesDeploy.compile();
|
|
49
51
|
}
|
|
50
52
|
exports.default = default_1;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const lodash_1 = require("lodash");
|
|
4
4
|
const rulesDeploy_1 = require("../../rulesDeploy");
|
|
5
5
|
async function default_1(context, options) {
|
|
6
|
-
const
|
|
6
|
+
const rulesConfigsToDeploy = (0, lodash_1.get)(context, "storage.rulesConfigsToDeploy", []);
|
|
7
7
|
const rulesDeploy = (0, lodash_1.get)(context, "storage.rulesDeploy");
|
|
8
|
-
if (!
|
|
9
|
-
return;
|
|
8
|
+
if (!rulesConfigsToDeploy.length || !rulesDeploy) {
|
|
9
|
+
return [];
|
|
10
10
|
}
|
|
11
11
|
const toRelease = [];
|
|
12
|
-
for (const ruleConfig of
|
|
12
|
+
for (const ruleConfig of rulesConfigsToDeploy) {
|
|
13
13
|
if (ruleConfig.target) {
|
|
14
14
|
options.rc.target(options.project, "storage", ruleConfig.target).forEach((bucket) => {
|
|
15
15
|
toRelease.push({ bucket: bucket, rules: ruleConfig.rules });
|
|
@@ -19,8 +19,9 @@ async function default_1(context, options) {
|
|
|
19
19
|
toRelease.push({ bucket: ruleConfig.bucket, rules: ruleConfig.rules });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
await Promise.all(toRelease.map((
|
|
23
|
-
return rulesDeploy.release(
|
|
22
|
+
await Promise.all(toRelease.map((r) => {
|
|
23
|
+
return rulesDeploy.release(r.rules, rulesDeploy_1.RulesetServiceType.FIREBASE_STORAGE, r.bucket);
|
|
24
24
|
}));
|
|
25
|
+
return toRelease.map((r) => r.bucket);
|
|
25
26
|
}
|
|
26
27
|
exports.default = default_1;
|