|
|
@@ -63,33 +63,22 @@ export class NsisComposer {
|
|
|
|
|
|
public async make(): Promise<string> {
|
|
|
|
|
|
- return `${ NsisComposer.DIVIDER }
|
|
|
+ return `
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
#
|
|
|
# Generated by nsis-gen.
|
|
|
#
|
|
|
${ NsisComposer.DIVIDER }
|
|
|
|
|
|
-${ await this.makeGeneralSection() }
|
|
|
-${ await this.makeResourcesSection() }
|
|
|
-${ await this.makeInstallSection() }
|
|
|
-${ await this.makeUninstallSection() }
|
|
|
-`;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- protected async makeGeneralSection(): Promise<string> {
|
|
|
-
|
|
|
- return `${ NsisComposer.DIVIDER }
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
#
|
|
|
# General
|
|
|
#
|
|
|
${ NsisComposer.DIVIDER }
|
|
|
|
|
|
-!include "MUI2.nsh"
|
|
|
-
|
|
|
Name "${ this.options.appName }"
|
|
|
Caption "${ this.options.appName }"
|
|
|
-BrandingText "${ this.options.appName }"
|
|
|
+BrandingText "${ this.options.appName } ${ this.fixedVersion }"
|
|
|
SetCompressor ${ this.options.solid ? '/SOLID' : '' } ${ this.options.compression }
|
|
|
OutFile "${ win32.normalize(resolve(this.options.output)) }"
|
|
|
|
|
|
@@ -99,6 +88,14 @@ InstallDirRegKey HKCU "Software\\${ this.options.appName }" "InstallDir"
|
|
|
RequestExecutionLevel user
|
|
|
XPStyle on
|
|
|
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
+#
|
|
|
+# Modern UI
|
|
|
+#
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
+
|
|
|
+!include "MUI2.nsh"
|
|
|
+
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\\${ this.options.appName }"
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartMenuFolder"
|
|
|
@@ -130,23 +127,7 @@ ${
|
|
|
: ''
|
|
|
}
|
|
|
|
|
|
-Function .onInit
|
|
|
-
|
|
|
- ${
|
|
|
- this.options.languages.length > 1
|
|
|
- ? `!insertmacro MUI_LANGDLL_DISPLAY`
|
|
|
- : ''
|
|
|
- }
|
|
|
-
|
|
|
-FunctionEnd
|
|
|
-
|
|
|
-`;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- protected async makeResourcesSection(): Promise<string> {
|
|
|
-
|
|
|
- return `${ NsisComposer.DIVIDER }
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
#
|
|
|
# Resources
|
|
|
#
|
|
|
@@ -158,15 +139,26 @@ VIAddVersionKey "CompanyName" "${ this.options.companyName }"
|
|
|
VIAddVersionKey "FileDescription" "${ this.options.description }"
|
|
|
VIAddVersionKey "FileVersion" "${ this.fixedVersion }"
|
|
|
VIAddVersionKey "LegalCopyright" "${ this.options.copyright }"
|
|
|
-`;
|
|
|
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
+#
|
|
|
+# Hooks
|
|
|
+#
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
+
|
|
|
+Function .onInit
|
|
|
+
|
|
|
+ ${
|
|
|
+ this.options.languages.length > 1
|
|
|
+ ? `!insertmacro MUI_LANGDLL_DISPLAY`
|
|
|
+ : ''
|
|
|
}
|
|
|
|
|
|
- protected async makeInstallSection(): Promise<string> {
|
|
|
+FunctionEnd
|
|
|
|
|
|
- return `${ NsisComposer.DIVIDER }
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
#
|
|
|
-# Main
|
|
|
+# Install
|
|
|
#
|
|
|
${ NsisComposer.DIVIDER }
|
|
|
|
|
|
@@ -190,13 +182,8 @@ ${ await this.makeInstallerFiles() }
|
|
|
WriteUninstaller "$INSTDIR\\Uninstall.exe"
|
|
|
|
|
|
SectionEnd
|
|
|
-`;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- protected async makeUninstallSection(): Promise<string> {
|
|
|
|
|
|
- return `${ NsisComposer.DIVIDER }
|
|
|
+${ NsisComposer.DIVIDER }
|
|
|
#
|
|
|
# Uninstall
|
|
|
#
|
|
|
@@ -204,8 +191,7 @@ ${ NsisComposer.DIVIDER }
|
|
|
|
|
|
Section Uninstall
|
|
|
|
|
|
-RMDir /r "$INSTDIR\\*.*"
|
|
|
-RMDir "$INSTDIR"
|
|
|
+RMDir /r "$INSTDIR"
|
|
|
|
|
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
|
|
|