generator-nsis 0.13.1 → 0.14.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,4 +1,4 @@
1
- import { GeneratorCompat as Generator } from '@idleberg/yeoman-generator';
1
+ import { Generator } from '@idleberg/yeoman-generator';
2
2
  import { meta as languageData } from '@nsis/language-data';
3
3
  import slugify from '@sindresorhus/slugify';
4
4
  import { inverse } from 'kleur/colors';
@@ -18,7 +18,6 @@ export default class extends Generator {
18
18
  this.option('unlock-all', { desc: 'Unlocks all disabled features', default: false });
19
19
  this.option('debug', { desc: 'Prints debug messages', default: false });
20
20
 
21
- this.disabled = !this.options.unlockAll;
22
21
  this.outdir = this.options.debug ? '.debug' : '';
23
22
  }
24
23
 
@@ -31,115 +30,118 @@ export default class extends Generator {
31
30
 
32
31
  this.props = await this.prompt([
33
32
  {
33
+ type: 'text',
34
34
  name: 'name',
35
35
  message: 'Application name',
36
36
  default: slugify(this.appname),
37
37
  store: true,
38
- validate: (name) => (name.trim().length > 0 ? true : 'Not a valid name'),
38
+ validate: (name) => (name.trim().length > 0 ? undefined : 'Not a valid name'),
39
39
  },
40
40
  {
41
+ type: 'text',
41
42
  name: 'version',
42
43
  message: 'Application version',
43
44
  default: '0.0.0',
44
45
  store: true,
45
46
  validate: (version) =>
46
47
  this.options.looseVersion || semver.valid(version) !== null
47
- ? true
48
+ ? undefined
48
49
  : `Not a valid ${terminalLink('semantic version', 'https://semver.org', {
49
50
  fallback: false,
50
51
  })}`,
51
52
  },
52
53
  {
54
+ type: 'confirm',
53
55
  name: 'unicode',
54
56
  message: 'Unicode installer',
55
- type: 'confirm',
56
- default: 'true',
57
+ default: true,
57
58
  store: true,
58
59
  },
59
60
  {
61
+ type: 'select',
60
62
  name: 'elevation',
61
63
  message: 'Requested execution level',
62
- type: 'list',
63
64
  default: 'user',
64
65
  store: true,
65
- choices: choices.elevation,
66
+ options: choices.elevation,
66
67
  },
67
68
  {
69
+ type: 'select',
68
70
  name: 'compression',
69
71
  message: 'Set compression',
70
- type: 'list',
71
72
  default: 'lzma',
72
73
  store: true,
73
- choices: choices.compression,
74
+ options: choices.compression,
74
75
  },
75
76
  {
77
+ type: 'multiselect',
76
78
  name: 'pages',
77
79
  message: 'Installer pages',
78
- type: 'checkbox',
79
80
  store: true,
80
81
  default: ['instfiles'],
81
- choices: choices.pages,
82
+ options: choices.pages,
82
83
  },
83
84
  {
85
+ type: 'confirm',
84
86
  name: 'spdxQuestion',
85
87
  message: `Choose a license from ${terminalLink('SPDX License List', 'https://spdx.org/licenses/', {
86
88
  fallback: false,
87
89
  })}`,
88
- type: 'confirm',
89
90
  default: true,
90
91
  store: true,
91
92
  when: (answers) => !!answers.pages?.includes('license'),
92
93
  },
93
94
  {
95
+ type: 'select',
94
96
  name: 'spdxLicense',
95
97
  message: 'Choose a license',
96
- type: 'list',
97
98
  default: 'MIT',
98
- choices: licenseChoices,
99
+ options: licenseChoices,
99
100
  store: true,
100
101
  when: (answers) => !!(answers.pages?.includes('license') && answers.spdxQuestion),
101
102
  },
102
103
  {
104
+ type: 'text',
103
105
  name: 'sections',
104
106
  message: 'Number of sections',
105
107
  default: 1,
106
108
  store: true,
107
109
  validate: (number) =>
108
110
  Number.isInteger(Number.parseInt(number, 10)) && Number.parseInt(number, 10) > 0
109
- ? true
111
+ ? undefined
110
112
  : 'Not a valid integer',
111
113
  },
112
114
  {
115
+ type: 'multiselect',
113
116
  name: 'lifecycles',
114
117
  message: 'Add lifecycle functions',
115
- type: 'checkbox',
116
118
  store: true,
117
119
  default: [],
118
- choices: choices.lifecycles,
120
+ options: choices.lifecycles,
119
121
  },
120
122
  {
123
+ type: 'multiselect',
121
124
  name: 'includes',
122
125
  message: 'Add libraries',
123
- type: 'checkbox',
124
126
  store: true,
125
127
  default: [],
126
- choices: includeChoices,
128
+ options: includeChoices,
127
129
  validate: (lifecycles) =>
128
- lifecycles.includes('MUI') && lifecycles.includes('MUI2') ? "Don't mix MUI versions" : true,
130
+ lifecycles.includes('MUI') && lifecycles.includes('MUI2') ? "Don't mix MUI versions" : undefined,
129
131
  },
130
132
  {
133
+ type: 'multiselect',
131
134
  name: 'languages',
132
- message: this.disabled === true ? 'Add languages other than English' : 'Add languages',
133
- type: 'checkbox',
135
+ message: 'Add languages',
134
136
  store: true,
135
137
  default: [],
136
- choices: getLanguageChoices(this.disabled),
138
+ options: getLanguageChoices(),
137
139
  },
138
140
  {
141
+ type: 'confirm',
139
142
  name: 'languageDialog',
140
143
  message: 'Add language dialog',
141
- type: 'confirm',
142
- default: 'true',
144
+ default: true,
143
145
  store: true,
144
146
  when: (answers) => {
145
147
  switch (true) {
package/lib/choices.js CHANGED
@@ -3,66 +3,66 @@ import terminalLink from 'terminal-link';
3
3
  const docsURL = 'https://github.com/NSIS-Dev/Documentation/tree/main/docs/';
4
4
 
5
5
  export const binary = [false, true];
6
- export const elevation = ['user', 'highest', 'admin', 'none'];
7
- export const compression = ['zlib', 'bzip2', 'lzma'];
6
+ export const elevation = ['user', 'highest', 'admin', 'none'].map((v) => ({ label: v, value: v }));
7
+ export const compression = ['zlib', 'bzip2', 'lzma'].map((v) => ({ label: v, value: v }));
8
8
 
9
9
  export const lifecycles = [
10
10
  {
11
- name: terminalLink('.onInit', `${docsURL}/Callbacks/onInit.md`, {
11
+ label: terminalLink('.onInit', `${docsURL}/Callbacks/onInit.md`, {
12
12
  fallback: false,
13
13
  }),
14
14
  value: '.onInit',
15
15
  },
16
16
  {
17
- name: terminalLink('.onGUIInit', `${docsURL}/Callbacks/onGUIInit.md`, {
17
+ label: terminalLink('.onGUIInit', `${docsURL}/Callbacks/onGUIInit.md`, {
18
18
  fallback: false,
19
19
  }),
20
20
  value: '.onGUIInit',
21
21
  },
22
22
  {
23
- name: terminalLink('.onGUIEnd', `${docsURL}/Callbacks/onGUIEnd.md`, {
23
+ label: terminalLink('.onGUIEnd', `${docsURL}/Callbacks/onGUIEnd.md`, {
24
24
  fallback: false,
25
25
  }),
26
26
  value: '.onGUIEnd',
27
27
  },
28
28
  {
29
- name: terminalLink('.onInstSuccess', `${docsURL}/Callbacks/onInstSuccess.md`, {
29
+ label: terminalLink('.onInstSuccess', `${docsURL}/Callbacks/onInstSuccess.md`, {
30
30
  fallback: false,
31
31
  }),
32
32
  value: '.onInstSuccess',
33
33
  },
34
34
  {
35
- name: terminalLink('.onInstFailed', `${docsURL}/Callbacks/onInstFailed.md`, {
35
+ label: terminalLink('.onInstFailed', `${docsURL}/Callbacks/onInstFailed.md`, {
36
36
  fallback: false,
37
37
  }),
38
38
  value: '.onInstFailed',
39
39
  },
40
40
  {
41
- name: terminalLink('.onUserAbort', `${docsURL}/Callbacks/onUserAbort.md`, {
41
+ label: terminalLink('.onUserAbort', `${docsURL}/Callbacks/onUserAbort.md`, {
42
42
  fallback: false,
43
43
  }),
44
44
  value: '.onUserAbort',
45
45
  },
46
46
  {
47
- name: terminalLink('.onVerifyInstDir', `${docsURL}/Callbacks/onVerifyInstDir.md`, {
47
+ label: terminalLink('.onVerifyInstDir', `${docsURL}/Callbacks/onVerifyInstDir.md`, {
48
48
  fallback: false,
49
49
  }),
50
50
  value: '.onVerifyInstDir',
51
51
  },
52
52
  {
53
- name: terminalLink('.onRebootFailed', `${docsURL}/Callbacks/onRebootFailed.md`, {
53
+ label: terminalLink('.onRebootFailed', `${docsURL}/Callbacks/onRebootFailed.md`, {
54
54
  fallback: false,
55
55
  }),
56
56
  value: '.onRebootFailed',
57
57
  },
58
58
  {
59
- name: terminalLink('.onSelChange', `${docsURL}/Callbacks/onSelChange.md`, {
59
+ label: terminalLink('.onSelChange', `${docsURL}/Callbacks/onSelChange.md`, {
60
60
  fallback: false,
61
61
  }),
62
62
  value: '.onSelChange',
63
63
  },
64
64
  {
65
- name: terminalLink('.onMouseOverSection', `${docsURL}/Callbacks/onMouseOverSection.md`, {
65
+ label: terminalLink('.onMouseOverSection', `${docsURL}/Callbacks/onMouseOverSection.md`, {
66
66
  fallback: false,
67
67
  }),
68
68
  value: '.onMouseOverSection',
@@ -71,159 +71,134 @@ export const lifecycles = [
71
71
 
72
72
  export const includes = [
73
73
  {
74
- name: 'Colors.nsh',
74
+ label: 'Colors.nsh',
75
75
  value: 'Colors',
76
- checked: false,
77
76
  },
78
77
  {
79
- name: terminalLink('FileFunc.nsh', `${docsURL}/Includes/FileFunc`, {
78
+ label: terminalLink('FileFunc.nsh', `${docsURL}/Includes/FileFunc`, {
80
79
  fallback: false,
81
80
  }),
82
81
  value: 'FileFunc',
83
- checked: false,
84
82
  },
85
83
  {
86
- name: 'InstallOptions.nsh',
84
+ label: 'InstallOptions.nsh',
87
85
  value: 'InstallOptions',
88
- checked: false,
89
86
  },
90
87
  {
91
- name: 'Integration.nsh',
88
+ label: 'Integration.nsh',
92
89
  value: 'Integration',
93
- checked: false,
94
90
  },
95
91
  {
96
- name: 'LangFile.nsh',
92
+ label: 'LangFile.nsh',
97
93
  value: 'LangFile',
98
- checked: false,
99
94
  },
100
95
  {
101
- name: 'Library.nsh',
96
+ label: 'Library.nsh',
102
97
  value: 'Library',
103
- checked: false,
104
98
  },
105
99
  {
106
- name: terminalLink('LogicLib.nsh', `${docsURL}/Includes/LogicLib`, {
100
+ label: terminalLink('LogicLib.nsh', `${docsURL}/Includes/LogicLib`, {
107
101
  fallback: false,
108
102
  }),
109
103
  value: 'LogicLib',
110
- checked: false,
111
104
  },
112
105
  {
113
- name: terminalLink('Memento.nsh', `${docsURL}/Includes/Memento`, {
106
+ label: terminalLink('Memento.nsh', `${docsURL}/Includes/Memento`, {
114
107
  fallback: false,
115
108
  }),
116
109
  value: 'Memento',
117
- checked: false,
118
110
  },
119
111
  {
120
- name: 'MUI.nsh',
112
+ label: 'MUI.nsh',
121
113
  value: 'MUI',
122
- checked: false,
123
114
  },
124
115
  {
125
- name: 'MUI2.nsh',
116
+ label: 'MUI2.nsh',
126
117
  value: 'MUI2',
127
- checked: false,
128
118
  },
129
119
  {
130
- name: 'MultiUser.nsh',
120
+ label: 'MultiUser.nsh',
131
121
  value: 'MultiUser',
132
- checked: false,
133
122
  },
134
123
  {
135
- name: 'nsDialogs.nsh',
124
+ label: 'nsDialogs.nsh',
136
125
  value: 'nsDialogs',
137
- checked: false,
138
126
  },
139
127
  {
140
- name: 'Sections.nsh',
128
+ label: 'Sections.nsh',
141
129
  value: 'Sections',
142
- checked: false,
143
130
  },
144
131
  {
145
- name: terminalLink('StrFunc.nsh', `${docsURL}/Includes/StrFunc`, {
132
+ label: terminalLink('StrFunc.nsh', `${docsURL}/Includes/StrFunc`, {
146
133
  fallback: false,
147
134
  }),
148
135
  value: 'StrFunc',
149
- checked: false,
150
136
  },
151
137
  {
152
- name: terminalLink('TextFunc.nsh', `${docsURL}/Includes/TextFunc`, {
138
+ label: terminalLink('TextFunc.nsh', `${docsURL}/Includes/TextFunc`, {
153
139
  fallback: false,
154
140
  }),
155
141
  value: 'TextFunc',
156
- checked: false,
157
142
  },
158
143
  {
159
- name: 'UpgradeDLL.nsh',
144
+ label: 'UpgradeDLL.nsh',
160
145
  value: 'UpgradeDLL',
161
- checked: false,
162
146
  },
163
147
  {
164
- name: 'Util.nsh',
148
+ label: 'Util.nsh',
165
149
  value: 'Util',
166
- checked: false,
167
150
  },
168
151
  {
169
- name: 'VB6RunTime.nsh',
152
+ label: 'VB6RunTime.nsh',
170
153
  value: 'VB6RunTime',
171
- checked: false,
172
154
  },
173
155
  {
174
- name: 'VPatchLib.nsh',
156
+ label: 'VPatchLib.nsh',
175
157
  value: 'VPatchLib',
176
- checked: false,
177
158
  },
178
159
  {
179
- name: 'WinCore.nsh',
160
+ label: 'WinCore.nsh',
180
161
  value: 'WinCore',
181
- checked: false,
182
162
  },
183
163
  {
184
- name: 'WinMessages.nsh',
164
+ label: 'WinMessages.nsh',
185
165
  value: 'WinMessages',
186
- checked: false,
187
166
  },
188
167
  {
189
- name: terminalLink('WinVer.nsh', `${docsURL}/Includes/WinVer`, {
168
+ label: terminalLink('WinVer.nsh', `${docsURL}/Includes/WinVer`, {
190
169
  fallback: false,
191
170
  }),
192
171
  value: 'WinVer',
193
- checked: false,
194
172
  },
195
173
  {
196
- name: terminalLink('WordFunc.nsh', `${docsURL}/Includes/WordFunc`, {
174
+ label: terminalLink('WordFunc.nsh', `${docsURL}/Includes/WordFunc`, {
197
175
  fallback: false,
198
176
  }),
199
177
  value: 'WordFunc',
200
- checked: false,
201
178
  },
202
179
  {
203
- name: terminalLink('x64.nsh', `${docsURL}/Includes/x64`, {
180
+ label: terminalLink('x64.nsh', `${docsURL}/Includes/x64`, {
204
181
  fallback: false,
205
182
  }),
206
183
  value: 'x64',
207
- checked: false,
208
184
  },
209
185
  ];
210
186
 
211
187
  export const pages = [
212
188
  {
213
- name: 'license',
189
+ label: 'license',
214
190
  value: 'license',
215
191
  },
216
192
  {
217
- name: 'components',
193
+ label: 'components',
218
194
  value: 'components',
219
195
  },
220
196
  {
221
- name: 'directory',
197
+ label: 'directory',
222
198
  value: 'directory',
223
199
  },
224
200
  {
225
- name: 'instfiles',
201
+ label: 'instfiles',
226
202
  value: 'instfiles',
227
- checked: true,
228
203
  },
229
204
  ];
package/lib/helpers.js CHANGED
@@ -10,7 +10,7 @@ const spdxCodes = Object.getOwnPropertyNames(spdxLicenseList).sort();
10
10
 
11
11
  export const licenseChoices = spdxCodes.map((obj) => {
12
12
  const licenses = {};
13
- licenses.name = terminalLink(obj, `https://spdx.org/licenses/${obj}.html`, {
13
+ licenses.label = terminalLink(obj, `https://spdx.org/licenses/${obj}.html`, {
14
14
  fallback: true,
15
15
  });
16
16
  licenses.value = obj;
@@ -44,15 +44,11 @@ export const getAllLibraries = async () => {
44
44
  return allLibraries.sort((a, z) => a.value.localeCompare(z.value));
45
45
  };
46
46
 
47
- export function getLanguageChoices(disabled) {
47
+ export function getLanguageChoices() {
48
48
  const languageChoices = Object.entries(languageData).map(([key, value]) => {
49
- const isDisabled = key === 'English' ? disabled : false;
50
-
51
- // Use long names
52
49
  return {
53
- name: value.english || key,
50
+ label: value.english || key,
54
51
  value: key,
55
- disabled: isDisabled,
56
52
  };
57
53
  });
58
54
 
package/package.json CHANGED
@@ -1,61 +1,62 @@
1
1
  {
2
- "name": "generator-nsis",
3
- "version": "0.13.1",
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
- "repository": {
23
- "type": "git",
24
- "url": "git+https://github.com/idleberg/generator-nsis.git"
25
- },
26
- "engines": {
27
- "node": ">=22"
28
- },
29
- "dependencies": {
30
- "@idleberg/yeoman-generator": "^0.1.7",
31
- "@nsis/language-data": "^0.11.0",
32
- "@sindresorhus/slugify": "^3.0.0",
33
- "kleur": "^4.1.5",
34
- "makensis": "3.0.4",
35
- "semver": "^7.7.4",
36
- "spdx-license-list": "^6.11.0",
37
- "terminal-link": "^5.0.0"
38
- },
39
- "devDependencies": {
40
- "@commitlint/cli": "^20.5.0",
41
- "@commitlint/config-conventional": "^20.5.0",
42
- "@idleberg/configs": "^0.4.2",
43
- "@lukeed/uuid": "^2.0.1",
44
- "@types/node": "^24.5.2",
45
- "concurrently": "^9.2.1",
46
- "np": "^11.0.2",
47
- "tsm": "^2.3.0",
48
- "typescript": "^5.9.3",
49
- "uvu": "^0.5.6",
50
- "yeoman-assert": "^3.1.1",
51
- "yeoman-environment": "^6.0.0",
52
- "yeoman-test": "^11.3.1"
53
- },
54
- "scripts": {
55
- "lint:e18e": "e18e-cli analyze",
56
- "lint:code": "biome check",
57
- "lint": "concurrently --prefix '{name}' -c 'green,blue' 'npm:lint:*'",
58
- "publish:npm": "np",
59
- "test": "uvu --ignore tests/__helper.js"
60
- }
61
- }
2
+ "name": "generator-nsis",
3
+ "version": "0.14.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
+ "publish:npm": "np",
27
+ "test": "uvu --ignore tests/__helper.js"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/idleberg/generator-nsis.git"
32
+ },
33
+ "engines": {
34
+ "node": ">=22"
35
+ },
36
+ "dependencies": {
37
+ "@idleberg/yeoman-generator": "^0.3.0",
38
+ "@nsis/language-data": "^0.11.0",
39
+ "@sindresorhus/slugify": "^3.0.0",
40
+ "kleur": "^4.1.5",
41
+ "makensis": "3.0.5",
42
+ "semver": "^7.8.0",
43
+ "spdx-license-list": "^6.11.0",
44
+ "terminal-link": "^5.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "@commitlint/cli": "^21.0.1",
48
+ "@commitlint/config-conventional": "^21.0.1",
49
+ "@idleberg/configs": "^0.4.2",
50
+ "@lukeed/uuid": "^2.0.1",
51
+ "@types/node": "^24.12.0",
52
+ "concurrently": "^9.2.1",
53
+ "np": "^11.2.1",
54
+ "tsm": "^2.3.0",
55
+ "typescript": "^6.0.3",
56
+ "uvu": "^0.5.6",
57
+ "yeoman-assert": "^3.1.1",
58
+ "yeoman-environment": "^6.1.0",
59
+ "yeoman-test": "^11.5.2"
60
+ },
61
+ "packageManager": "pnpm@11.1.3+sha512.c85357fe17ca12dd23dd7071822666dfd7e3cb76fe214e3370b5ea2fb34f2a231185509b63e717f3cd0acb38dd3f8d82bcd5e8172400ae678b70ea4fbed0896d"
62
+ }
package/license.txt DELETED
@@ -1,18 +0,0 @@
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.