From 6df0a196b48b0abb149f519d4dd5c025ed76b299 Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Tue, 7 Nov 2023 14:37:03 -0800 Subject: [PATCH] feat: add support for custom .nuspectemplate file (#491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added support for custom .nuspectemplate file. * Update src/index.ts --------- Co-authored-by: Sébastien Taylor Co-authored-by: David Sanders --- src/index.ts | 3 ++- src/options.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 067a96e..9ae09db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -130,7 +130,8 @@ export async function createWindowsInstaller(options: SquirrelWindowsOptions): P metadata.additionalFiles.push({ src: 'vk_swiftshader_icd.json', target: 'lib\\net45' }); } - let templateData = await fs.readFile(path.join(__dirname, '..', 'template.nuspectemplate'), 'utf8'); + const templatePath = options.nuspecTemplate || path.join(__dirname, '..', 'template.nuspectemplate'); + let templateData = await fs.readFile(templatePath, 'utf8'); if (path.sep === '/') { templateData = templateData.replace(/\\/g, '/'); for (const f of metadata.additionalFiles) { diff --git a/src/options.ts b/src/options.ts index 7781e25..ad32f11 100644 --- a/src/options.ts +++ b/src/options.ts @@ -13,6 +13,12 @@ export interface SquirrelWindowsOptions { * Defaults to the installer folder at the project root. */ outputDirectory?: string; + /** + * The path to the .nuspectemplate file used by Squirrel.exe. + * + * Defaults to the bundled template.nuspectemplate. + */ + nuspecTemplate?: string; /** * The local path to a `.gif` file to display during install. */