generator-nsis 0.11.0 → 0.11.2
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/README.md +4 -4
- package/generators/app/index.js +24 -21
- package/generators/app/templates/installer.nsi.ejs +6 -6
- package/package.json +29 -25
- package/generators/lib/choices.js +0 -229
- package/generators/lib/helpers.js +0 -68
package/README.md
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
- Modern UI-aware
|
|
14
14
|
- adds sections
|
|
15
15
|
- adds core libraries (”Useful Headers”)
|
|
16
|
-
- adds
|
|
16
|
+
- adds lifecycle functions
|
|
17
17
|
- adds translations
|
|
18
18
|
- adds languages (with optional dialog)
|
|
19
19
|
- defaults to SemVer
|
|
20
20
|
- SPDX license support
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
## Prerequisites
|
|
23
23
|
|
|
24
24
|
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.
|
|
@@ -29,7 +29,7 @@ $ npm install -g yo
|
|
|
29
29
|
|
|
30
30
|
## Installation
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Use your preferred package manager to install this generator
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
35
|
$ npm i generator-nsis -g
|
|
@@ -43,7 +43,7 @@ Run the generator and follow its instructions. Use `--help` for available flags.
|
|
|
43
43
|
$ yo nsis
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
_“That's all Folks!”_
|
|
47
47
|
|
|
48
48
|
## License
|
|
49
49
|
|
package/generators/app/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { meta as languageData } from '@nsis/language-data';
|
|
2
2
|
|
|
3
|
-
import { getAllLibraries, getLanguageChoices, licenseChoices } from '
|
|
4
|
-
import * as choices from '
|
|
3
|
+
import { getAllLibraries, getLanguageChoices, licenseChoices } from '../../lib/helpers.js';
|
|
4
|
+
import * as choices from '../../lib/choices.js';
|
|
5
5
|
import Generator from 'yeoman-generator';
|
|
6
6
|
import semver from 'semver';
|
|
7
7
|
import slugify from '@sindresorhus/slugify';
|
|
@@ -21,6 +21,8 @@ export default class extends Generator {
|
|
|
21
21
|
this.disabled = this.options.unlockAll ? false : true;
|
|
22
22
|
this.firstParty = this.options.firstParty ? true : false;
|
|
23
23
|
this.debug = this.options.debug ? true : false;
|
|
24
|
+
|
|
25
|
+
globalThis.console.log(/* let it breathe */);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
inquirer() {
|
|
@@ -30,14 +32,14 @@ export default class extends Generator {
|
|
|
30
32
|
message: `Application name`,
|
|
31
33
|
default: slugify(this.appname),
|
|
32
34
|
store: true,
|
|
33
|
-
validate: name => (name.trim().length > 0 ? true : 'Not a valid name'),
|
|
35
|
+
validate: (name) => (name.trim().length > 0 ? true : 'Not a valid name'),
|
|
34
36
|
},
|
|
35
37
|
{
|
|
36
38
|
name: 'version',
|
|
37
39
|
message: `Application version`,
|
|
38
40
|
default: '0.0.0',
|
|
39
41
|
store: true,
|
|
40
|
-
validate: version =>
|
|
42
|
+
validate: (version) =>
|
|
41
43
|
this.looseVersion === true || semver.valid(version) !== null
|
|
42
44
|
? true
|
|
43
45
|
: `Not a valid ${terminalLink('semantic version', 'https://semver.org', {
|
|
@@ -83,7 +85,7 @@ export default class extends Generator {
|
|
|
83
85
|
type: 'confirm',
|
|
84
86
|
default: true,
|
|
85
87
|
store: true,
|
|
86
|
-
when: answers => (answers.pages?.includes('license') ? true : false),
|
|
88
|
+
when: (answers) => (answers.pages?.includes('license') ? true : false),
|
|
87
89
|
},
|
|
88
90
|
{
|
|
89
91
|
name: 'spdxLicense',
|
|
@@ -92,22 +94,23 @@ export default class extends Generator {
|
|
|
92
94
|
default: 'MIT',
|
|
93
95
|
choices: licenseChoices,
|
|
94
96
|
store: true,
|
|
95
|
-
when: answers => (answers.pages?.includes('license') && answers.spdxQuestion ? true : false),
|
|
97
|
+
when: (answers) => (answers.pages?.includes('license') && answers.spdxQuestion ? true : false),
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
100
|
name: 'sections',
|
|
99
101
|
message: 'Number of sections',
|
|
100
102
|
default: 1,
|
|
101
103
|
store: true,
|
|
102
|
-
validate:
|
|
104
|
+
validate: (number) =>
|
|
105
|
+
Number.isInteger(parseInt(number)) && parseInt(number) > 0 ? true : 'Not a valid integer',
|
|
103
106
|
},
|
|
104
107
|
{
|
|
105
|
-
name: '
|
|
106
|
-
message: 'Add
|
|
108
|
+
name: 'lifecycles',
|
|
109
|
+
message: 'Add lifecycle functions',
|
|
107
110
|
type: 'checkbox',
|
|
108
111
|
store: true,
|
|
109
112
|
default: [],
|
|
110
|
-
choices: choices.
|
|
113
|
+
choices: choices.lifecycles,
|
|
111
114
|
},
|
|
112
115
|
{
|
|
113
116
|
name: 'includes',
|
|
@@ -116,8 +119,8 @@ export default class extends Generator {
|
|
|
116
119
|
store: true,
|
|
117
120
|
default: [],
|
|
118
121
|
choices: async () => (this.firstParty ? choices.includes : await getAllLibraries()),
|
|
119
|
-
validate:
|
|
120
|
-
|
|
122
|
+
validate: (lifecycles) =>
|
|
123
|
+
lifecycles.includes('MUI') && lifecycles.includes('MUI2') ? "Don't mix MUI versions" : true,
|
|
121
124
|
},
|
|
122
125
|
{
|
|
123
126
|
name: 'languages',
|
|
@@ -133,7 +136,7 @@ export default class extends Generator {
|
|
|
133
136
|
type: 'confirm',
|
|
134
137
|
default: 'true',
|
|
135
138
|
store: true,
|
|
136
|
-
when: answers => {
|
|
139
|
+
when: (answers) => {
|
|
137
140
|
switch (true) {
|
|
138
141
|
case this.options['unlock-all'] === true && answers.languages?.length > 1:
|
|
139
142
|
case this.options['unlock-all'] === false && answers.languages?.length > 0:
|
|
@@ -144,9 +147,9 @@ export default class extends Generator {
|
|
|
144
147
|
}
|
|
145
148
|
},
|
|
146
149
|
},
|
|
147
|
-
]).then(async props => {
|
|
150
|
+
]).then(async (props) => {
|
|
148
151
|
if (this.options.debug) {
|
|
149
|
-
console.log(props);
|
|
152
|
+
globalThis.console.log(props);
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
if (typeof props.spdxLicense !== 'undefined') {
|
|
@@ -165,22 +168,22 @@ export default class extends Generator {
|
|
|
165
168
|
props.outfile = props.version ? `${slugify(props.name)}-${props.version}-setup` : `${slugify(props.name)}-setup`;
|
|
166
169
|
|
|
167
170
|
if (props.languageDialog) {
|
|
168
|
-
if (!props.
|
|
169
|
-
props.
|
|
171
|
+
if (!props.lifecycles.includes('.onInit')) {
|
|
172
|
+
props.lifecycles.unshift('.onInit');
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
if (props.includes?.includes('MUI2')) {
|
|
174
|
-
const includesOnGUIInit = props.
|
|
177
|
+
const includesOnGUIInit = props.lifecycles.indexOf('.onGUIInit');
|
|
175
178
|
|
|
176
179
|
if (includesOnGUIInit !== -1) {
|
|
177
|
-
props.
|
|
180
|
+
props.lifecycles.splice(includesOnGUIInit, 1, 'MUI.onGUIInit');
|
|
178
181
|
}
|
|
179
182
|
|
|
180
|
-
const includesOnUserAbort = props.
|
|
183
|
+
const includesOnUserAbort = props.lifecycles.indexOf('.onUserAbort');
|
|
181
184
|
|
|
182
185
|
if (includesOnUserAbort !== -1) {
|
|
183
|
-
props.
|
|
186
|
+
props.lifecycles.splice(includesOnUserAbort, 1, 'MUI.onUserAbort');
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
|
|
@@ -13,8 +13,8 @@ RequestExecutionLevel <%= pkg.elevation %>
|
|
|
13
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
15
|
<% if (pkg.includes?.includes('MUI2')) { %>
|
|
16
|
-
# Modern UI --------------------------------<% if (pkg.
|
|
17
|
-
!define MUI_CUSTOMFUNCTION_GUIINIT "MUI.onGUIInit"<% } %><% if (pkg.
|
|
16
|
+
# Modern UI --------------------------------<% if (pkg.lifecycles?.includes('MUI.onGUIInit')) { %>
|
|
17
|
+
!define MUI_CUSTOMFUNCTION_GUIINIT "MUI.onGUIInit"<% } %><% if (pkg.lifecycles?.includes('MUI.onUserAbort')) { %>
|
|
18
18
|
!define MUI_CUSTOMFUNCTION_ABORT "MUI.onUserAbort"<% } %>
|
|
19
19
|
<% } %>
|
|
20
20
|
# Pages ------------------------------------
|
|
@@ -36,9 +36,9 @@ LangString DESC_SECTION_<%= step + 1 %> ${LANG_<%= language.toUpperCase() %>} "<
|
|
|
36
36
|
!insertmacro MUI_DESCRIPTION_TEXT ${SECTION_<%= step + 1 %>} $(DESC_SECTION_<%= step + 1 %>)<% } %>
|
|
37
37
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
38
38
|
<% } %>
|
|
39
|
-
# Functions --------------------------------<% pkg.
|
|
40
|
-
Function <%-
|
|
41
|
-
<% if (
|
|
39
|
+
# Functions --------------------------------<% pkg.lifecycles?.forEach( lifecycle => { %>
|
|
40
|
+
Function <%- lifecycle %>
|
|
41
|
+
<% if (lifecycle === '.onInit' && pkg.languageDialog) { %> Call LanguageDialog<%= '\n' %><% } %>FunctionEnd
|
|
42
42
|
<% }); %><% if (pkg.languageDialog) { %>
|
|
43
43
|
Function LanguageDialog
|
|
44
44
|
Push ""
|
|
@@ -54,4 +54,4 @@ Function LanguageDialog
|
|
|
54
54
|
Abort
|
|
55
55
|
FunctionEnd
|
|
56
56
|
<% } %>
|
|
57
|
-
<% JSON.stringify(pkg.
|
|
57
|
+
<% JSON.stringify(pkg.lifecycles) %>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-nsis",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Yeoman generator for NSIS scripts",
|
|
5
5
|
"author": "Jan T. Sott",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,32 +26,37 @@
|
|
|
26
26
|
"node": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@nsis/language-data": "^0.9.
|
|
29
|
+
"@nsis/language-data": "^0.9.3",
|
|
30
30
|
"@sindresorhus/slugify": "^2.2.1",
|
|
31
|
-
"glob": "^
|
|
32
|
-
"makensis": "
|
|
33
|
-
"semver": "^7.
|
|
34
|
-
"spdx-license-list": "^6.
|
|
35
|
-
"terminal-link": "^
|
|
36
|
-
"yeoman-generator": "^7.
|
|
31
|
+
"glob": "^11.0.3",
|
|
32
|
+
"makensis": "3.0.0",
|
|
33
|
+
"semver": "^7.7.2",
|
|
34
|
+
"spdx-license-list": "^6.10.0",
|
|
35
|
+
"terminal-link": "^4.0.0",
|
|
36
|
+
"yeoman-generator": "^7.5.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@eslint/js": "^9.29.0",
|
|
39
40
|
"@lukeed/uuid": "^2.0.1",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
41
|
+
"@types/node": "^22.15.33",
|
|
42
|
+
"concurrently": "^9.2.0",
|
|
43
|
+
"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
|
+
"mem-fs": "^4.1.2",
|
|
50
|
+
"np": "^10.2.0",
|
|
51
|
+
"prettier": "^3.6.1",
|
|
52
|
+
"rimraf": "^6.0.1",
|
|
50
53
|
"tsm": "^2.3.0",
|
|
54
|
+
"typescript": "^5.8.3",
|
|
55
|
+
"typescript-eslint": "8.35.0",
|
|
51
56
|
"uvu": "^0.5.6",
|
|
52
57
|
"yeoman-assert": "^3.1.1",
|
|
53
|
-
"yeoman-environment": "^4.4.
|
|
54
|
-
"yeoman-test": "^
|
|
58
|
+
"yeoman-environment": "^4.4.3",
|
|
59
|
+
"yeoman-test": "^10.1.1"
|
|
55
60
|
},
|
|
56
61
|
"lint-staged": {
|
|
57
62
|
"*.ejs": "ejslint",
|
|
@@ -60,12 +65,11 @@
|
|
|
60
65
|
"prettier --write"
|
|
61
66
|
]
|
|
62
67
|
},
|
|
63
|
-
"packageManager": "pnpm@8.15.2+sha256.90bb5d6382cb2cb8b8d4959a076b3953d84d1d94121717097bcd41c71344fa14",
|
|
64
68
|
"scripts": {
|
|
65
69
|
"lint:ejs": "ejslint generators/**/*.ejs",
|
|
66
|
-
"lint:
|
|
67
|
-
"lint
|
|
68
|
-
"
|
|
69
|
-
"test": "uvu --ignore
|
|
70
|
+
"lint:code": "eslint **/*.json ./generators/**/*.js --no-warn-ignored",
|
|
71
|
+
"lint": "concurrently --prefix '{name}' -c 'green,blue' 'npm:lint:*'",
|
|
72
|
+
"publish:npm": "np --any-branch",
|
|
73
|
+
"test": "uvu --ignore tests/__helper.js"
|
|
70
74
|
}
|
|
71
75
|
}
|
|
@@ -1,229 +0,0 @@
|
|
|
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 callbacks = [
|
|
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
|
-
];
|
|
@@ -1,68 +0,0 @@
|
|
|
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: 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
|
-
}
|