-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per 3435 | Update Win exe metadata and icon (#1618)
* update Binary Metadata * Update code to use resedit npm package * Update metadata values
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import fs from 'fs'; | ||
import * as ResEdit from 'resedit'; | ||
|
||
function windowsPostBuild(output) { | ||
const exe = ResEdit.NtExecutable.from(fs.readFileSync(output)); | ||
const res = ResEdit.NtExecutableResource.from(exe); | ||
const iconFile = ResEdit.Data.IconFile.from(fs.readFileSync('./scripts/files/percy.ico')); | ||
|
||
ResEdit.Resource.IconGroupEntry.replaceIconsForResource( | ||
res.entries, | ||
1, | ||
1033, | ||
iconFile.icons.map(item => item.data) | ||
); | ||
|
||
const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0]; | ||
|
||
vi.setStringValues( | ||
{ lang: 1033, codepage: 1200 }, | ||
{ | ||
ProductName: 'PercyCLI', | ||
FileDescription: 'Percy CLI Binary', | ||
CompanyName: 'BrowserStack Inc.', | ||
LegalCopyright: 'Copyright BrowserStack Limited', | ||
OriginalFilename: 'PercyCLI', | ||
InternalName: 'PercyCLI' | ||
} | ||
); | ||
vi.setFileVersion(1, 28, 8); | ||
vi.setProductVersion(1, 28, 8); | ||
vi.outputToResourceEntries(res.entries); | ||
res.outputResource(exe); | ||
fs.writeFileSync(output, Buffer.from(exe.generate())); | ||
} | ||
|
||
windowsPostBuild('percy.exe'); |