CLI for the Node.js makensis wrapper, compiles NSIS scripts
npm install makensis-cli



CLI for the Node.js makensis wrapper
Admittedly, there are only few reasons why you would want to use a wrapper for an already existing CLI application.
Pros:
- seamless Wine integration
- Unix-like command-line parameters
- normalized output across different NSIS versions
- optional JSON output
Cons:
- redundancy
Make sure that NSIS is properly installed with makensis in your PATH environment variable.
Download the NSIS installer from SourceForge and run setup. Once completed, you need to edit your environment variable manually.
Alternatively, you can install NSIS using the Scoop package manager:
``sh`
$ scoop install nsis/nsis
Install NSIS from your distribution's default package manager, for example:
`shDebian
$ sudo apt-get install nsis
$3
`sh
Homebrew
$ brew install nsisMacPorts
$ port install nsis
`$3
You can setup NSIS in your Wine environment, but keep in mind that Wine writes standard streams while executing
makensis. Additional parsing of the compiler output might be necessary.Installation
$ npm install makensis-cli --globalUsage
You can evoke this wrapper using
mn (for makensis).$3
-
hdrinfo – prints information about what options makensis was compiled with (Aliases: flags)
- version – prints the makensis version and exits
- license – prints the makensis software license exits
- cmdhelp [item] – prints out help for 'item', or lists all commands
- nsisdir – prints path of ${NSISDIR} (Aliases: dir)
- scaffold – scaffold a new NSIS script in the current working directory (Aliases: new)$3
Running
mn --help lists all available options:`
CLI version of node-makensisOptions:
-V, --version output the version number
-h, --help output usage information
Commands:
hdrinfo|flags Print compilation flags
compile [script] Compiles script(s)
version [options] Import repository
cmdhelp|help [command] [options] Prints out help for single or all commands
license [options] Prints license
nsisdir|dir Prints NSIS installation folder
scaffold|new Creates custom made NSIS script
help [cmd] display help for [cmd]
`Examples:
Let's start with
makensis returning its version`sh
$ mn versionResult:
#
v3.02.1
`
____We can also return this as JSON
`sh
$ mn version --jsonResult:
#
{
"version": "3.02.1"
}
`
____Try again for
makensis on Wine`sh
$ mn version --json --wineResult:
#
{
"version": "3.01"
}
`
____In the following steps we're going to need a demo script, so let's create one. Take special note of the
!warning inside the section.`sh
$ printf "OutFile demo.exe\n\nSection\n!warning\nSectionEnd" > demo.nsi
`
____Compile the script
`sh
$ mn demo.nsiResult (omitted):
#
EXE header size: 36352 / 37888 bytes
Install code: 399 / 1999 bytes
Install data: 0 / 0 bytes
CRC (0x027F605B): 4 / 4 bytes
Total size: 36755 / 39891 bytes (92.1%)
1 warning:
!warning: (demo.nsi:4)
`
____Compile again, but only display warnings and errors
`sh
$ mn demo.nsi --verbose 2Result:
#
warning: !warning: (demo.nsi:4)
1 warning:
!warning: (demo.nsi:4)
`
____Compile with strict settings, so our little
!warning will be treated as an error.`sh
$ mn demo.nsi --verbose 2 --strictResult:
#
Exit Code 1
Error: warning treated as error
`
____Let's output the above as JSON
`sh
$ mn demo.nsi --verbose 2 --strict --jsonResult:
#
{
"status": 1,
"stdout": "warning: !warning: (demo.nsi:4)",
"stderr": "Error: warning treated as error",
"warnings": 1
}
``This work is licensed under The MIT License