Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Merged
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ step-install-os-dependencies: &step-install-os-dependencies
sudo apt-get install --no-install-recommends -y wine64 wine32 wine
;;
Darwin)
brew cask install xquartz wine-stable
brew install --cask xquartz wine-stable
;;
esac

Expand Down Expand Up @@ -74,10 +74,6 @@ version: 2.1
orbs:
win: circleci/windows@1.0.0
jobs:
test-linux-8:
docker:
- image: circleci/node:8
<<: *steps-linux-win
test-linux-10:
docker:
- image: circleci/node:10
Expand All @@ -86,6 +82,10 @@ jobs:
docker:
- image: circleci/node:12
<<: *steps-linux-win
test-linux-14:
docker:
- image: circleci/node:14
<<: *steps-linux-win
test-mac:
macos:
xcode: "10.2.0"
Expand All @@ -109,16 +109,16 @@ workflows:
test_and_release:
# Run the test jobs first, then the release only when all the test jobs are successful
jobs:
- test-linux-8
- test-linux-10
- test-linux-12
- test-linux-14
- test-mac
- test-windows
- release:
requires:
- test-linux-8
- test-linux-10
- test-linux-12
- test-linux-14
- test-mac
- test-windows
filters:
Expand Down
42 changes: 5 additions & 37 deletions lib/rcedit.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const os = require('os')
const { canRunWindowsExeNatively, spawnExe } = require('cross-spawn-windows-exe')
const path = require('path')
const { spawn } = require('child_process')

const pairSettings = ['version-string']
const singleSettings = ['file-version', 'product-version', 'icon', 'requested-execution-level']
const noPrefixSettings = ['application-manifest']

module.exports = async (exe, options) => {
let rcedit = path.resolve(__dirname, '..', 'bin', process.arch === 'x64' ? 'rcedit-x64.exe' : 'rcedit.exe')
const rceditExe = process.arch === 'x64' ? 'rcedit-x64.exe' : 'rcedit.exe'
const rcedit = path.resolve(__dirname, '..', 'bin', rceditExe)
const args = [exe]

for (const name of pairSettings) {
Expand All @@ -34,42 +34,10 @@ module.exports = async (exe, options) => {
env: { ...process.env }
}

// Use Wine on non-Windows platforms except for WSL, which doesn't need it
if (process.platform !== 'win32' && !os.release().endsWith('Microsoft')) {
args.unshift(rcedit)
rcedit = process.arch === 'x64' ? 'wine64' : 'wine'
if (!canRunWindowsExeNatively()) {
// Suppress "fixme:" stderr log messages
spawnOptions.env.WINEDEBUG = '-all'
}

return new Promise((resolve, reject) => {
const child = spawn(rcedit, args, spawnOptions)
let stderr = ''
let error = null

child.on('error', err => {
if (error === null) {
error = err
}
})

child.stderr.on('data', data => {
stderr += data
})

child.on('close', code => {
if (error !== null) {
reject(error)
} else if (code === 0) {
resolve()
} else {
let message = `rcedit.exe failed with exit code ${code}`
stderr = stderr.trim()
if (stderr) {
message += `. ${stderr}`
}
reject(new Error(message))
}
})
})
await spawnExe(rcedit, args, spawnOptions)
}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@
},
"license": "MIT",
"engines": {
"node": ">= 8.0.0"
"node": ">= 10.0.0"
},
"dependencies": {
"cross-spawn-windows-exe": "^1.0.0"
},
"devDependencies": {
"@continuous-auth/semantic-release-npm": "^2.0.0",
"got": "^9.6.0",
"mocha": "^6.1.4",
"got": "^11.8.0",
"mocha": "^8.2.1",
"rcinfo": "^0.1.3",
"semantic-release": "^15.13.3",
"standard": "^14.3.3",
"temp": "^0.9.0",
"ts-standard": "^8.0.1",
"tsd": "^0.11.0",
"typedoc": "^0.17.0",
"semantic-release": "^17.3.0",
"standard": "^16.0.3",
"temp": "^0.9.4",
"ts-standard": "^10.0.0",
"tsd": "^0.14.0",
"typedoc": "^0.20.0-beta.27",
"typescript": "^4.1.2"
},
"resolutions": {
"**/semver": "< 7"
},
"tsd": {
"directory": "test"
}
Expand Down
2 changes: 1 addition & 1 deletion test/rcedit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('async rcedit(exePath, options)', function () {

it('reports an error when the .exe path does not exist', async () => {
await assertRceditError(path.join(tempPath, 'does-not-exist.exe'), { 'file-version': '3.4.5.6' }, [
'rcedit.exe failed with exit code 1.',
'Command failed with a non-zero return code (1)',
'Unable to load file'
])
})
Expand Down
Loading