Skip to content

Commit

Permalink
fix: validate that the upgrade-scripts look correct (like an array of…
Browse files Browse the repository at this point in the history
… functions)
  • Loading branch information
Julusian committed Dec 23, 2024
1 parent f34aade commit 1416357
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export function runEntrypoint<TConfig>(
if (hasEntrypoint) throw new Error(`runEntrypoint can only be called once`)
hasEntrypoint = true

// Validate that the upgrade scripts look sane
if (!upgradeScripts) upgradeScripts = []
if (!Array.isArray(upgradeScripts)) throw new Error('upgradeScripts must be an array')
for (const upgradeScript of upgradeScripts) {
if (typeof upgradeScript !== 'function') throw new Error('upgradeScripts must be an array of functions')
}

const manifestPath = process.env.MODULE_MANIFEST
if (!manifestPath) throw new Error('Module initialise is missing MODULE_MANIFEST')

Expand Down

0 comments on commit 1416357

Please sign in to comment.