Skip to content

Commit

Permalink
fix: add nsis customization paramter, and write it to the nsis script
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Apr 25, 2023
1 parent ee40912 commit c1004ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@
"registry": "https://registry.npmjs.org"
},
"types": "lib/index.d.ts"
}
}
7 changes: 5 additions & 2 deletions src/commands/pack/win.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ret=$?
exit $ret
`,
nsis: (config: Interfaces.Config
, arch: string) => `!include MUI2.nsh
, arch: string, extra?:string) => `!include MUI2.nsh
!define Version '${config.version.split('-')[0]}'
Name "${config.name}"
Expand Down Expand Up @@ -57,6 +57,8 @@ VIAddVersionKey /LANG=\${LANG_ENGLISH} "ProductVersion" "\${VERSION}.0"
InstallDir "\$PROGRAMFILES${arch === 'x64' ? '64' : ''}\\${config.dirname}"
${extra}
Section "${config.name} CLI \${VERSION}"
SetOutPath $INSTDIR
File /r bin
Expand Down Expand Up @@ -263,11 +265,12 @@ the CLI should already exist in a directory named after the CLI that is the root
const installerBase = path.join(buildConfig.tmp, `windows-${arch}-installer`)
await fs.promises.rm(installerBase, {recursive: true, force: true})
await fs.promises.mkdir(path.join(installerBase, 'bin'), {recursive: true})
const nsisExtra = config.pjson.windows?.nsisCustomization ? fs.readFileSync(config.pjson.windows?.nsisCustomization, 'utf8') : ''

await Promise.all([
fs.writeFile(path.join(installerBase, 'bin', `${config.bin}.cmd`), scripts.cmd(config)),
fs.writeFile(path.join(installerBase, 'bin', `${config.bin}`), scripts.sh(config)),
fs.writeFile(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis(config, arch)),
fs.writeFile(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis(config, arch, nsisExtra)),
].concat(config.binAliases ? config.binAliases.flatMap(alias =>
// write duplicate files for windows aliases
// this avoids mklink which can require admin privileges which not everyone has
Expand Down

0 comments on commit c1004ba

Please sign in to comment.