generator-nsis 0.11.2 → 0.11.3
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/generators/app/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { meta as languageData } from '@nsis/language-data';
|
|
2
|
-
|
|
3
|
-
import { getAllLibraries, getLanguageChoices, licenseChoices } from '../../lib/helpers.js';
|
|
4
|
-
import * as choices from '../../lib/choices.js';
|
|
5
|
-
import Generator from 'yeoman-generator';
|
|
6
|
-
import semver from 'semver';
|
|
7
2
|
import slugify from '@sindresorhus/slugify';
|
|
3
|
+
import semver from 'semver';
|
|
8
4
|
import spdxLicenseList from 'spdx-license-list/full.js';
|
|
9
5
|
import terminalLink from 'terminal-link';
|
|
6
|
+
import Generator from 'yeoman-generator';
|
|
7
|
+
import * as choices from '../../lib/choices.js';
|
|
8
|
+
import { getAllLibraries, getLanguageChoices, licenseChoices } from '../../lib/helpers.js';
|
|
10
9
|
|
|
11
10
|
export default class extends Generator {
|
|
12
11
|
constructor(args, opts) {
|
|
@@ -17,30 +16,30 @@ export default class extends Generator {
|
|
|
17
16
|
this.option('unlock-all', { desc: 'Unlocks all disabled features', default: false });
|
|
18
17
|
this.option('debug', { desc: 'Prints debug messages', default: false });
|
|
19
18
|
|
|
20
|
-
this.
|
|
21
|
-
this.disabled = this.options.unlockAll ? false : true;
|
|
22
|
-
this.firstParty = this.options.firstParty ? true : false;
|
|
23
|
-
this.debug = this.options.debug ? true : false;
|
|
19
|
+
this.disabled = !this.options.unlockAll;
|
|
24
20
|
|
|
25
21
|
globalThis.console.log(/* let it breathe */);
|
|
26
22
|
}
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
async prompting() {
|
|
25
|
+
// Pre-load async choices for proper storage support
|
|
26
|
+
const includeChoices = this.options.firstParty ? choices.includes : await getAllLibraries();
|
|
27
|
+
|
|
28
|
+
this.props = await this.prompt([
|
|
30
29
|
{
|
|
31
30
|
name: 'name',
|
|
32
|
-
message:
|
|
31
|
+
message: 'Application name',
|
|
33
32
|
default: slugify(this.appname),
|
|
34
33
|
store: true,
|
|
35
34
|
validate: (name) => (name.trim().length > 0 ? true : 'Not a valid name'),
|
|
36
35
|
},
|
|
37
36
|
{
|
|
38
37
|
name: 'version',
|
|
39
|
-
message:
|
|
38
|
+
message: 'Application version',
|
|
40
39
|
default: '0.0.0',
|
|
41
40
|
store: true,
|
|
42
41
|
validate: (version) =>
|
|
43
|
-
this.looseVersion
|
|
42
|
+
this.options.looseVersion || semver.valid(version) !== null
|
|
44
43
|
? true
|
|
45
44
|
: `Not a valid ${terminalLink('semantic version', 'https://semver.org', {
|
|
46
45
|
fallback: false,
|
|
@@ -85,7 +84,7 @@ export default class extends Generator {
|
|
|
85
84
|
type: 'confirm',
|
|
86
85
|
default: true,
|
|
87
86
|
store: true,
|
|
88
|
-
when: (answers) =>
|
|
87
|
+
when: (answers) => !!answers.pages?.includes('license'),
|
|
89
88
|
},
|
|
90
89
|
{
|
|
91
90
|
name: 'spdxLicense',
|
|
@@ -94,7 +93,7 @@ export default class extends Generator {
|
|
|
94
93
|
default: 'MIT',
|
|
95
94
|
choices: licenseChoices,
|
|
96
95
|
store: true,
|
|
97
|
-
when: (answers) => (answers.pages?.includes('license') && answers.spdxQuestion
|
|
96
|
+
when: (answers) => !!(answers.pages?.includes('license') && answers.spdxQuestion),
|
|
98
97
|
},
|
|
99
98
|
{
|
|
100
99
|
name: 'sections',
|
|
@@ -102,7 +101,9 @@ export default class extends Generator {
|
|
|
102
101
|
default: 1,
|
|
103
102
|
store: true,
|
|
104
103
|
validate: (number) =>
|
|
105
|
-
Number.isInteger(parseInt(number)) && parseInt(number) > 0
|
|
104
|
+
Number.isInteger(Number.parseInt(number, 10)) && Number.parseInt(number, 10) > 0
|
|
105
|
+
? true
|
|
106
|
+
: 'Not a valid integer',
|
|
106
107
|
},
|
|
107
108
|
{
|
|
108
109
|
name: 'lifecycles',
|
|
@@ -118,7 +119,7 @@ export default class extends Generator {
|
|
|
118
119
|
type: 'checkbox',
|
|
119
120
|
store: true,
|
|
120
121
|
default: [],
|
|
121
|
-
choices:
|
|
122
|
+
choices: includeChoices,
|
|
122
123
|
validate: (lifecycles) =>
|
|
123
124
|
lifecycles.includes('MUI') && lifecycles.includes('MUI2') ? "Don't mix MUI versions" : true,
|
|
124
125
|
},
|
|
@@ -147,58 +148,62 @@ export default class extends Generator {
|
|
|
147
148
|
}
|
|
148
149
|
},
|
|
149
150
|
},
|
|
150
|
-
])
|
|
151
|
-
|
|
152
|
-
globalThis.console.log(props);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (typeof props.spdxLicense !== 'undefined') {
|
|
156
|
-
props.licenseText = spdxLicenseList[props.spdxLicense].licenseText
|
|
157
|
-
// normalize line endings
|
|
158
|
-
.split('\n')
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
159
153
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
async writing() {
|
|
155
|
+
if (this.options.debug) {
|
|
156
|
+
globalThis.console.log(this.props);
|
|
157
|
+
}
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
if (typeof this.props.spdxLicense !== 'undefined') {
|
|
160
|
+
this.props.licenseText = spdxLicenseList[this.props.spdxLicense].licenseText
|
|
161
|
+
// normalize line endings
|
|
162
|
+
.split('\n')
|
|
167
163
|
|
|
168
|
-
|
|
164
|
+
// .map(line => line.trim())
|
|
165
|
+
.join(this.props.unicode ? '\n' : '\r\n');
|
|
166
|
+
}
|
|
169
167
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}
|
|
168
|
+
if (this.props.name.includes('&')) {
|
|
169
|
+
this.props.ampersand_name = this.props.name.replace('&', '&&');
|
|
170
|
+
}
|
|
175
171
|
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
this.props.outfile = this.props.version
|
|
173
|
+
? `${slugify(this.props.name)}-${this.props.version}-setup`
|
|
174
|
+
: `${slugify(this.props.name)}-setup`;
|
|
178
175
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
if (this.props.languageDialog) {
|
|
177
|
+
if (!this.props.lifecycles.includes('.onInit')) {
|
|
178
|
+
this.props.lifecycles.unshift('.onInit');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
182
181
|
|
|
183
|
-
|
|
182
|
+
if (this.props.includes?.includes('MUI2')) {
|
|
183
|
+
const includesOnGUIInit = this.props.lifecycles.indexOf('.onGUIInit');
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
185
|
+
if (includesOnGUIInit !== -1) {
|
|
186
|
+
this.props.lifecycles.splice(includesOnGUIInit, 1, 'MUI.onGUIInit');
|
|
188
187
|
}
|
|
189
188
|
|
|
190
|
-
|
|
191
|
-
languageData: languageData,
|
|
192
|
-
pkg: props,
|
|
193
|
-
unlockAll: this.options['unlock-all'],
|
|
194
|
-
debug: this.options.debug,
|
|
195
|
-
});
|
|
189
|
+
const includesOnUserAbort = this.props.lifecycles.indexOf('.onUserAbort');
|
|
196
190
|
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
licenseText: props.licenseText,
|
|
200
|
-
});
|
|
191
|
+
if (includesOnUserAbort !== -1) {
|
|
192
|
+
this.props.lifecycles.splice(includesOnUserAbort, 1, 'MUI.onUserAbort');
|
|
201
193
|
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
await this.fs.copyTplAsync(this.templatePath('installer.nsi.ejs'), this.destinationPath('installer.nsi'), {
|
|
197
|
+
languageData: languageData,
|
|
198
|
+
pkg: this.props,
|
|
199
|
+
unlockAll: this.options['unlock-all'],
|
|
200
|
+
debug: this.options.debug,
|
|
202
201
|
});
|
|
202
|
+
|
|
203
|
+
if (typeof this.props.spdxLicense !== 'undefined') {
|
|
204
|
+
await this.fs.copyTplAsync(this.templatePath('license.txt.ejs'), this.destinationPath('license.txt'), {
|
|
205
|
+
licenseText: this.props.licenseText,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
203
208
|
}
|
|
204
209
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# https://github.com/idleberg/generator-nsis
|
|
3
3
|
|
|
4
4
|
# Includes ---------------------------------<% pkg.includes?.forEach( include => { %>
|
|
5
|
-
!include "<%= include
|
|
5
|
+
!include "<%= include %>.nsh"<% }); %>
|
|
6
6
|
|
|
7
7
|
# Settings ---------------------------------
|
|
8
8
|
Name "<%- pkg.name %>"<% if (typeof pkg.ampersand_name !== 'undefined') { %> "<%- pkg.ampersand_name %>"<% } %>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-nsis",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Yeoman generator for NSIS scripts",
|
|
5
5
|
"author": "Jan T. Sott",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,54 +20,50 @@
|
|
|
20
20
|
],
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/idleberg/generator-nsis"
|
|
23
|
+
"url": "git+https://github.com/idleberg/generator-nsis.git"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@nsis/language-data": "^0.9.3",
|
|
30
|
-
"@sindresorhus/slugify": "^
|
|
31
|
-
"glob": "^
|
|
32
|
-
"makensis": "3.0.
|
|
33
|
-
"semver": "^7.7.
|
|
30
|
+
"@sindresorhus/slugify": "^3.0.0",
|
|
31
|
+
"glob": "^13.0.0",
|
|
32
|
+
"makensis": "3.0.3",
|
|
33
|
+
"semver": "^7.7.3",
|
|
34
34
|
"spdx-license-list": "^6.10.0",
|
|
35
|
-
"terminal-link": "^
|
|
35
|
+
"terminal-link": "^5.0.0",
|
|
36
36
|
"yeoman-generator": "^7.5.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
39
|
+
"@commitlint/cli": "^20.2.0",
|
|
40
|
+
"@commitlint/config-conventional": "^20.2.0",
|
|
41
|
+
"@idleberg/configs": "^0.4.1",
|
|
40
42
|
"@lukeed/uuid": "^2.0.1",
|
|
41
|
-
"@types/node": "^
|
|
42
|
-
"concurrently": "^9.2.
|
|
43
|
+
"@types/node": "^24.5.2",
|
|
44
|
+
"concurrently": "^9.2.1",
|
|
43
45
|
"ejs-lint": "^2.0.1",
|
|
44
|
-
"eslint": "9.29.0",
|
|
45
|
-
"eslint-plugin-jsonc": "^2.20.1",
|
|
46
|
-
"eslint-plugin-unicorn": "^59.0.1",
|
|
47
|
-
"husky": "^9.1.7",
|
|
48
|
-
"lint-staged": "^16.1.2",
|
|
49
46
|
"mem-fs": "^4.1.2",
|
|
50
47
|
"np": "^10.2.0",
|
|
51
|
-
"prettier": "^3.
|
|
52
|
-
"rimraf": "^6.
|
|
48
|
+
"prettier": "^3.7.4",
|
|
49
|
+
"rimraf": "^6.1.2",
|
|
53
50
|
"tsm": "^2.3.0",
|
|
54
|
-
"typescript": "^5.
|
|
55
|
-
"typescript-eslint": "8.35.0",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
56
52
|
"uvu": "^0.5.6",
|
|
57
53
|
"yeoman-assert": "^3.1.1",
|
|
58
|
-
"yeoman-environment": "^
|
|
59
|
-
"yeoman-test": "^
|
|
54
|
+
"yeoman-environment": "^5.1.1",
|
|
55
|
+
"yeoman-test": "^11.2.0"
|
|
60
56
|
},
|
|
61
57
|
"lint-staged": {
|
|
62
58
|
"*.ejs": "ejslint",
|
|
63
59
|
"*.(js|json)": [
|
|
64
|
-
"eslint --cache --fix",
|
|
65
60
|
"prettier --write"
|
|
66
61
|
]
|
|
67
62
|
},
|
|
68
63
|
"scripts": {
|
|
64
|
+
"lint:e18e": "#e18e-cli analyze",
|
|
69
65
|
"lint:ejs": "ejslint generators/**/*.ejs",
|
|
70
|
-
"lint:code": "
|
|
66
|
+
"lint:code": "biome check",
|
|
71
67
|
"lint": "concurrently --prefix '{name}' -c 'green,blue' 'npm:lint:*'",
|
|
72
68
|
"publish:npm": "np --any-branch",
|
|
73
69
|
"test": "uvu --ignore tests/__helper.js"
|