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: `flags|info`)
|
79 | - `version` – prints the makensis version and exits
|
80 | - `license` – prints the makensis software license exits
|
81 | - `cmdhelp [item]` – prints out help for 'item', or lists all commands
|
82 | - `nsisdir` – prints path of `${NSISDIR}` (Aliases: `dir`)
|
83 | - `scaffold` – scaffold a new NSIS script in the current working directory (Aliases: `new`)
|
84 |
|
85 | ### Options
|
86 |
|
87 | Running `mn --help` lists all available options:
|
88 |
|
89 | ```
|
90 | Usage: mn [command] [file.nsi] [options]
|
91 |
|
92 | Options:
|
93 |
|
94 | -V, --version output the version number
|
95 | -i, --input-charset <string> ACP|OEM|CP#|UTF8|UTF16<LE|BE>
|
96 | -j, --json prints output as JSON
|
97 | -W, --pause pauses after execution
|
98 | -o, --output-charset <string> ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]
|
99 | -P, --ppo preprocess to stdout/file
|
100 | -S, --safe-ppo safely preprocess to stdout/file
|
101 | -p, --priority <n> process priority, where n is 5=realtime,4=high,3=above normal,2=normal,1=below normal,0=idle
|
102 | -v, --verbose <n> verbosity where n is 4=all,3=no script,2=no info,1=no warnings,0=none
|
103 | -w, --wine use Wine to run makenis
|
104 | -x, --strict treat warnings as errors
|
105 | -h, --help output usage information
|
106 | ```
|
107 |
|
108 | **Examples:**
|
109 |
|
110 | Let's start with `makensis` returning its version
|
111 |
|
112 | ```sh
|
113 | $ mn version
|
114 |
|
115 | # Result:
|
116 | #
|
117 | # v3.02.1
|
118 | ```
|
119 | ____
|
120 |
|
121 | We can also return this as JSON
|
122 |
|
123 | ```sh
|
124 | $ mn version --json
|
125 |
|
126 | # Result:
|
127 | #
|
128 | # {
|
129 | # "version": "3.02.1"
|
130 | # }
|
131 | ```
|
132 | ____
|
133 |
|
134 | Try again for `makensis` on Wine
|
135 |
|
136 | ```sh
|
137 | $ mn version --json --wine
|
138 |
|
139 | # Result:
|
140 | #
|
141 | # {
|
142 | # "version": "3.01"
|
143 | # }
|
144 | ```
|
145 | ____
|
146 |
|
147 | 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.
|
148 |
|
149 | ```sh
|
150 | $ printf "OutFile demo.exe\n\nSection\n!warning\nSectionEnd" > demo.nsi
|
151 | ```
|
152 | ____
|
153 |
|
154 | Compile the script
|
155 |
|
156 | ```sh
|
157 | $ mn demo.nsi
|
158 |
|
159 | # Result (omitted):
|
160 | #
|
161 | # EXE header size: 36352 / 37888 bytes
|
162 | # Install code: 399 / 1999 bytes
|
163 | # Install data: 0 / 0 bytes
|
164 | # CRC (0x027F605B): 4 / 4 bytes
|
165 | # Total size: 36755 / 39891 bytes (92.1%)
|
166 | # 1 warning:
|
167 | # !warning: (demo.nsi:4)
|
168 | ```
|
169 | ____
|
170 |
|
171 | Compile again, but only display warnings and errors
|
172 |
|
173 | ```sh
|
174 | $ mn demo.nsi --verbose 2
|
175 |
|
176 | # Result:
|
177 | #
|
178 | # warning: !warning: (demo.nsi:4)
|
179 | # 1 warning:
|
180 | # !warning: (demo.nsi:4)
|
181 | ```
|
182 | ____
|
183 |
|
184 | Compile with strict settings, so our little `!warning` will be treated as an error.
|
185 |
|
186 | ```sh
|
187 | $ mn demo.nsi --verbose 2 --strict
|
188 |
|
189 | # Result:
|
190 | #
|
191 | # Exit Code 1
|
192 | # Error: warning treated as error
|
193 | ```
|
194 | ____
|
195 |
|
196 | Let's output the above as JSON
|
197 |
|
198 | ```sh
|
199 | $ mn demo.nsi --verbose 2 --strict --json
|
200 |
|
201 | # Result:
|
202 | #
|
203 | # {
|
204 | # "status": 1,
|
205 | # "stdout": "warning: !warning: (demo.nsi:4)",
|
206 | # "stderr": "Error: warning treated as error",
|
207 | # "warnings": 1
|
208 | # }
|
209 | ```
|
210 |
|
211 | ## License
|
212 |
|
213 | This work is licensed under [The MIT License](https://opensource.org/licenses/MIT)
|
214 |
|
215 | ## Donate
|
216 |
|
217 | 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`
|