generator-nsis 0.8.10 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  # Generated with generator-nsis
2
2
  # https://github.com/idleberg/generator-nsis
3
3
 
4
- # Includes ---------------------------------<% pkg.includes.forEach( include => { %>
5
- !include "<%= include %>.nsh"<% }); %>
4
+ # Includes ---------------------------------<% pkg.includes?.forEach( include => { %>
5
+ !include "<%= include %>"<% }); %>
6
6
 
7
7
  # Settings ---------------------------------
8
8
  Name "<%- pkg.name %>"<% if (typeof pkg.ampersand_name !== 'undefined') { %> "<%- pkg.ampersand_name %>"<% } %>
@@ -10,40 +10,40 @@ OutFile "<%= pkg.outfile %>.exe"
10
10
  Unicode <%= pkg.unicode %>
11
11
  SetCompressor <%= pkg.compression %>
12
12
  RequestExecutionLevel <%= pkg.elevation %>
13
- InstallDir "$PROGRAMFILES\<%- pkg.name %>"<% if (!pkg.includes.includes('MUI2') && pkg.pages.includes('license')) { %>
13
+ InstallDir "$PROGRAMFILES\<%- pkg.name %>"<% if (!pkg.includes?.includes('MUI2') && pkg.pages?.includes('license')) { %>
14
14
  LicenseData "<% if (typeof pkg.spdxLicense !== 'undefined') { %>license.txt<% } %>"<% } %>
15
- <% if (pkg.includes.includes('MUI2') && (pkg.callbacks.includes('"custom.onGUIInit"') || pkg.callbacks.includes('"custom.onUserAbort"'))) { %>
16
- # Modern UI --------------------------------
17
- <% if (pkg.callbacks.includes('"custom.onGUIInit"')) { %>!define MUI_CUSTOMFUNCTION_GUIINIT "custom.onGUIInit"<% } %><% if (pkg.callbacks.includes('"custom.onUserAbort"')) { %>
18
- !define MUI_CUSTOMFUNCTION_ABORT "custom.onUserAbort"<% } %>
15
+ <% if (pkg.includes?.includes('MUI2')) { %>
16
+ # Modern UI --------------------------------<% if (pkg.callbacks?.includes('MUI.onGUIInit')) { %>
17
+ !define MUI_CUSTOMFUNCTION_GUIINIT "MUI.onGUIInit"<% } %><% if (pkg.callbacks?.includes('MUI.onUserAbort')) { %>
18
+ !define MUI_CUSTOMFUNCTION_ABORT "MUI.onUserAbort"<% } %>
19
19
  <% } %>
20
20
  # Pages ------------------------------------
21
- <% pkg.pages.forEach( page => { %><% if (pkg.includes.includes('MUI2')) { %>!insertmacro MUI_PAGE_<%= page.toUpperCase() %><% if (page === 'license' && typeof pkg.spdxLicense !== 'undefined') { %> "license.txt"<% } %><% } else { %>Page <%= page %><% } %>
21
+ <% pkg.pages?.forEach( page => { %><% if (page?.length) { %><% if (pkg.includes?.includes('MUI2')) { %>!insertmacro MUI_PAGE_<%= page.toUpperCase() %><% if (page === 'license' && typeof pkg.spdxLicense !== 'undefined') { %> "license.txt"<% } %><% } else { %>Page <%= page %><% } %><% } %>
22
22
  <% }); %>
23
23
  # Languages --------------------------------<% if (unlockAll === false) { %>
24
- <% if (pkg.includes.includes('MUI2')) { %>!insertmacro MUI_LANGUAGE "English"<% } else { %>LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"<% } %><% } %><% pkg.languages.forEach( language => { %>
25
- <% if (pkg.includes.includes('MUI2')) { %>!insertmacro MUI_LANGUAGE "<%= language %>"<% } else { %>LoadLanguageFile "${NSISDIR}\Contrib\Language files\<%= language %>.nlf"<% } %><% }); %>
24
+ <% if (pkg.includes?.includes('MUI2')) { %>!insertmacro MUI_LANGUAGE "English"<% } else { %>LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"<% } %><% } %><% pkg.languages?.forEach( language => { %>
25
+ <% if (pkg.includes?.includes('MUI2')) { %>!insertmacro MUI_LANGUAGE "<%= language %>"<% } else { %>LoadLanguageFile "${NSISDIR}\Contrib\Language files\<%= language %>.nlf"<% } %><% }); %>
26
26
 
27
27
  # Sections ---------------------------------<% for (let step = 0; step < parseInt(pkg.sections); step++) { %>
28
- Section "section" SECTION_<%= step %>
28
+ Section "section" SECTION_<%= step + 1 %>
29
29
  SectionEnd
30
- <% } %><% if (pkg.includes.includes('MUI2')) { %>
30
+ <% } %><% if (pkg.includes?.includes('MUI2')) { %>
31
31
  # Descriptions -----------------------------<% for (let step = 0; step < parseInt(pkg.sections); step++) { %><% if (unlockAll === false) { %>
32
- LangString DESC_SECTION_<%= step %> ${LANG_ENGLISH} "English description for section <%= step %>"<% } %><% pkg.languages.forEach( language => { %>
33
- LangString DESC_SECTION_<%= step %> ${LANG_<%= language.toUpperCase() %>} "<%= language %> description for section <%= step %>"<% }); %>
32
+ LangString DESC_SECTION_<%= step + 1 %> ${LANG_ENGLISH} "English description for section <%= step + 1%>"<% } %><% pkg.languages?.forEach( language => { %>
33
+ LangString DESC_SECTION_<%= step + 1 %> ${LANG_<%= language.toUpperCase() %>} "<%= language %> description for section <%= step + 1 %>"<% }); %>
34
34
  <% } %>
35
35
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN<% for (let step = 0; step < parseInt(pkg.sections); step++) { %>
36
- !insertmacro MUI_DESCRIPTION_TEXT ${SECTION_<%= step %>} $(DESC_SECTION_<%= step %>)<% } %>
36
+ !insertmacro MUI_DESCRIPTION_TEXT ${SECTION_<%= step + 1 %>} $(DESC_SECTION_<%= step + 1 %>)<% } %>
37
37
  !insertmacro MUI_FUNCTION_DESCRIPTION_END
38
38
  <% } %>
39
- # Functions --------------------------------<% pkg.callbacks.forEach( callback => { %>
39
+ # Functions --------------------------------<% pkg.callbacks?.forEach( callback => { %>
40
40
  Function <%- callback %>
41
41
  <% if (callback === '.onInit' && pkg.languageDialog) { %> Call LanguageDialog<%= '\n' %><% } %>FunctionEnd
42
42
  <% }); %><% if (pkg.languageDialog) { %>
43
43
  Function LanguageDialog
44
44
  Push ""
45
45
  Push ${LANG_ENGLISH}
46
- Push English<% pkg.languages.forEach( language => { %>
46
+ Push English<% pkg.languages?.forEach( language => { %>
47
47
  Push ${LANG_<%- language.toUpperCase() %>}
48
48
  Push "<% if (pkg.unicode) { %><%- languageData[language].native %><% } else { %><%- languageData[language].long || language %><% } %>"<% }); %>
49
49
  Push A
@@ -53,4 +53,5 @@ Function LanguageDialog
53
53
  StrCmp $LANGUAGE "cancel" 0 +2
54
54
  Abort
55
55
  FunctionEnd
56
- <% } %>
56
+ <% } %>
57
+ <% JSON.stringify(pkg.callbacks) %>
@@ -0,0 +1,265 @@
1
+ import terminalLink from 'terminal-link';
2
+
3
+ const docsURL = 'https://github.com/NSIS-Dev/Documentation/tree/master';
4
+
5
+ export const binary = [false, true];
6
+ export const elevation = ['user', 'highest', 'admin', 'none'];
7
+ export const compression = ['zlib', 'bzip2', 'lzma'];
8
+
9
+ export const callbacks = [
10
+ {
11
+ name: terminalLink('.onInit', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onInit.md', {
12
+ fallback() {
13
+ return '.onInit';
14
+ }
15
+ }),
16
+ value: '.onInit'
17
+ },
18
+ {
19
+ name: terminalLink('.onGUIInit', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onGUIInit.md', {
20
+ fallback() {
21
+ return '.onGUIInit';
22
+ }
23
+ }),
24
+ value: '.onGUIInit'
25
+ },
26
+ {
27
+ name: terminalLink('.onGUIEnd', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onGUIEnd.md', {
28
+ fallback() {
29
+ return '.onGUIEnd';
30
+ }
31
+ }),
32
+ value: '.onGUIEnd'
33
+ },
34
+ {
35
+ name: terminalLink('.onInstSuccess', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onInstSuccess.md', {
36
+ fallback() {
37
+ return '.onInstSuccess';
38
+ }
39
+ }),
40
+ value: '.onInstSuccess'
41
+ },
42
+ {
43
+ name: terminalLink('.onInstFailed', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onInstFailed.md', {
44
+ fallback() {
45
+ return '.onInstFailed';
46
+ }
47
+ }),
48
+ value: '.onInstFailed'
49
+ },
50
+ {
51
+ name: terminalLink('.onUserAbort', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onUserAbort.md', {
52
+ fallback() {
53
+ return '.onUserAbort';
54
+ }
55
+ }),
56
+ value: '.onUserAbort'
57
+ },
58
+ {
59
+ name: terminalLink('.onVerifyInstDir', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onVerifyInstDir.md', {
60
+ fallback() {
61
+ return '.onVerifyInstDir';
62
+ }
63
+ }),
64
+ value: '.onVerifyInstDir'
65
+ },
66
+ {
67
+ name: terminalLink('.onRebootFailed', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onRebootFailed.md', {
68
+ fallback() {
69
+ return '.onRebootFailed';
70
+ }
71
+ }),
72
+ value: '.onRebootFailed'
73
+ },
74
+ {
75
+ name: terminalLink('.onSelChange', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onSelChange.md', {
76
+ fallback() {
77
+ return '.onSelChange';
78
+ }
79
+ }),
80
+ value: '.onSelChange'
81
+ },
82
+ {
83
+ name: terminalLink('.onMouseOverSection', 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onMouseOverSection.md', {
84
+ fallback() {
85
+ return '.onMouseOverSection';
86
+ }
87
+ }),
88
+ value: '.onMouseOverSection'
89
+ },
90
+ ];
91
+
92
+ export const includes = [
93
+ {
94
+ name: 'Colors.nsh',
95
+ value: 'Colors',
96
+ checked: false
97
+ },
98
+ {
99
+ name: terminalLink('FileFunc.nsh', `${docsURL}/Includes/FileFunc`, {
100
+ fallback() {
101
+ return 'FileFunc.nsh';
102
+ }
103
+ }),
104
+ value: 'FileFunc',
105
+ checked: false
106
+ },
107
+ {
108
+ name: 'InstallOptions.nsh',
109
+ value: 'InstallOptions',
110
+ checked: false
111
+ },
112
+ {
113
+ name: 'Integration.nsh',
114
+ value: 'Integration',
115
+ checked: false
116
+ },
117
+ {
118
+ name: 'LangFile.nsh',
119
+ value: 'LangFile',
120
+ checked: false
121
+ },
122
+ {
123
+ name: 'Library.nsh',
124
+ value: 'Library',
125
+ checked: false
126
+ },
127
+ {
128
+ name: terminalLink('LogicLib.nsh', `${docsURL}/Includes/LogicLib`, {
129
+ fallback() {
130
+ return 'LogicLib.nsh';
131
+ }
132
+ }),
133
+ value: 'LogicLib',
134
+ checked: false
135
+ },
136
+ {
137
+ name: terminalLink('Memento.nsh', `${docsURL}/Includes/Memento`, {
138
+ fallback() {
139
+ return 'Memento.nsh';
140
+ }
141
+ }),
142
+ value: 'Memento',
143
+ checked: false
144
+ },
145
+ {
146
+ name: 'MUI.nsh',
147
+ value: 'MUI',
148
+ checked: false
149
+ },
150
+ {
151
+ name: 'MUI2.nsh',
152
+ value: 'MUI2',
153
+ checked: false
154
+ },
155
+ {
156
+ name: 'MultiUser.nsh',
157
+ value: 'MultiUser',
158
+ checked: false
159
+ },
160
+ {
161
+ name: 'nsDialogs.nsh',
162
+ value: 'nsDialogs',
163
+ checked: false
164
+ },
165
+ {
166
+ name: 'Sections.nsh',
167
+ value: 'Sections',
168
+ checked: false
169
+ },
170
+ {
171
+ name: terminalLink('StrFunc.nsh', `${docsURL}/Includes/StrFunc`, {
172
+ fallback() {
173
+ return 'StrFunc.nsh';
174
+ }
175
+ }),
176
+ value: 'StrFunc',
177
+ checked: false
178
+ },
179
+ {
180
+ name: terminalLink('TextFunc.nsh', `${docsURL}/Includes/TextFunc`, {
181
+ fallback() {
182
+ return 'TextFunc.nsh';
183
+ }
184
+ }),
185
+ value: 'TextFunc',
186
+ checked: false
187
+ },
188
+ {
189
+ name: 'UpgradeDLL.nsh',
190
+ value: 'UpgradeDLL',
191
+ checked: false
192
+ },
193
+ {
194
+ name: 'Util.nsh',
195
+ value: 'Util',
196
+ checked: false
197
+ },
198
+ {
199
+ name: 'VB6RunTime.nsh',
200
+ value: 'VB6RunTime',
201
+ checked: false
202
+ },
203
+ {
204
+ name: 'VPatchLib.nsh',
205
+ value: 'VPatchLib',
206
+ checked: false
207
+ },
208
+ {
209
+ name: 'WinCore.nsh',
210
+ value: 'WinCore',
211
+ checked: false
212
+ },
213
+ {
214
+ name: 'WinMessages.nsh',
215
+ value: 'WinMessages',
216
+ checked: false
217
+ },
218
+ {
219
+ name: terminalLink('WinVer.nsh', `${docsURL}/Includes/WinVer`, {
220
+ fallback() {
221
+ return 'WinVer.nsh';
222
+ }
223
+ }),
224
+ value: 'WinVer',
225
+ checked: false
226
+ },
227
+ {
228
+ name: terminalLink('WordFunc.nsh', `${docsURL}/Includes/WordFunc`, {
229
+ fallback() {
230
+ return 'WordFunc.nsh';
231
+ }
232
+ }),
233
+ value: 'WordFunc',
234
+ checked: false
235
+ },
236
+ {
237
+ name: terminalLink('x64.nsh', `${docsURL}/Includes/x64`, {
238
+ fallback() {
239
+ return 'x64.nsh';
240
+ }
241
+ }),
242
+ value: 'x64',
243
+ checked: false
244
+ }
245
+ ];
246
+
247
+ export const pages = [
248
+ {
249
+ name: 'license',
250
+ value: 'license',
251
+ },
252
+ {
253
+ name: 'components',
254
+ value: 'components',
255
+ },
256
+ {
257
+ name: 'directory',
258
+ value: 'directory',
259
+ },
260
+ {
261
+ name: 'instfiles',
262
+ value: 'instfiles',
263
+ checked: true
264
+ }
265
+ ];
@@ -0,0 +1,70 @@
1
+ import { basename, extname, resolve } from 'node:path';
2
+ import { includes as bundledLibraries } from './choices.js';
3
+ import { glob } from 'glob';
4
+ import { meta as languageData } from '@nsis/language-data';
5
+ import { nsisDir } from 'makensis';
6
+ import spdxLicenseList from 'spdx-license-list/full.js';
7
+ import terminalLink from 'terminal-link';
8
+
9
+ const spdxCodes = Object.getOwnPropertyNames(spdxLicenseList).sort();
10
+
11
+ export const licenseChoices = spdxCodes.map(obj => {
12
+ const licenses = {};
13
+ licenses['name'] = terminalLink(obj, `https://spdx.org/licenses/${obj}.html`, {
14
+ fallback() {
15
+ return obj;
16
+ }
17
+ });
18
+ licenses['value'] = obj;
19
+
20
+ return licenses;
21
+ });
22
+
23
+ export const getAllLibraries = async () => {
24
+ const nsisPath = await nsisDir();
25
+ const includeDir = resolve(nsisPath, 'Include')
26
+
27
+ const headerFiles = await glob([`${includeDir}/*.nsh`, `!${includeDir}/MUI.nsh`], {
28
+ ignore: bundledLibraries.map(excludedFile => `${includeDir}/${excludedFile.value}.nsh`)
29
+ });
30
+
31
+ const customHeaders = headerFiles.map(headerFile => {
32
+ return {
33
+ name: `${basename(headerFile)} [3rd party]`,
34
+ value: basename(headerFile, extname(headerFile)),
35
+ checked: false
36
+ }
37
+ });
38
+
39
+ const allLibraries = [...bundledLibraries, ...customHeaders];
40
+
41
+ return allLibraries.sort((a, z) => a.value.localeCompare(z.value));
42
+ };
43
+
44
+ export function getLanguageChoices(disabled) {
45
+ const languageChoices = Object.entries(languageData).map(([key, value]) => {
46
+ const isDisabled = (key === 'English') ? disabled : false;
47
+
48
+ // Use long names
49
+ return {
50
+ name: value.english || key,
51
+ value: key,
52
+ disabled: isDisabled
53
+ };
54
+ });
55
+
56
+ // Sort names
57
+ languageChoices.sort((a, z) => {
58
+ if (a.name < z.name) {
59
+ return -1;
60
+ }
61
+
62
+ if (a.name > z.name) {
63
+ return 1;
64
+ }
65
+
66
+ return 0;
67
+ });
68
+
69
+ return languageChoices;
70
+ }
package/license.txt ADDED
@@ -0,0 +1,7 @@
1
+ <copyright notice>
2
+
3
+ By obtaining, using, and/or copying this software and/or its associated documentation, you agree that you have read, understood, and will comply with the following terms and conditions:
4
+
5
+ Permission to use, copy, modify, and distribute this software and its associated documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies, and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the copyright holder not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.
6
+
7
+ THE COPYRIGHT HOLDER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/package.json CHANGED
@@ -1,52 +1,64 @@
1
1
  {
2
2
  "name": "generator-nsis",
3
- "version": "0.8.10",
3
+ "version": "0.10.0",
4
4
  "description": "Yeoman generator for NSIS scripts",
5
- "main": "generators/app",
5
+ "author": "Jan T. Sott",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "yeoman-generator",
9
+ "nsis",
10
+ "nullsoft",
11
+ "installer",
12
+ "setup"
13
+ ],
14
+ "type": "module",
15
+ "exports": "./generators/app",
6
16
  "files": [
7
- "generators"
17
+ "generators",
18
+ "LICENSE",
19
+ "README.md"
8
20
  ],
9
21
  "scripts": {
10
22
  "lint:ejs": "ejslint generators/**/*.ejs",
11
23
  "lint:js": "eslint generators/**/*.js --ignore-path .gitignore",
12
24
  "lint:json": "eslint ./*.json --ignore-path .gitignore",
13
25
  "lint": "npm-run-all --parallel lint:*",
26
+ "prepare": "husky",
14
27
  "publish": "np --no-yarn",
15
- "test": "npm run lint"
28
+ "test": "uvu --ignore test/__helper.js"
16
29
  },
17
- "keywords": [
18
- "yeoman-generator",
19
- "nsis",
20
- "nullsoft",
21
- "installer",
22
- "setup"
23
- ],
24
30
  "repository": {
25
31
  "type": "git",
26
32
  "url": "https://github.com/idleberg/generator-nsis"
27
33
  },
28
- "author": "",
29
- "license": "MIT",
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
30
37
  "dependencies": {
31
- "@nsis/language-data": "^0.9.0",
32
- "@sindresorhus/slugify": "^1.1.2",
33
- "globby": "^11.1.0",
34
- "makensis": "^1.1.3",
35
- "semver": "^7.3.7",
36
- "spdx-license-list": "^6.6.0",
37
- "terminal-link": "^2.1.1",
38
- "update-notifier": "^5.1.0",
39
- "yeoman-generator": "^4.13.0"
38
+ "@nsis/language-data": "^0.9.2",
39
+ "@sindresorhus/slugify": "^2.2.1",
40
+ "glob": "^10.3.10",
41
+ "makensis": "^2.0.8",
42
+ "semver": "^7.5.4",
43
+ "spdx-license-list": "^6.8.0",
44
+ "terminal-link": "^3.0.0",
45
+ "yeoman-generator": "^7.1.1"
40
46
  },
41
47
  "devDependencies": {
42
- "ejs-lint": "^1.2.2",
43
- "eslint": "^8.18.0",
48
+ "@lukeed/uuid": "^2.0.1",
49
+ "ejs-lint": "^2.0.0",
50
+ "eslint": "^8.56.0",
44
51
  "eslint-plugin-json": "^3.1.0",
45
- "esprima": "^4.0.1",
46
- "husky": "^8.0.1",
47
- "lint-staged": "^13.0.3",
48
- "np": "^7.6.2",
49
- "npm-run-all": "^4.1.5"
52
+ "husky": "^9.0.7",
53
+ "lint-staged": "^15.2.0",
54
+ "mem-fs": "^4.0.0",
55
+ "np": "^9.2.0",
56
+ "npm-run-all2": "^6.1.1",
57
+ "tsm": "^2.3.0",
58
+ "uvu": "^0.5.6",
59
+ "yeoman-assert": "^3.1.1",
60
+ "yeoman-environment": "^4.3.0",
61
+ "yeoman-test": "^8.2.0"
50
62
  },
51
63
  "lint-staged": {
52
64
  "*.ejs": "ejslint",