From 04fdd165a411a30eb386b331acd99ddd78a74111 Mon Sep 17 00:00:00 2001 From: calebboyd Date: Fri, 8 Sep 2017 14:29:19 -0500 Subject: [PATCH] feat: productversion and fileversion replacements in node-rc --- src/patches/node-rc.ts | 8 +++++++- test/target.spec.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/patches/node-rc.ts b/src/patches/node-rc.ts index 9bb3d15..6427079 100644 --- a/src/patches/node-rc.ts +++ b/src/patches/node-rc.ts @@ -12,7 +12,13 @@ export default async function nodeRc(compiler: NexeCompiler, next: () => Promise let value = options[key] const isVar = /^[A-Z_]+$/.test(value) value = isVar ? value : `"${value}"` - file.contents.replace(new RegExp(`VALUE "${key}",*`), `VALUE "${key}", ${value}`) + file.contents = file.contents.replace(new RegExp(`VALUE "${key}",*`), `VALUE "${key}", ${value}`) + }) + + ;['PRODUCTVERSION', 'FILEVERSION'].forEach(x => { + if (options[x]) { + file.contents = file.contents.replace(new RegExp(x + ' .*$', 'm'),`${x} ${options[x]}`) + } }) return next() diff --git a/test/target.spec.ts b/test/target.spec.ts index a5cf8c5..092f25e 100644 --- a/test/target.spec.ts +++ b/test/target.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai' import { blue as b } from 'chalk' import { getTarget, NexeTarget } from '../src/target' -const arch = (isWindows && process.arch === 'ia32') ? 'x86' : process.arch +const arch = process.arch === 'ia32' ? 'x86' : process.arch describe('Targets', () => { [