generator-nsis 0.11.4 → 0.12.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.
- package/LICENSE +1 -1
- package/README.md +3 -5
- package/generators/app/index.js +23 -12
- package/generators/app/templates/installer.nsi.eta +59 -0
- package/generators/app/templates/license.txt.eta +1 -0
- package/lib/choices.js +229 -0
- package/lib/helpers.js +68 -0
- package/license.txt +18 -0
- package/package.json +63 -70
- package/generators/app/templates/installer.nsi.ejs +0 -57
- package/generators/app/templates/license.txt.ejs +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
[](https://www.npmjs.org/package/generator-nsis)
|
|
7
7
|
[](https://github.com/idleberg/generator-nsis/actions)
|
|
8
8
|
|
|
9
|
-

|
|
10
|
-
|
|
11
9
|
**Features**
|
|
12
10
|
|
|
13
11
|
- Modern UI-aware
|
|
@@ -24,7 +22,7 @@
|
|
|
24
22
|
You need [Node.js](https://nodejs.org/en/) installed and available in your `PATH` [environment variable](http://superuser.com/a/284351/195953). Use your preferred Node package manager to install the Yeoman CLI tool.
|
|
25
23
|
|
|
26
24
|
```sh
|
|
27
|
-
$ npm install
|
|
25
|
+
$ npm install --global yo
|
|
28
26
|
```
|
|
29
27
|
|
|
30
28
|
## Installation
|
|
@@ -32,7 +30,7 @@ $ npm install -g yo
|
|
|
32
30
|
Use your preferred package manager to install this generator
|
|
33
31
|
|
|
34
32
|
```sh
|
|
35
|
-
$ npm
|
|
33
|
+
$ npm install --global generator-nsis
|
|
36
34
|
```
|
|
37
35
|
|
|
38
36
|
## Usage
|
|
@@ -47,4 +45,4 @@ _“That's all Folks!”_
|
|
|
47
45
|
|
|
48
46
|
## License
|
|
49
47
|
|
|
50
|
-
This work is licensed under the [MIT License](
|
|
48
|
+
This work is licensed under the [MIT License](LICENSE).
|
package/generators/app/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { GeneratorCompat as Generator } from '@idleberg/yeoman-generator';
|
|
1
2
|
import { meta as languageData } from '@nsis/language-data';
|
|
2
3
|
import slugify from '@sindresorhus/slugify';
|
|
4
|
+
import { inverse } from 'kleur/colors';
|
|
3
5
|
import semver from 'semver';
|
|
4
6
|
import spdxLicenseList from 'spdx-license-list/full.js';
|
|
5
7
|
import terminalLink from 'terminal-link';
|
|
6
|
-
import Generator from 'yeoman-generator';
|
|
7
8
|
import * as choices from '../../lib/choices.js';
|
|
8
9
|
import { getAllLibraries, getLanguageChoices, licenseChoices } from '../../lib/helpers.js';
|
|
9
10
|
|
|
@@ -17,11 +18,13 @@ export default class extends Generator {
|
|
|
17
18
|
this.option('debug', { desc: 'Prints debug messages', default: false });
|
|
18
19
|
|
|
19
20
|
this.disabled = !this.options.unlockAll;
|
|
21
|
+
this.outdir = this.options.debug ? '.debug' : '';
|
|
20
22
|
|
|
21
23
|
globalThis.console.log(/* let it breathe */);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
async prompting() {
|
|
27
|
+
this.clack.intro(inverse(` ${this.appname} `));
|
|
25
28
|
// Pre-load async choices for proper storage support
|
|
26
29
|
const includeChoices = this.options.firstParty ? choices.includes : await getAllLibraries();
|
|
27
30
|
|
|
@@ -193,17 +196,25 @@ export default class extends Generator {
|
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
|
|
196
|
-
await this.fs.copyTplAsync(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
199
|
+
await this.fs.copyTplAsync(
|
|
200
|
+
this.templatePath('installer.nsi.eta'),
|
|
201
|
+
this.destinationPath(this.outdir, 'installer.nsi'),
|
|
202
|
+
{
|
|
203
|
+
...this.props,
|
|
204
|
+
languageData: languageData,
|
|
205
|
+
unlockAll: this.options['unlock-all'],
|
|
206
|
+
debug: this.options.debug,
|
|
207
|
+
},
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
if (typeof this.props.spdxLicense === 'string') {
|
|
211
|
+
await this.fs.copyTplAsync(
|
|
212
|
+
this.templatePath('license.txt.eta'),
|
|
213
|
+
this.destinationPath(this.outdir, 'license.txt'),
|
|
214
|
+
{
|
|
215
|
+
licenseText: this.props.licenseText,
|
|
216
|
+
},
|
|
217
|
+
);
|
|
207
218
|
}
|
|
208
219
|
}
|
|
209
220
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Generated with generator-nsis
|
|
2
|
+
# https://github.com/idleberg/generator-nsis
|
|
3
|
+
|
|
4
|
+
# Includes ---------------------------------<% it.includes?.forEach( include => { %>
|
|
5
|
+
!include "<%= include %>.nsh"<% }); %>
|
|
6
|
+
|
|
7
|
+
# Settings ---------------------------------
|
|
8
|
+
Name "<%= it.name %>"<% if (typeof it.ampersand_name !== 'undefined') { %> "<%= it.ampersand_name %>"<% } %>
|
|
9
|
+
OutFile "<%= it.outfile %>.exe"
|
|
10
|
+
Unicode <%= it.unicode %>
|
|
11
|
+
SetCompressor <%= it.compression %>
|
|
12
|
+
RequestExecutionLevel <%= it.elevation %>
|
|
13
|
+
InstallDir "$PROGRAMFILES\<%= it.name %>"<% if (!it.includes?.includes('MUI2') && it.pages?.includes('license')) { %>
|
|
14
|
+
LicenseData "<% if (typeof it.spdxLicense !== 'undefined') { %>license.txt<% } %>"<% } %>
|
|
15
|
+
<% if (it.includes?.includes('MUI2')) { %>
|
|
16
|
+
# Modern UI --------------------------------<% if (it.lifecycles?.includes('MUI.onGUIInit')) { %>
|
|
17
|
+
!define MUI_CUSTOMFUNCTION_GUIINIT "MUI.onGUIInit"<% } %><% if (it.lifecycles?.includes('MUI.onUserAbort')) { %>
|
|
18
|
+
!define MUI_CUSTOMFUNCTION_ABORT "MUI.onUserAbort"<% } %>
|
|
19
|
+
<% } %>
|
|
20
|
+
# Pages ------------------------------------
|
|
21
|
+
<% it.pages?.forEach( page => { %><% if (page?.length) { %><% if (it.includes?.includes('MUI2')) { %>!insertmacro MUI_PAGE_<%= page.toUpperCase() %><% if (page === 'license' && typeof it.spdxLicense !== 'undefined') { %> "license.txt"<% } %><% } else { %>Page <%= page %><% } %><% } %>
|
|
22
|
+
<% }); %>
|
|
23
|
+
# Languages --------------------------------<% if (it.unlockAll === false) { %>
|
|
24
|
+
<% if (it.includes?.includes('MUI2')) { %>!insertmacro MUI_LANGUAGE "English"<% } else { %>LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"<% } %><% } %><% it.languages?.forEach( language => { %>
|
|
25
|
+
<% if (it.includes?.includes('MUI2')) { %>!insertmacro MUI_LANGUAGE "<%= language %>"<% } else { %>LoadLanguageFile "${NSISDIR}\Contrib\Language files\<%= language %>.nlf"<% } %><% }); %>
|
|
26
|
+
|
|
27
|
+
# Sections ---------------------------------<% for (let step = 0; step < parseInt(it.sections); step++) { %>
|
|
28
|
+
Section "section" SECTION_<%= step + 1 %>
|
|
29
|
+
SectionEnd
|
|
30
|
+
<% } %><% if (it.includes?.includes('MUI2')) { %>
|
|
31
|
+
# Descriptions -----------------------------<% for (let step = 0; step < parseInt(it.sections); step++) { %><% if (it.unlockAll === false) { %>
|
|
32
|
+
LangString DESC_SECTION_<%= step + 1 %> ${LANG_ENGLISH} "English description for section <%= step + 1%>"<% } %><% it.languages?.forEach( language => { %>
|
|
33
|
+
LangString DESC_SECTION_<%= step + 1 %> ${LANG_<%= language.toUpperCase() %>} "<%= language %> description for section <%= step + 1 %>"<% }); %>
|
|
34
|
+
<% } %>
|
|
35
|
+
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN<% for (let step = 0; step < parseInt(it.sections); step++) { %>
|
|
36
|
+
!insertmacro MUI_DESCRIPTION_TEXT ${SECTION_<%= step + 1 %>} $(DESC_SECTION_<%= step + 1 %>)<% } %>
|
|
37
|
+
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
38
|
+
<% } %>
|
|
39
|
+
# Functions --------------------------------<% it.lifecycles?.forEach( lifecycle => { %>
|
|
40
|
+
Function <%= lifecycle %>
|
|
41
|
+
<% if (lifecycle === '.onInit' && it.languageDialog) { %> Call LanguageDialog<%= '\n' %><% } %>FunctionEnd
|
|
42
|
+
<% }); %><% if (it.languageDialog) { %>
|
|
43
|
+
Function LanguageDialog
|
|
44
|
+
Push ""
|
|
45
|
+
|
|
46
|
+
Push ${LANG_ENGLISH}
|
|
47
|
+
Push English
|
|
48
|
+
<% it.languages?.forEach( language => { %>
|
|
49
|
+
Push ${LANG_<%= language.toUpperCase() %>}
|
|
50
|
+
Push "<% if (it.unicode) { %><%= it.languageData[language].native %><% } else { %><%= it.languageData[language].long || language %><% } %>"
|
|
51
|
+
<% }); %>
|
|
52
|
+
Push A
|
|
53
|
+
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
|
|
54
|
+
Pop $LANGUAGE
|
|
55
|
+
|
|
56
|
+
StrCmp $LANGUAGE "cancel" 0 +2
|
|
57
|
+
Abort
|
|
58
|
+
FunctionEnd
|
|
59
|
+
<% } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= it.licenseText %>
|
package/lib/choices.js
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import terminalLink from 'terminal-link';
|
|
2
|
+
|
|
3
|
+
const docsURL = 'https://github.com/NSIS-Dev/Documentation/tree/main/docs/';
|
|
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 lifecycles = [
|
|
10
|
+
{
|
|
11
|
+
name: terminalLink('.onInit', `${docsURL}/Callbacks/onInit.md`, {
|
|
12
|
+
fallback: false,
|
|
13
|
+
}),
|
|
14
|
+
value: '.onInit',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: terminalLink('.onGUIInit', `${docsURL}/Callbacks/onGUIInit.md`, {
|
|
18
|
+
fallback: false,
|
|
19
|
+
}),
|
|
20
|
+
value: '.onGUIInit',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: terminalLink('.onGUIEnd', `${docsURL}/Callbacks/onGUIEnd.md`, {
|
|
24
|
+
fallback: false,
|
|
25
|
+
}),
|
|
26
|
+
value: '.onGUIEnd',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: terminalLink('.onInstSuccess', `${docsURL}/Callbacks/onInstSuccess.md`, {
|
|
30
|
+
fallback: false,
|
|
31
|
+
}),
|
|
32
|
+
value: '.onInstSuccess',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: terminalLink('.onInstFailed', `${docsURL}/Callbacks/onInstFailed.md`, {
|
|
36
|
+
fallback: false,
|
|
37
|
+
}),
|
|
38
|
+
value: '.onInstFailed',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: terminalLink('.onUserAbort', `${docsURL}/Callbacks/onUserAbort.md`, {
|
|
42
|
+
fallback: false,
|
|
43
|
+
}),
|
|
44
|
+
value: '.onUserAbort',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: terminalLink('.onVerifyInstDir', `${docsURL}/Callbacks/onVerifyInstDir.md`, {
|
|
48
|
+
fallback: false,
|
|
49
|
+
}),
|
|
50
|
+
value: '.onVerifyInstDir',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: terminalLink('.onRebootFailed', `${docsURL}/Callbacks/onRebootFailed.md`, {
|
|
54
|
+
fallback: false,
|
|
55
|
+
}),
|
|
56
|
+
value: '.onRebootFailed',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: terminalLink('.onSelChange', `${docsURL}/Callbacks/onSelChange.md`, {
|
|
60
|
+
fallback: false,
|
|
61
|
+
}),
|
|
62
|
+
value: '.onSelChange',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: terminalLink('.onMouseOverSection', `${docsURL}/Callbacks/onMouseOverSection.md`, {
|
|
66
|
+
fallback: false,
|
|
67
|
+
}),
|
|
68
|
+
value: '.onMouseOverSection',
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export const includes = [
|
|
73
|
+
{
|
|
74
|
+
name: 'Colors.nsh',
|
|
75
|
+
value: 'Colors',
|
|
76
|
+
checked: false,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: terminalLink('FileFunc.nsh', `${docsURL}/Includes/FileFunc`, {
|
|
80
|
+
fallback: false,
|
|
81
|
+
}),
|
|
82
|
+
value: 'FileFunc',
|
|
83
|
+
checked: false,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'InstallOptions.nsh',
|
|
87
|
+
value: 'InstallOptions',
|
|
88
|
+
checked: false,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Integration.nsh',
|
|
92
|
+
value: 'Integration',
|
|
93
|
+
checked: false,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'LangFile.nsh',
|
|
97
|
+
value: 'LangFile',
|
|
98
|
+
checked: false,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Library.nsh',
|
|
102
|
+
value: 'Library',
|
|
103
|
+
checked: false,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: terminalLink('LogicLib.nsh', `${docsURL}/Includes/LogicLib`, {
|
|
107
|
+
fallback: false,
|
|
108
|
+
}),
|
|
109
|
+
value: 'LogicLib',
|
|
110
|
+
checked: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: terminalLink('Memento.nsh', `${docsURL}/Includes/Memento`, {
|
|
114
|
+
fallback: false,
|
|
115
|
+
}),
|
|
116
|
+
value: 'Memento',
|
|
117
|
+
checked: false,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'MUI.nsh',
|
|
121
|
+
value: 'MUI',
|
|
122
|
+
checked: false,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'MUI2.nsh',
|
|
126
|
+
value: 'MUI2',
|
|
127
|
+
checked: false,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'MultiUser.nsh',
|
|
131
|
+
value: 'MultiUser',
|
|
132
|
+
checked: false,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'nsDialogs.nsh',
|
|
136
|
+
value: 'nsDialogs',
|
|
137
|
+
checked: false,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'Sections.nsh',
|
|
141
|
+
value: 'Sections',
|
|
142
|
+
checked: false,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: terminalLink('StrFunc.nsh', `${docsURL}/Includes/StrFunc`, {
|
|
146
|
+
fallback: false,
|
|
147
|
+
}),
|
|
148
|
+
value: 'StrFunc',
|
|
149
|
+
checked: false,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: terminalLink('TextFunc.nsh', `${docsURL}/Includes/TextFunc`, {
|
|
153
|
+
fallback: false,
|
|
154
|
+
}),
|
|
155
|
+
value: 'TextFunc',
|
|
156
|
+
checked: false,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'UpgradeDLL.nsh',
|
|
160
|
+
value: 'UpgradeDLL',
|
|
161
|
+
checked: false,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'Util.nsh',
|
|
165
|
+
value: 'Util',
|
|
166
|
+
checked: false,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'VB6RunTime.nsh',
|
|
170
|
+
value: 'VB6RunTime',
|
|
171
|
+
checked: false,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'VPatchLib.nsh',
|
|
175
|
+
value: 'VPatchLib',
|
|
176
|
+
checked: false,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'WinCore.nsh',
|
|
180
|
+
value: 'WinCore',
|
|
181
|
+
checked: false,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'WinMessages.nsh',
|
|
185
|
+
value: 'WinMessages',
|
|
186
|
+
checked: false,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: terminalLink('WinVer.nsh', `${docsURL}/Includes/WinVer`, {
|
|
190
|
+
fallback: false,
|
|
191
|
+
}),
|
|
192
|
+
value: 'WinVer',
|
|
193
|
+
checked: false,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: terminalLink('WordFunc.nsh', `${docsURL}/Includes/WordFunc`, {
|
|
197
|
+
fallback: false,
|
|
198
|
+
}),
|
|
199
|
+
value: 'WordFunc',
|
|
200
|
+
checked: false,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: terminalLink('x64.nsh', `${docsURL}/Includes/x64`, {
|
|
204
|
+
fallback: false,
|
|
205
|
+
}),
|
|
206
|
+
value: 'x64',
|
|
207
|
+
checked: false,
|
|
208
|
+
},
|
|
209
|
+
];
|
|
210
|
+
|
|
211
|
+
export const pages = [
|
|
212
|
+
{
|
|
213
|
+
name: 'license',
|
|
214
|
+
value: 'license',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'components',
|
|
218
|
+
value: 'components',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: 'directory',
|
|
222
|
+
value: 'directory',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'instfiles',
|
|
226
|
+
value: 'instfiles',
|
|
227
|
+
checked: true,
|
|
228
|
+
},
|
|
229
|
+
];
|
package/lib/helpers.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { basename, extname, resolve } from 'node:path';
|
|
2
|
+
import { meta as languageData } from '@nsis/language-data';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { nsisDir } from 'makensis';
|
|
5
|
+
import spdxLicenseList from 'spdx-license-list/full.js';
|
|
6
|
+
import terminalLink from 'terminal-link';
|
|
7
|
+
import { includes as bundledLibraries } from './choices.js';
|
|
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: true,
|
|
15
|
+
});
|
|
16
|
+
licenses.value = obj;
|
|
17
|
+
|
|
18
|
+
return licenses;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const getAllLibraries = async () => {
|
|
22
|
+
const nsisPath = await nsisDir();
|
|
23
|
+
const includeDir = resolve(nsisPath, 'Include');
|
|
24
|
+
|
|
25
|
+
const headerFiles = await glob([`${includeDir}/*.nsh`, `!${includeDir}/MUI.nsh`], {
|
|
26
|
+
ignore: bundledLibraries.map((excludedFile) => `${includeDir}/${excludedFile.value}.nsh`),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const customHeaders = headerFiles.map((headerFile) => {
|
|
30
|
+
return {
|
|
31
|
+
name: `${basename(headerFile)} [3rd party]`,
|
|
32
|
+
value: basename(headerFile, extname(headerFile)),
|
|
33
|
+
checked: false,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const allLibraries = [...bundledLibraries, ...customHeaders];
|
|
38
|
+
|
|
39
|
+
return allLibraries.sort((a, z) => a.value.localeCompare(z.value));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export function getLanguageChoices(disabled) {
|
|
43
|
+
const languageChoices = Object.entries(languageData).map(([key, value]) => {
|
|
44
|
+
const isDisabled = key === 'English' ? disabled : false;
|
|
45
|
+
|
|
46
|
+
// Use long names
|
|
47
|
+
return {
|
|
48
|
+
name: value.english || key,
|
|
49
|
+
value: key,
|
|
50
|
+
disabled: isDisabled,
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Sort names
|
|
55
|
+
languageChoices.sort((a, z) => {
|
|
56
|
+
if (a.name < z.name) {
|
|
57
|
+
return -1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (a.name > z.name) {
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return 0;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return languageChoices;
|
|
68
|
+
}
|
package/license.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) <year> <copyright holders>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
15
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
16
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
18
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,71 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"lint:ejs": "ejslint generators/**/*.ejs",
|
|
66
|
-
"lint:code": "biome check",
|
|
67
|
-
"lint": "concurrently --prefix '{name}' -c 'green,blue' 'npm:lint:*'",
|
|
68
|
-
"publish:npm": "np --any-branch",
|
|
69
|
-
"test": "uvu --ignore tests/__helper.js"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
2
|
+
"name": "generator-nsis",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "Yeoman generator for NSIS scripts",
|
|
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/index.js",
|
|
16
|
+
"files": [
|
|
17
|
+
"generators",
|
|
18
|
+
"lib",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"lint:e18e": "e18e-cli analyze",
|
|
24
|
+
"lint:code": "biome check",
|
|
25
|
+
"lint": "concurrently --prefix '{name}' -c 'green,blue' 'npm:lint:*'",
|
|
26
|
+
"prepare": "lefthook install",
|
|
27
|
+
"publish:npm": "np --any-branch",
|
|
28
|
+
"test": "uvu --ignore tests/__helper.js"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/idleberg/generator-nsis.git"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=20"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@idleberg/yeoman-generator": "^0.1.1",
|
|
39
|
+
"@nsis/language-data": "^0.9.3",
|
|
40
|
+
"@sindresorhus/slugify": "^3.0.0",
|
|
41
|
+
"glob": "^13.0.0",
|
|
42
|
+
"kleur": "^4.1.5",
|
|
43
|
+
"makensis": "3.0.3",
|
|
44
|
+
"semver": "^7.7.3",
|
|
45
|
+
"spdx-license-list": "^6.11.0",
|
|
46
|
+
"terminal-link": "^5.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@commitlint/cli": "^20.3.1",
|
|
50
|
+
"@commitlint/config-conventional": "^20.3.1",
|
|
51
|
+
"@idleberg/configs": "^0.4.1",
|
|
52
|
+
"@lukeed/uuid": "^2.0.1",
|
|
53
|
+
"@types/node": "^24.5.2",
|
|
54
|
+
"concurrently": "^9.2.1",
|
|
55
|
+
"np": "^10.2.0",
|
|
56
|
+
"tsm": "^2.3.0",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"uvu": "^0.5.6",
|
|
59
|
+
"yeoman-assert": "^3.1.1",
|
|
60
|
+
"yeoman-environment": "^5.1.2",
|
|
61
|
+
"yeoman-test": "^11.2.0"
|
|
62
|
+
},
|
|
63
|
+
"packageManager": "pnpm@10.28.0+sha512.05df71d1421f21399e053fde567cea34d446fa02c76571441bfc1c7956e98e363088982d940465fd34480d4d90a0668bc12362f8aa88000a64e83d0b0e47be48"
|
|
64
|
+
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Generated with generator-nsis
|
|
2
|
-
# https://github.com/idleberg/generator-nsis
|
|
3
|
-
|
|
4
|
-
# Includes ---------------------------------<% pkg.includes?.forEach( include => { %>
|
|
5
|
-
!include "<%= include %>.nsh"<% }); %>
|
|
6
|
-
|
|
7
|
-
# Settings ---------------------------------
|
|
8
|
-
Name "<%- pkg.name %>"<% if (typeof pkg.ampersand_name !== 'undefined') { %> "<%- pkg.ampersand_name %>"<% } %>
|
|
9
|
-
OutFile "<%= pkg.outfile %>.exe"
|
|
10
|
-
Unicode <%= pkg.unicode %>
|
|
11
|
-
SetCompressor <%= pkg.compression %>
|
|
12
|
-
RequestExecutionLevel <%= pkg.elevation %>
|
|
13
|
-
InstallDir "$PROGRAMFILES\<%- pkg.name %>"<% if (!pkg.includes?.includes('MUI2') && pkg.pages?.includes('license')) { %>
|
|
14
|
-
LicenseData "<% if (typeof pkg.spdxLicense !== 'undefined') { %>license.txt<% } %>"<% } %>
|
|
15
|
-
<% if (pkg.includes?.includes('MUI2')) { %>
|
|
16
|
-
# Modern UI --------------------------------<% if (pkg.lifecycles?.includes('MUI.onGUIInit')) { %>
|
|
17
|
-
!define MUI_CUSTOMFUNCTION_GUIINIT "MUI.onGUIInit"<% } %><% if (pkg.lifecycles?.includes('MUI.onUserAbort')) { %>
|
|
18
|
-
!define MUI_CUSTOMFUNCTION_ABORT "MUI.onUserAbort"<% } %>
|
|
19
|
-
<% } %>
|
|
20
|
-
# Pages ------------------------------------
|
|
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
|
-
<% }); %>
|
|
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"<% } %><% }); %>
|
|
26
|
-
|
|
27
|
-
# Sections ---------------------------------<% for (let step = 0; step < parseInt(pkg.sections); step++) { %>
|
|
28
|
-
Section "section" SECTION_<%= step + 1 %>
|
|
29
|
-
SectionEnd
|
|
30
|
-
<% } %><% if (pkg.includes?.includes('MUI2')) { %>
|
|
31
|
-
# Descriptions -----------------------------<% for (let step = 0; step < parseInt(pkg.sections); step++) { %><% if (unlockAll === false) { %>
|
|
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
|
-
<% } %>
|
|
35
|
-
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN<% for (let step = 0; step < parseInt(pkg.sections); step++) { %>
|
|
36
|
-
!insertmacro MUI_DESCRIPTION_TEXT ${SECTION_<%= step + 1 %>} $(DESC_SECTION_<%= step + 1 %>)<% } %>
|
|
37
|
-
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
38
|
-
<% } %>
|
|
39
|
-
# Functions --------------------------------<% pkg.lifecycles?.forEach( lifecycle => { %>
|
|
40
|
-
Function <%- lifecycle %>
|
|
41
|
-
<% if (lifecycle === '.onInit' && pkg.languageDialog) { %> Call LanguageDialog<%= '\n' %><% } %>FunctionEnd
|
|
42
|
-
<% }); %><% if (pkg.languageDialog) { %>
|
|
43
|
-
Function LanguageDialog
|
|
44
|
-
Push ""
|
|
45
|
-
Push ${LANG_ENGLISH}
|
|
46
|
-
Push English<% pkg.languages?.forEach( language => { %>
|
|
47
|
-
Push ${LANG_<%- language.toUpperCase() %>}
|
|
48
|
-
Push "<% if (pkg.unicode) { %><%- languageData[language].native %><% } else { %><%- languageData[language].long || language %><% } %>"<% }); %>
|
|
49
|
-
Push A
|
|
50
|
-
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
|
|
51
|
-
|
|
52
|
-
Pop $LANGUAGE
|
|
53
|
-
StrCmp $LANGUAGE "cancel" 0 +2
|
|
54
|
-
Abort
|
|
55
|
-
FunctionEnd
|
|
56
|
-
<% } %>
|
|
57
|
-
<% JSON.stringify(pkg.lifecycles) %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%- licenseText %>
|