generator-nsis 0.10.2 → 0.11.1

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 CHANGED
@@ -1,13 +1,11 @@
1
1
  # generator-nsis
2
2
 
3
+ > A [Yeoman](http://yeoman.io/authoring/user-interactions.html) generator for NSIS scripts.
4
+
3
5
  [![License](https://img.shields.io/github/license/idleberg/generator-nsis?color=blue&style=for-the-badge)](https://github.com/idleberg/generator-nsis/blob/main/LICENSE)
4
6
  [![Version](https://img.shields.io/npm/v/generator-nsis?style=for-the-badge)](https://www.npmjs.org/package/generator-nsis)
5
7
  [![Build](https://img.shields.io/github/actions/workflow/status/idleberg/generator-nsis/default.yml?style=for-the-badge)](https://github.com/idleberg/generator-nsis/actions)
6
8
 
7
- ## Description
8
-
9
- A [Yeoman](http://yeoman.io/authoring/user-interactions.html) generator for NSIS scripts.
10
-
11
9
  ![Screenshot](https://raw.github.com/idleberg/generator-nsis/main/screenshot.png)
12
10
 
13
11
  **Features**
@@ -15,9 +13,11 @@ A [Yeoman](http://yeoman.io/authoring/user-interactions.html) generator for NSIS
15
13
  - Modern UI-aware
16
14
  - adds sections
17
15
  - adds core libraries (”Useful Headers”)
18
- - adds callback functions
16
+ - adds lifecycle functions
19
17
  - adds translations
20
- - adds language dialog
18
+ - adds languages (with optional dialog)
19
+ - defaults to SemVer
20
+ - SPDX license support
21
21
 
22
22
  ## Prerequisites
23
23
 
@@ -29,7 +29,7 @@ $ npm install -g yo
29
29
 
30
30
  ## Installation
31
31
 
32
- Use your preferred package manager to install this generator
32
+ Use your preferred package manager to install this generator
33
33
 
34
34
  ```sh
35
35
  $ npm i generator-nsis -g
@@ -43,12 +43,7 @@ Run the generator and follow its instructions. Use `--help` for available flags.
43
43
  $ yo nsis
44
44
  ```
45
45
 
46
- *“That's all Folks!”*
47
-
48
- ## Related
49
-
50
- - [Yeoman for Atom](https://atom.io/packages/atom-yeoman)
51
- - [Yeoman for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=samverschueren.yo)
46
+ _“That's all Folks!”_
52
47
 
53
48
  ## License
54
49
 
@@ -1,7 +1,7 @@
1
1
  import { meta as languageData } from '@nsis/language-data';
2
2
 
3
- import { getAllLibraries, getLanguageChoices, licenseChoices } from '../lib/helpers.js';
4
- import * as choices from '../lib/choices.js';
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,20 +21,9 @@ 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
-
26
- // languageDialog(isUnicode) {
27
- // const languageDialog = Object.entries(languageData).map(([key, value]) => {
28
- // if (key === 'English') return;
29
24
 
30
- // return {
31
- // constant: `$\{LANG_${key.toUpperCase()}}`,
32
- // string: (isUnicode) ? value.native : (value.long || key)
33
- // };
34
- // });
35
-
36
- // return languageDialog;
37
- // }
25
+ globalThis.console.log(/* let it breathe */);
26
+ }
38
27
 
39
28
  inquirer() {
40
29
  return this.prompt([
@@ -43,20 +32,18 @@ export default class extends Generator {
43
32
  message: `Application name`,
44
33
  default: slugify(this.appname),
45
34
  store: true,
46
- validate: name => (name.trim().length > 0 ? true : 'Not a valid name'),
35
+ validate: (name) => (name.trim().length > 0 ? true : 'Not a valid name'),
47
36
  },
48
37
  {
49
38
  name: 'version',
50
39
  message: `Application version`,
51
40
  default: '0.0.0',
52
41
  store: true,
53
- validate: version =>
42
+ validate: (version) =>
54
43
  this.looseVersion === true || semver.valid(version) !== null
55
44
  ? true
56
45
  : `Not a valid ${terminalLink('semantic version', 'https://semver.org', {
57
- fallback() {
58
- return 'semantic version';
59
- },
46
+ fallback: false,
60
47
  })}`,
61
48
  },
62
49
  {
@@ -93,14 +80,12 @@ export default class extends Generator {
93
80
  {
94
81
  name: 'spdxQuestion',
95
82
  message: `Choose a license from ${terminalLink('SPDX License List', 'https://spdx.org/licenses/', {
96
- fallback() {
97
- return 'SPDX License List';
98
- },
83
+ fallback: false,
99
84
  })}`,
100
85
  type: 'confirm',
101
86
  default: true,
102
87
  store: true,
103
- when: answers => (answers.pages?.includes('license') ? true : false),
88
+ when: (answers) => (answers.pages?.includes('license') ? true : false),
104
89
  },
105
90
  {
106
91
  name: 'spdxLicense',
@@ -109,22 +94,23 @@ export default class extends Generator {
109
94
  default: 'MIT',
110
95
  choices: licenseChoices,
111
96
  store: true,
112
- when: answers => (answers.pages?.includes('license') && answers.spdxQuestion ? true : false),
97
+ when: (answers) => (answers.pages?.includes('license') && answers.spdxQuestion ? true : false),
113
98
  },
114
99
  {
115
100
  name: 'sections',
116
101
  message: 'Number of sections',
117
102
  default: 1,
118
103
  store: true,
119
- validate: number => (Number.isInteger(parseInt(number)) && parseInt(number) > 0 ? true : 'Not a valid integer'),
104
+ validate: (number) =>
105
+ Number.isInteger(parseInt(number)) && parseInt(number) > 0 ? true : 'Not a valid integer',
120
106
  },
121
107
  {
122
- name: 'callbacks',
123
- message: 'Add callback functions',
108
+ name: 'lifecycles',
109
+ message: 'Add lifecycle functions',
124
110
  type: 'checkbox',
125
111
  store: true,
126
112
  default: [],
127
- choices: choices.callbacks,
113
+ choices: choices.lifecycles,
128
114
  },
129
115
  {
130
116
  name: 'includes',
@@ -133,8 +119,8 @@ export default class extends Generator {
133
119
  store: true,
134
120
  default: [],
135
121
  choices: async () => (this.firstParty ? choices.includes : await getAllLibraries()),
136
- validate: callbacks =>
137
- callbacks.includes('MUI') && callbacks.includes('MUI2') ? "Don't mix MUI versions" : true,
122
+ validate: (lifecycles) =>
123
+ lifecycles.includes('MUI') && lifecycles.includes('MUI2') ? "Don't mix MUI versions" : true,
138
124
  },
139
125
  {
140
126
  name: 'languages',
@@ -150,7 +136,7 @@ export default class extends Generator {
150
136
  type: 'confirm',
151
137
  default: 'true',
152
138
  store: true,
153
- when: answers => {
139
+ when: (answers) => {
154
140
  switch (true) {
155
141
  case this.options['unlock-all'] === true && answers.languages?.length > 1:
156
142
  case this.options['unlock-all'] === false && answers.languages?.length > 0:
@@ -161,23 +147,18 @@ export default class extends Generator {
161
147
  }
162
148
  },
163
149
  },
164
- {
165
- name: 'editInstallerScript',
166
- message: 'Edit installer script',
167
- type: 'confirm',
168
- default: 'true',
169
- store: true,
170
- when: () => {
171
- return process.env.EDITOR ? true : false;
172
- },
173
- },
174
- ]).then(async props => {
150
+ ]).then(async (props) => {
175
151
  if (this.options.debug) {
176
- console.log(props);
152
+ globalThis.console.log(props);
177
153
  }
178
154
 
179
155
  if (typeof props.spdxLicense !== 'undefined') {
180
- props.licenseText = spdxLicenseList[props.spdxLicense].licenseText.replace(/\n{3,}/g, '\n\n');
156
+ props.licenseText = spdxLicenseList[props.spdxLicense].licenseText
157
+ // normalize line endings
158
+ .split('\n')
159
+
160
+ // .map(line => line.trim())
161
+ .join(props.unicode ? '\n' : '\r\n');
181
162
  }
182
163
 
183
164
  if (props.name.includes('&')) {
@@ -187,22 +168,22 @@ export default class extends Generator {
187
168
  props.outfile = props.version ? `${slugify(props.name)}-${props.version}-setup` : `${slugify(props.name)}-setup`;
188
169
 
189
170
  if (props.languageDialog) {
190
- if (!props.callbacks.includes('.onInit')) {
191
- props.callbacks.unshift('.onInit');
171
+ if (!props.lifecycles.includes('.onInit')) {
172
+ props.lifecycles.unshift('.onInit');
192
173
  }
193
174
  }
194
175
 
195
176
  if (props.includes?.includes('MUI2')) {
196
- const includesOnGUIInit = props.callbacks.indexOf('.onGUIInit');
177
+ const includesOnGUIInit = props.lifecycles.indexOf('.onGUIInit');
197
178
 
198
179
  if (includesOnGUIInit !== -1) {
199
- props.callbacks.splice(includesOnGUIInit, 1, 'MUI.onGUIInit');
180
+ props.lifecycles.splice(includesOnGUIInit, 1, 'MUI.onGUIInit');
200
181
  }
201
182
 
202
- const includesOnUserAbort = props.callbacks.indexOf('.onUserAbort');
183
+ const includesOnUserAbort = props.lifecycles.indexOf('.onUserAbort');
203
184
 
204
185
  if (includesOnUserAbort !== -1) {
205
- props.callbacks.splice(includesOnUserAbort, 1, 'MUI.onUserAbort');
186
+ props.lifecycles.splice(includesOnUserAbort, 1, 'MUI.onUserAbort');
206
187
  }
207
188
  }
208
189
 
@@ -218,10 +199,6 @@ export default class extends Generator {
218
199
  licenseText: props.licenseText,
219
200
  });
220
201
  }
221
-
222
- if (props.editInstallerScript === true) {
223
- this.spawnCommand(process.env.EDITOR, ['installer.nsi']);
224
- }
225
202
  });
226
203
  }
227
204
  }
@@ -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.callbacks?.includes('MUI.onGUIInit')) { %>
17
- !define MUI_CUSTOMFUNCTION_GUIINIT "MUI.onGUIInit"<% } %><% if (pkg.callbacks?.includes('MUI.onUserAbort')) { %>
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.callbacks?.forEach( callback => { %>
40
- Function <%- callback %>
41
- <% if (callback === '.onInit' && pkg.languageDialog) { %> Call LanguageDialog<%= '\n' %><% } %>FunctionEnd
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.callbacks) %>
57
+ <% JSON.stringify(pkg.lifecycles) %>
package/package.json CHANGED
@@ -1,73 +1,74 @@
1
1
  {
2
- "name": "generator-nsis",
3
- "version": "0.10.2",
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",
16
- "files": [
17
- "generators",
18
- "LICENSE",
19
- "README.md"
20
- ],
21
- "scripts": {
22
- "lint:ejs": "ejslint generators/**/*.ejs",
23
- "lint:js": "eslint generators/**/*.js --ignore-path .gitignore",
24
- "lint:json": "eslint ./*.json --ignore-path .gitignore",
25
- "lint": "npm-run-all --parallel lint:*",
26
- "prepack": "rimraf installer.nsi license.txt",
27
- "prepare": "husky",
28
- "publish": "np --no-yarn",
29
- "test": "uvu --ignore test/__helper.js"
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/idleberg/generator-nsis"
34
- },
35
- "engines": {
36
- "node": ">=18"
37
- },
38
- "dependencies": {
39
- "@nsis/language-data": "^0.9.2",
40
- "@sindresorhus/slugify": "^2.2.1",
41
- "glob": "^10.3.10",
42
- "makensis": "^2.0.8",
43
- "semver": "^7.5.4",
44
- "spdx-license-list": "^6.8.0",
45
- "terminal-link": "^3.0.0",
46
- "yeoman-generator": "^7.1.1"
47
- },
48
- "devDependencies": {
49
- "@lukeed/uuid": "^2.0.1",
50
- "ejs-lint": "^2.0.0",
51
- "eslint": "^8.56.0",
52
- "eslint-plugin-json": "^3.1.0",
53
- "husky": "^9.0.7",
54
- "lint-staged": "^15.2.0",
55
- "mem-fs": "^4.0.0",
56
- "np": "^9.2.0",
57
- "npm-run-all2": "^6.1.1",
58
- "prettier": "^3.2.4",
59
- "rimraf": "^5.0.5",
60
- "tsm": "^2.3.0",
61
- "uvu": "^0.5.6",
62
- "yeoman-assert": "^3.1.1",
63
- "yeoman-environment": "^4.3.0",
64
- "yeoman-test": "^8.2.0"
65
- },
66
- "lint-staged": {
67
- "*.ejs": "ejslint",
68
- "*.(js|json)": [
69
- "eslint --cache --fix",
70
- "prettier --write"
71
- ]
72
- }
73
- }
2
+ "name": "generator-nsis",
3
+ "version": "0.11.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",
16
+ "files": [
17
+ "generators",
18
+ "LICENSE",
19
+ "README.md"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/idleberg/generator-nsis"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "dependencies": {
29
+ "@nsis/language-data": "^0.9.3",
30
+ "@sindresorhus/slugify": "^2.2.1",
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
+ },
38
+ "devDependencies": {
39
+ "@lukeed/uuid": "^2.0.1",
40
+ "@types/node": "^22.15.33",
41
+ "concurrently": "^9.2.0",
42
+ "ejs-lint": "^2.0.1",
43
+ "eslint": "9.29.0",
44
+ "eslint-plugin-jsonc": "^2.20.1",
45
+ "eslint-plugin-unicorn": "^59.0.1",
46
+ "husky": "^9.1.7",
47
+ "lint-staged": "^16.1.2",
48
+ "mem-fs": "^4.1.2",
49
+ "np": "^10.2.0",
50
+ "prettier": "^3.6.1",
51
+ "rimraf": "^6.0.1",
52
+ "tsm": "^2.3.0",
53
+ "typescript": "^5.8.3",
54
+ "typescript-eslint": "8.35.0",
55
+ "uvu": "^0.5.6",
56
+ "yeoman-assert": "^3.1.1",
57
+ "yeoman-environment": "^4.4.3",
58
+ "yeoman-test": "^10.1.1"
59
+ },
60
+ "lint-staged": {
61
+ "*.ejs": "ejslint",
62
+ "*.(js|json)": [
63
+ "eslint --cache --fix",
64
+ "prettier --write"
65
+ ]
66
+ },
67
+ "scripts": {
68
+ "lint:ejs": "ejslint generators/**/*.ejs",
69
+ "lint:code": "eslint **/*.json ./generators/**/*.js --no-warn-ignored",
70
+ "lint": "concurrently --prefix '{name}' -c 'green,blue' 'npm:lint:*'",
71
+ "publish:npm": "np --any-branch",
72
+ "test": "uvu --ignore tests/__helper.js"
73
+ }
74
+ }
@@ -1,293 +0,0 @@
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(
36
- '.onInstSuccess',
37
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onInstSuccess.md',
38
- {
39
- fallback() {
40
- return '.onInstSuccess';
41
- },
42
- }
43
- ),
44
- value: '.onInstSuccess',
45
- },
46
- {
47
- name: terminalLink(
48
- '.onInstFailed',
49
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onInstFailed.md',
50
- {
51
- fallback() {
52
- return '.onInstFailed';
53
- },
54
- }
55
- ),
56
- value: '.onInstFailed',
57
- },
58
- {
59
- name: terminalLink(
60
- '.onUserAbort',
61
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onUserAbort.md',
62
- {
63
- fallback() {
64
- return '.onUserAbort';
65
- },
66
- }
67
- ),
68
- value: '.onUserAbort',
69
- },
70
- {
71
- name: terminalLink(
72
- '.onVerifyInstDir',
73
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onVerifyInstDir.md',
74
- {
75
- fallback() {
76
- return '.onVerifyInstDir';
77
- },
78
- }
79
- ),
80
- value: '.onVerifyInstDir',
81
- },
82
- {
83
- name: terminalLink(
84
- '.onRebootFailed',
85
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onRebootFailed.md',
86
- {
87
- fallback() {
88
- return '.onRebootFailed';
89
- },
90
- }
91
- ),
92
- value: '.onRebootFailed',
93
- },
94
- {
95
- name: terminalLink(
96
- '.onSelChange',
97
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onSelChange.md',
98
- {
99
- fallback() {
100
- return '.onSelChange';
101
- },
102
- }
103
- ),
104
- value: '.onSelChange',
105
- },
106
- {
107
- name: terminalLink(
108
- '.onMouseOverSection',
109
- 'https://github.com/NSIS-Dev/Documentation/blob/master/Callbacks/onMouseOverSection.md',
110
- {
111
- fallback() {
112
- return '.onMouseOverSection';
113
- },
114
- }
115
- ),
116
- value: '.onMouseOverSection',
117
- },
118
- ];
119
-
120
- export const includes = [
121
- {
122
- name: 'Colors.nsh',
123
- value: 'Colors',
124
- checked: false,
125
- },
126
- {
127
- name: terminalLink('FileFunc.nsh', `${docsURL}/Includes/FileFunc`, {
128
- fallback() {
129
- return 'FileFunc.nsh';
130
- },
131
- }),
132
- value: 'FileFunc',
133
- checked: false,
134
- },
135
- {
136
- name: 'InstallOptions.nsh',
137
- value: 'InstallOptions',
138
- checked: false,
139
- },
140
- {
141
- name: 'Integration.nsh',
142
- value: 'Integration',
143
- checked: false,
144
- },
145
- {
146
- name: 'LangFile.nsh',
147
- value: 'LangFile',
148
- checked: false,
149
- },
150
- {
151
- name: 'Library.nsh',
152
- value: 'Library',
153
- checked: false,
154
- },
155
- {
156
- name: terminalLink('LogicLib.nsh', `${docsURL}/Includes/LogicLib`, {
157
- fallback() {
158
- return 'LogicLib.nsh';
159
- },
160
- }),
161
- value: 'LogicLib',
162
- checked: false,
163
- },
164
- {
165
- name: terminalLink('Memento.nsh', `${docsURL}/Includes/Memento`, {
166
- fallback() {
167
- return 'Memento.nsh';
168
- },
169
- }),
170
- value: 'Memento',
171
- checked: false,
172
- },
173
- {
174
- name: 'MUI.nsh',
175
- value: 'MUI',
176
- checked: false,
177
- },
178
- {
179
- name: 'MUI2.nsh',
180
- value: 'MUI2',
181
- checked: false,
182
- },
183
- {
184
- name: 'MultiUser.nsh',
185
- value: 'MultiUser',
186
- checked: false,
187
- },
188
- {
189
- name: 'nsDialogs.nsh',
190
- value: 'nsDialogs',
191
- checked: false,
192
- },
193
- {
194
- name: 'Sections.nsh',
195
- value: 'Sections',
196
- checked: false,
197
- },
198
- {
199
- name: terminalLink('StrFunc.nsh', `${docsURL}/Includes/StrFunc`, {
200
- fallback() {
201
- return 'StrFunc.nsh';
202
- },
203
- }),
204
- value: 'StrFunc',
205
- checked: false,
206
- },
207
- {
208
- name: terminalLink('TextFunc.nsh', `${docsURL}/Includes/TextFunc`, {
209
- fallback() {
210
- return 'TextFunc.nsh';
211
- },
212
- }),
213
- value: 'TextFunc',
214
- checked: false,
215
- },
216
- {
217
- name: 'UpgradeDLL.nsh',
218
- value: 'UpgradeDLL',
219
- checked: false,
220
- },
221
- {
222
- name: 'Util.nsh',
223
- value: 'Util',
224
- checked: false,
225
- },
226
- {
227
- name: 'VB6RunTime.nsh',
228
- value: 'VB6RunTime',
229
- checked: false,
230
- },
231
- {
232
- name: 'VPatchLib.nsh',
233
- value: 'VPatchLib',
234
- checked: false,
235
- },
236
- {
237
- name: 'WinCore.nsh',
238
- value: 'WinCore',
239
- checked: false,
240
- },
241
- {
242
- name: 'WinMessages.nsh',
243
- value: 'WinMessages',
244
- checked: false,
245
- },
246
- {
247
- name: terminalLink('WinVer.nsh', `${docsURL}/Includes/WinVer`, {
248
- fallback() {
249
- return 'WinVer.nsh';
250
- },
251
- }),
252
- value: 'WinVer',
253
- checked: false,
254
- },
255
- {
256
- name: terminalLink('WordFunc.nsh', `${docsURL}/Includes/WordFunc`, {
257
- fallback() {
258
- return 'WordFunc.nsh';
259
- },
260
- }),
261
- value: 'WordFunc',
262
- checked: false,
263
- },
264
- {
265
- name: terminalLink('x64.nsh', `${docsURL}/Includes/x64`, {
266
- fallback() {
267
- return 'x64.nsh';
268
- },
269
- }),
270
- value: 'x64',
271
- checked: false,
272
- },
273
- ];
274
-
275
- export const pages = [
276
- {
277
- name: 'license',
278
- value: 'license',
279
- },
280
- {
281
- name: 'components',
282
- value: 'components',
283
- },
284
- {
285
- name: 'directory',
286
- value: 'directory',
287
- },
288
- {
289
- name: 'instfiles',
290
- value: 'instfiles',
291
- checked: true,
292
- },
293
- ];
@@ -1,70 +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() {
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
- }