Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/amo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@ type Compatibility = Record<string, VersionRange> | Array<string>;
type License =
| "all-rights-reserved"
| "MPL-2.0"
| "GPL-2.0-or-later"
| "GPL-3.0-or-later"
| "LGPL-2.1-or-later"
| "LGPL-3.0-or-later"
| "Apache-2.0"
| "GPL-2.0-only"
| "GPL-3.0-only"
| "LGPL-2.1-only"
| "LGPL-3.0-only"
| "AGPL-3.0-only"
| "MIT"
| "BSD-2-Clause";
| "BSD-2-Clause"
| "Unlicense";
export const LICENSE_NAMES = [
"all-rights-reserved",
"MPL-2.0",
"GPL-2.0-or-later",
"GPL-3.0-or-later",
"LGPL-2.1-or-later",
"LGPL-3.0-or-later",
"Apache-2.0",
"GPL-2.0-only",
"GPL-3.0-only",
"LGPL-2.1-only",
"LGPL-3.0-only",
"AGPL-3.0-only",
"MIT",
"BSD-2-Clause",
"Unlicense",
];
export const isLicense = (license: string): license is License => {
return LICENSE_NAMES.includes(license);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function run(): Promise<void> {
}
if (typeof license !== "undefined" && !isLicense(license)) {
throw new Error(
`Invalid license "${license}". Must be one of: ${Object.keys(
`Invalid license "${license}". Must be one of: ${Object.values(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This previously showed the error as "Must be one of: [1, 2, 3, 4]"

LICENSE_NAMES,
).join(", ")}`,
);
Expand Down