Skip to content

Commit

Permalink
feat: add prerelease field to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Feb 6, 2025
1 parent d6c0ab6 commit 29fdd86
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions assets/manifest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
"type": "string",
"description": "Current version of the module"
},
"isPrerelease": {
"type": "boolean",
"description": "Is this a pre-release version"
},
"license": {
"type": "string",
"description": "SPDX identifier for license of the module"
Expand Down
33 changes: 18 additions & 15 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,30 @@ import validateManifestSchema from '../generated/validate_manifest.js'
export { ModuleManifest, ModuleManifestMaintainer, ModuleManifestRuntime }

/** Validate that a manifest looks correctly populated */
export function validateManifest(manifest: ModuleManifest): void {
const manifestStr = JSON.stringify(manifest)
if (manifestStr.includes('companion-module-your-module-name'))
throw new Error(`Manifest incorrectly references template module 'companion-module-your-module-name'`)
export function validateManifest(manifest: ModuleManifest, looseChecks: boolean): void {
if (!looseChecks) {
const manifestStr = JSON.stringify(manifest)
if (manifestStr.includes('companion-module-your-module-name'))
throw new Error(`Manifest incorrectly references template module 'companion-module-your-module-name'`)

if (manifestStr.includes('module-shortname'))
throw new Error(`Manifest incorrectly references template module 'module-shortname'`)
if (manifestStr.includes('module-shortname'))
throw new Error(`Manifest incorrectly references template module 'module-shortname'`)

if (manifestStr.includes('A short one line description of your module'))
throw new Error(`Manifest incorrectly references template module 'A short one line description of your module'`)
if (manifestStr.includes('A short one line description of your module'))
throw new Error(`Manifest incorrectly references template module 'A short one line description of your module'`)

if (manifestStr.includes('Your name')) throw new Error(`Manifest incorrectly references template module 'Your name'`)
if (manifestStr.includes('Your name'))
throw new Error(`Manifest incorrectly references template module 'Your name'`)

if (manifestStr.includes('Your email'))
throw new Error(`Manifest incorrectly references template module 'Your email'`)
if (manifestStr.includes('Your email'))
throw new Error(`Manifest incorrectly references template module 'Your email'`)

if (manifestStr.includes('Your company'))
throw new Error(`Manifest incorrectly references template module 'Your company'`)
if (manifestStr.includes('Your company'))
throw new Error(`Manifest incorrectly references template module 'Your company'`)

if (manifestStr.includes('Your product'))
throw new Error(`Manifest incorrectly references template module 'Your product'`)
if (manifestStr.includes('Your product'))
throw new Error(`Manifest incorrectly references template module 'Your product'`)
}

if (!validateManifestSchema(manifest)) {
const errors = validateManifestSchema.errors
Expand Down

0 comments on commit 29fdd86

Please sign in to comment.