( template: string, templateModule: ForgeTemplate, )
| 57 | } |
| 58 | |
| 59 | async function validateTemplate( |
| 60 | template: string, |
| 61 | templateModule: ForgeTemplate, |
| 62 | ): Promise<void> { |
| 63 | if (!templateModule.requiredForgeVersion) { |
| 64 | throw new Error( |
| 65 | `Cannot use a template (${template}) with this version of Electron Forge, as it does not specify its required Forge version.`, |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | const forgeVersion = ( |
| 70 | await readRawPackageJson(path.join(__dirname, '..', '..')) |
| 71 | ).version; |
| 72 | if (!semver.satisfies(forgeVersion, templateModule.requiredForgeVersion)) { |
| 73 | throw new Error( |
| 74 | `Template (${template}) is not compatible with this version of Electron Forge (${forgeVersion}), it requires ${templateModule.requiredForgeVersion}`, |
| 75 | ); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | export default async ({ |
| 80 | dir = process.cwd(), |
no test coverage detected