mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-04-28 20:05:23 +08:00
Bugbash fixes (#3644)
* Print function names on validation errors, not [Object object] * Require all necessary APIs * Remove import eslint module The import module does not currenty handle package exports. The author is apparently of the opinion that exports should not use renaming features. Until this is fixed, all of the v2 API is broken. See https://github.com/import-js/eslint-plugin-import/issues/1810 for more info. * Linter fixes
This commit is contained in:
@@ -60,14 +60,20 @@ export async function prepare(
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: this will eventually be enalbed for everyone once AR is enabled
|
||||
// for GCFv1
|
||||
// Note: Some of these are premium APIs that require billing to be enabled.
|
||||
// We'd eventually have to add special error handling for billing APIs, but
|
||||
// enableCloudBuild is called above and has this special casing already.
|
||||
if (wantBackend.cloudFunctions.find((f) => f.platform === "gcfv2")) {
|
||||
await ensureApiEnabled.ensure(
|
||||
context.projectId,
|
||||
"artifactregistry.googleapis.com",
|
||||
"artifactregistry"
|
||||
);
|
||||
const V2_APIS = {
|
||||
artifactregistry: "artifactregistry.googleapis.com",
|
||||
cloudrun: "run.googleapis.com",
|
||||
eventarc: "eventarc.googleapis.com",
|
||||
pubsub: "pubsub.googleapis.com",
|
||||
};
|
||||
const enablements = Object.entries(V2_APIS).map(([tag, api]) => {
|
||||
return ensureApiEnabled.ensure(context.projectId, api, tag);
|
||||
});
|
||||
await Promise.all(enablements);
|
||||
}
|
||||
|
||||
// Prepare the functions directory for upload, and set context.triggers.
|
||||
|
||||
@@ -38,7 +38,7 @@ export function functionIdsAreValid(functions: { id: string; platform: string }[
|
||||
});
|
||||
if (invalidV1Ids.length !== 0) {
|
||||
const msg =
|
||||
`${invalidV1Ids.join(", ")} function name(s) can only contain letters, ` +
|
||||
`${invalidV1Ids.map((f) => f.id).join(", ")} function name(s) can only contain letters, ` +
|
||||
`numbers, hyphens, and not exceed 62 characters in length`;
|
||||
throw new FirebaseError(msg);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export function functionIdsAreValid(functions: { id: string; platform: string }[
|
||||
});
|
||||
if (invalidV2Ids.length !== 0) {
|
||||
const msg =
|
||||
`${invalidV2Ids.join(", ")} v2 function name(s) can only contin lower ` +
|
||||
`${invalidV2Ids.map((f) => f.id).join(", ")} v2 function name(s) can only contin lower ` +
|
||||
`case letters, numbers, hyphens, and not exceed 62 characters in length`;
|
||||
throw new FirebaseError(msg);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ module.exports = {
|
||||
],
|
||||
plugins: [
|
||||
"@typescript-eslint",
|
||||
"import",
|
||||
],
|
||||
rules: {
|
||||
quotes: ["error", "double"],
|
||||
|
||||
Reference in New Issue
Block a user