1 | # makensis-cli
|
2 |
|
3 | [![npm](https://flat.badgen.net/npm/license/makensis-cli)](https://www.npmjs.org/package/makensis-cli)
|
4 | [![npm](https://flat.badgen.net/npm/v/makensis-cli)](https://www.npmjs.org/package/makensis-cli)
|
5 | [![CircleCI](https://flat.badgen.net/circleci/github/idleberg/node-makensis-cli)](https://circleci.com/gh/idleberg/node-makensis-cli)
|
6 | [![David](https://flat.badgen.net/david/dep/idleberg/node-makensis-cli)](https://david-dm.org/idleberg/node-makensis-cli)
|
7 | [![David](https://flat.badgen.net/david/dev/idleberg/node-makensis-cli)](https://david-dm.org/idleberg/node-makensis-cli?type=dev)
|
8 |
|
9 | CLI for the makensis wrapper on Node
|
10 |
|
11 | ## Why?
|
12 |
|
13 | Admittedly, there are only few reasons why you would want to use a wrapper for an already existing CLI application.
|
14 |
|
15 | **Pros:**
|
16 |
|
17 | - seamless [Wine](http://winehq.org/) integration
|
18 | - Unix-like command-line parameters
|
19 | - normalized output across different NSIS versions
|
20 | - optional JSON output
|
21 |
|
22 | **Cons:**
|
23 |
|
24 | - redundancy
|
25 |
|
26 | ## Prerequisites
|
27 |
|
28 | Make sure that NSIS is properly installed with `makensis` in your PATH [environmental variable](http://superuser.com/a/284351/195953).
|
29 |
|
30 | ### Windows
|
31 |
|
32 | Download the NSIS installer from [SourceForge](https://sourceforge.net/p/nsis) and run setup. Once completed, you need to edit your environmental variable manually.
|
33 |
|
34 | Alternatively, you can install NSIS using the [Scoop](https://github.com/NSIS-Dev/scoop-nsis) package manager:
|
35 |
|
36 | ```sh
|
37 | $ scoop install nsis/nsis
|
38 | ```
|
39 |
|
40 | ### Linux
|
41 |
|
42 | Install NSIS from your distribution's default package manager, for example:
|
43 |
|
44 | ```sh
|
45 | # Debian
|
46 | $ sudo apt-get -t experimental install nsis
|
47 |
|
48 | # Red Hat
|
49 | $ sudo dnf install nsis
|
50 | ```
|
51 |
|
52 | ### macOS
|
53 |
|
54 | Install NSIS using [Homebrew](http://brew.sh/) or [MacPorts](https://www.macports.org/):
|
55 |
|
56 | ```sh
|
57 | # Homebrew
|
58 | $ brew install nsis
|
59 |
|
60 | # MacPorts
|
61 | $ port install nsis
|
62 | ```
|
63 |
|
64 | ### Wine
|
65 |
|
66 | You can setup NSIS in your [Wine](http://winehq.org/) environment, but keep in mind that Wine writes standard streams while executing `makensis`. Additional parsing of the compiler output might be necessary.
|
67 |
|
68 | ## Installation
|
69 |
|
70 | `$ npm install makensis-cli --global`
|
71 |
|
72 | ## Usage
|
73 |
|
74 | You can evoke this wrapper using `mn` (for **m**ake**n**sis) or – if you're not on Windows – `nsis`.
|
75 |
|
76 | ### Sub-Commands
|
77 |
|
78 | - `hdrinfo` – prints information about what options makensis was compiled with (Aliases: `f|flags|i|info`)
|
79 | - `version` – prints the makensis version and exits (Alias: `v`)
|
80 | - `license` – prints the makensis software license exits (Alias: `l`)
|
81 | - `cmdhelp [item]` – prints out help for 'item', or lists all commands
|
82 | - `nsisdir` – prints path of `${NSISDIR}` (Aliases: `d|dir`)
|
83 |
|
84 | ### Options
|
85 |
|
86 | Running `mn --help` lists all available options:
|
87 |
|
88 | ```
|
89 | Usage: mn [command] [file.nsi] [options]
|
90 |
|
91 | Options:
|
92 |
|
93 | -V, --version output the version number
|
94 | -i, --input-charset <string> ACP|OEM|CP#|UTF8|UTF16<LE|BE>
|
95 | -j, --json prints output as JSON
|
96 | -W, --pause pauses after execution
|
97 | -o, --output-charset <string> ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]
|
98 | -P, --ppo preprocess to stdout/file
|
99 | -S, --safe-ppo safely preprocess to stdout/file
|
100 | -p, --priority <n> process priority, where n is 5=realtime,4=high,3=above normal,2=normal,1=below normal,0=idle
|
101 | -v, --verbose <n> verbosity where n is 4=all,3=no script,2=no info,1=no warnings,0=none
|
102 | -w, --wine use Wine to run makenis
|
103 | -x, --strict treat warnings as errors
|
104 | -h, --help output usage information
|
105 | ```
|
106 |
|
107 | **Examples:**
|
108 |
|
109 | Let's start with `makensis` returning its version
|
110 |
|
111 | ```sh
|
112 | $ mn version
|
113 |
|
114 | # Result:
|
115 | #
|
116 | # v3.02.1
|
117 | ```
|
118 | ____
|
119 |
|
120 | We can also return this as JSON
|
121 |
|
122 | ```sh
|
123 | $ mn version --json
|
124 |
|
125 | # Result:
|
126 | #
|
127 | # {
|
128 | # "version": "3.02.1"
|
129 | # }
|
130 | ```
|
131 | ____
|
132 |
|
133 | Try again for `makensis` on Wine
|
134 |
|
135 | ```sh
|
136 | $ mn version --json --wine
|
137 |
|
138 | # Result:
|
139 | #
|
140 | # {
|
141 | # "version": "3.01"
|
142 | # }
|
143 | ```
|
144 | ____
|
145 |
|
146 | 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.
|
147 |
|
148 | ```sh
|
149 | $ printf "OutFile demo.exe\n\nSection\n!warning\nSectionEnd" > demo.nsi
|
150 | ```
|
151 | ____
|
152 |
|
153 | Compile the script
|
154 |
|
155 | ```sh
|
156 | $ mn demo.nsi
|
157 |
|
158 | # Result (omitted):
|
159 | #
|
160 | # EXE header size: 36352 / 37888 bytes
|
161 | # Install code: 399 / 1999 bytes
|
162 | # Install data: 0 / 0 bytes
|
163 | # CRC (0x027F605B): 4 / 4 bytes
|
164 | # Total size: 36755 / 39891 bytes (92.1%)
|
165 | # 1 warning:
|
166 | # !warning: (demo.nsi:4)
|
167 | ```
|
168 | ____
|
169 |
|
170 | Compile again, but only display warnings and errors
|
171 |
|
172 | ```sh
|
173 | $ mn demo.nsi --verbose 2
|
174 |
|
175 | # Result:
|
176 | #
|
177 | # warning: !warning: (demo.nsi:4)
|
178 | # 1 warning:
|
179 | # !warning: (demo.nsi:4)
|
180 | ```
|
181 | ____
|
182 |
|
183 | Compile with strict settings, so our little `!warning` will be treated as an error.
|
184 |
|
185 | ```sh
|
186 | $ mn demo.nsi --verbose 2 --strict
|
187 |
|
188 | # Result:
|
189 | #
|
190 | # Exit Code 1
|
191 | # Error: warning treated as error
|
192 | ```
|
193 | ____
|
194 |
|
195 | Let's output the above as JSON
|
196 |
|
197 | ```sh
|
198 | $ mn demo.nsi --verbose 2 --strict --json
|
199 |
|
200 | # Result:
|
201 | #
|
202 | # {
|
203 | # "status": 1,
|
204 | # "stdout": "warning: !warning: (demo.nsi:4)",
|
205 | # "stderr": "Error: warning treated as error",
|
206 | # "warnings": 1
|
207 | # }
|
208 | ```
|
209 |
|
210 | ## License
|
211 |
|
212 | This work is licensed under [The MIT License](https://opensource.org/licenses/MIT)
|
213 |
|
214 | ## Donate
|
215 |
|
216 | You are welcome to support this project using [Flattr](https://flattr.com/submit/auto?user_id=idleberg&url=https://github.com/idleberg/node-makensis-cli) or Bitcoin `17CXJuPsmhuTzFV2k4RKYwpEHVjskJktRd`
|