electron-forge-maker-innosetup 0.2.9

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +360 -0
  3. package/dist/MakerInnosetup.d.ts +63 -0
  4. package/dist/MakerInnosetup.js +424 -0
  5. package/dist/generator.d.ts +82 -0
  6. package/dist/generator.js +495 -0
  7. package/dist/index.d.ts +5 -0
  8. package/dist/index.js +29 -0
  9. package/dist/parser.d.ts +83 -0
  10. package/dist/parser.js +494 -0
  11. package/dist/types.d.ts +607 -0
  12. package/dist/types.js +5 -0
  13. package/package.json +50 -0
  14. package/vendor/.gitkeep +2 -0
  15. package/vendor/innosetup/Default.isl +384 -0
  16. package/vendor/innosetup/ISCC.exe +0 -0
  17. package/vendor/innosetup/ISCmplr.dll +0 -0
  18. package/vendor/innosetup/ISPPBuiltins.iss +323 -0
  19. package/vendor/innosetup/Languages/Armenian.isl +376 -0
  20. package/vendor/innosetup/Languages/BrazilianPortuguese.isl +384 -0
  21. package/vendor/innosetup/Languages/Bulgarian.isl +382 -0
  22. package/vendor/innosetup/Languages/Catalan.isl +371 -0
  23. package/vendor/innosetup/Languages/ChineseSimplified.isl +420 -0
  24. package/vendor/innosetup/Languages/Corsican.isl +399 -0
  25. package/vendor/innosetup/Languages/Czech.isl +378 -0
  26. package/vendor/innosetup/Languages/Danish.isl +379 -0
  27. package/vendor/innosetup/Languages/Dutch.isl +359 -0
  28. package/vendor/innosetup/Languages/Finnish.isl +359 -0
  29. package/vendor/innosetup/Languages/French.isl +404 -0
  30. package/vendor/innosetup/Languages/German.isl +406 -0
  31. package/vendor/innosetup/Languages/Hebrew.isl +377 -0
  32. package/vendor/innosetup/Languages/Icelandic.isl +361 -0
  33. package/vendor/innosetup/Languages/Italian.isl +390 -0
  34. package/vendor/innosetup/Languages/Japanese.isl +367 -0
  35. package/vendor/innosetup/Languages/Norwegian.isl +378 -0
  36. package/vendor/innosetup/Languages/Polish.isl +377 -0
  37. package/vendor/innosetup/Languages/Portuguese.isl +366 -0
  38. package/vendor/innosetup/Languages/Russian.isl +370 -0
  39. package/vendor/innosetup/Languages/Slovak.isl +385 -0
  40. package/vendor/innosetup/Languages/Slovenian.isl +370 -0
  41. package/vendor/innosetup/Languages/Spanish.isl +383 -0
  42. package/vendor/innosetup/Languages/Turkish.isl +384 -0
  43. package/vendor/innosetup/Languages/Ukrainian.isl +385 -0
  44. package/vendor/innosetup/WizClassicImage-IS.bmp +0 -0
  45. package/vendor/innosetup/WizClassicImage.bmp +0 -0
  46. package/vendor/innosetup/WizClassicSmallImage-IS.bmp +0 -0
  47. package/vendor/innosetup/WizClassicSmallImage.bmp +0 -0
  48. package/vendor/innosetup/isbunzip.dll +0 -0
  49. package/vendor/innosetup/isbzip.dll +0 -0
  50. package/vendor/innosetup/islzma.dll +0 -0
  51. package/vendor/innosetup/islzma32.exe +0 -0
  52. package/vendor/innosetup/islzma64.exe +0 -0
  53. package/vendor/innosetup/isscint.dll +0 -0
  54. package/vendor/innosetup/isunzlib.dll +0 -0
  55. package/vendor/innosetup/iszlib.dll +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Electron Forge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,360 @@
1
+ # @electron-forge/maker-innosetup
2
+
3
+ 一个用于 [Electron Forge](https://www.electronforge.io/) 的 Innosetup Maker,支持使用 Innosetup 为 Windows 平台创建安装程序。继承自 `@electron-forge/maker-base`。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install --save-dev @electron-forge/maker-innosetup
9
+ ```
10
+
11
+ ## 前置要求
12
+
13
+ ### 选项一:使用内置便携版(推荐)
14
+
15
+ 将 Innosetup 便携版放置在 `vendor/innosetup/` 目录:
16
+
17
+ ```
18
+ vendor/
19
+ └── innosetup/
20
+ ├── ISCC.exe
21
+ ├── ISCmplr.dll
22
+ ├── Default.isl
23
+ └── Languages/
24
+ ```
25
+
26
+ ### 选项二:系统安装
27
+
28
+ 需要在 Windows 系统上安装 [Innosetup](https://jrsoftware.org/isinfo.php)。
29
+
30
+ ## 使用方法
31
+
32
+ ### 导入方式
33
+
34
+ ```typescript
35
+ // 命名导入(推荐)
36
+ import { MakerInnosetup } from "@electron-forge/maker-innosetup";
37
+
38
+ // 默认导入
39
+ import MakerInnosetup from "@electron-forge/maker-innosetup";
40
+
41
+ // 导入解析器
42
+ import {
43
+ MakerInnosetup,
44
+ InnoScriptParser,
45
+ } from "@electron-forge/maker-innosetup";
46
+ ```
47
+
48
+ ### 方式一:在配置文件中使用(推荐)
49
+
50
+ 在 `forge.config.ts` 中:
51
+
52
+ ```typescript
53
+ import type { ForgeConfig } from "@electron-forge/shared-types";
54
+ import MakerInnosetup from "@electron-forge/maker-innosetup";
55
+
56
+ const config: ForgeConfig = {
57
+ makers: [
58
+ new MakerInnosetup(
59
+ {
60
+ appName: "MyApp",
61
+ appPublisher: "My Company",
62
+ setupIconFile: "./assets/icon.ico",
63
+ createDesktopIcon: true,
64
+ },
65
+ ["win32"]
66
+ ),
67
+ ],
68
+ };
69
+
70
+ export default config;
71
+ ```
72
+
73
+ ### 方式二:使用配置对象
74
+
75
+ 在 `forge.config.js` 中:
76
+
77
+ ```javascript
78
+ module.exports = {
79
+ makers: [
80
+ {
81
+ name: "@electron-forge/maker-innosetup",
82
+ config: {
83
+ appName: "MyApp",
84
+ appPublisher: "My Company",
85
+ setupIconFile: "./assets/icon.ico",
86
+ },
87
+ },
88
+ ],
89
+ };
90
+ ```
91
+
92
+ ### 完整配置示例
93
+
94
+ ```typescript
95
+ import type { MakerInnosetupConfig } from "@electron-forge/maker-innosetup";
96
+
97
+ const config: MakerInnosetupConfig = {
98
+ // 应用信息
99
+ appName: "MyApp",
100
+ appVersion: "1.0.0",
101
+ appPublisher: "My Company",
102
+ appId: "{{MyUniqueAppId}}",
103
+
104
+ // 文件路径
105
+ setupIconFile: "./assets/icon.ico",
106
+ licenseFile: "./LICENSE",
107
+
108
+ // 输出配置
109
+ outputDir: "./out/installers",
110
+
111
+ // 快捷方式
112
+ createDesktopIcon: true,
113
+ createQuickLaunchIcon: false,
114
+
115
+ // Innosetup 编译器路径(可选,会自动查找)
116
+ innosetupPath: "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe",
117
+
118
+ // 完整的 Innosetup 配置
119
+ config: {
120
+ Setup: {
121
+ AppName: "MyApp",
122
+ AppVersion: "1.0.0",
123
+ AppPublisher: "My Company",
124
+ AppPublisherURL: "https://mycompany.com",
125
+ DefaultDirName: "{autopf}\\MyApp",
126
+ DefaultGroupName: "MyApp",
127
+ Compression: "lzma2",
128
+ SolidCompression: true,
129
+ ArchitecturesAllowed: "x64",
130
+ ArchitecturesInstallIn64BitMode: "x64",
131
+ PrivilegesRequired: "admin",
132
+ WizardStyle: "modern",
133
+ },
134
+ Languages: [
135
+ {
136
+ Name: "english",
137
+ MessagesFile: "compiler:Default.isl",
138
+ },
139
+ {
140
+ Name: "chinesesimplified",
141
+ MessagesFile: "compiler:Languages\\ChineseSimplified.isl",
142
+ },
143
+ ],
144
+ Tasks: [
145
+ {
146
+ Name: "desktopicon",
147
+ Description: "Create a desktop icon",
148
+ GroupDescription: "Additional icons:",
149
+ },
150
+ ],
151
+ Files: [
152
+ {
153
+ Source: "{src}\\*",
154
+ DestDir: "{app}",
155
+ Flags: "ignoreversion recursesubdirs createallsubdirs",
156
+ },
157
+ ],
158
+ Icons: [
159
+ {
160
+ Name: "{group}\\MyApp",
161
+ Filename: "{app}\\MyApp.exe",
162
+ },
163
+ {
164
+ Name: "{autodesktop}\\MyApp",
165
+ Filename: "{app}\\MyApp.exe",
166
+ Tasks: "desktopicon",
167
+ },
168
+ ],
169
+ Run: [
170
+ {
171
+ Filename: "{app}\\MyApp.exe",
172
+ Description: "Launch MyApp",
173
+ Flags: "nowait postinstall skipifsilent",
174
+ },
175
+ ],
176
+ },
177
+ };
178
+ ```
179
+
180
+ ### 使用自定义 Innosetup 脚本
181
+
182
+ 如果您已有现成的 `.iss` 脚本文件:
183
+
184
+ #### 方法 1: 直接使用 ISS 文件
185
+
186
+ ```javascript
187
+ {
188
+ name: '@electron-forge/maker-innosetup',
189
+ config: {
190
+ scriptPath: './installer.iss'
191
+ }
192
+ }
193
+
194
+ ```
195
+
196
+ #### 方法 2: 解析 ISS 文件为配置
197
+
198
+ ```typescript
199
+ import { MakerInnosetup } from "@electron-forge/maker-innosetup";
200
+
201
+ // 从 ISS 文件解析配置
202
+ const config = MakerInnosetup.fromIssFile("./installer.iss");
203
+
204
+ // 或者从 ISS 内容解析
205
+ const issContent = fs.readFileSync("./installer.iss", "utf-8");
206
+ const config2 = MakerInnosetup.fromIssContent(issContent);
207
+
208
+ // 使用在 forge 配置中
209
+ const forgeConfig: ForgeConfig = {
210
+ makers: [
211
+ {
212
+ name: "@electron-forge/maker-innosetup",
213
+ config: config, // 使用解析后的配置
214
+ platforms: ["win32"],
215
+ },
216
+ ],
217
+ };
218
+ ```
219
+
220
+ > 📝 **详细文档**: 查看 [iss-parser.md](./docs/iss-parser.md) 了解 ISS 解析器的完整使用方法
221
+
222
+ > ⚠️ **重要**: 如果你的 ISS 脚本中定义了 `OutputDir`,Maker 会自动解析并在正确的目录中查找安装包。详见 [custom-script-output.md](./docs/custom-script-output.md)
223
+
224
+ ## 配置选项
225
+
226
+ ### MakerInnosetupConfig
227
+
228
+ | 选项 | 类型 | 默认值 | 说明 |
229
+ | ----------------------- | ----------------- | ------------------ | --------------------------------------- |
230
+ | `config` | `InnoSetupConfig` | - | 完整的 Innosetup 配置对象 |
231
+ | `scriptPath` | `string` | - | 自定义脚本路径(如果提供则忽略 config) |
232
+ | `innosetupPath` | `string` | 自动查找 | Innosetup 编译器路径 |
233
+ | `outputDir` | `string` | `./out/installers` | 输出目录 |
234
+ | `appName` | `string` | - | 应用程序名称 |
235
+ | `appVersion` | `string` | - | 应用程序版本 |
236
+ | `appPublisher` | `string` | - | 应用程序发布者 |
237
+ | `appId` | `string` | - | 应用程序唯一 ID |
238
+ | `licenseFile` | `string` | - | 许可证文件路径 |
239
+ | `setupIconFile` | `string` | - | 安装图标文件路径 |
240
+ | `createDesktopIcon` | `boolean` | `false` | 是否创建桌面图标 |
241
+ | `createQuickLaunchIcon` | `boolean` | `false` | 是否创建快速启动图标 |
242
+ | `gui` | `boolean` | `false` | 是否使用 GUI 模式编译 |
243
+ | `isccOptions` | `string[]` | - | 额外的 ISCC 命令行参数 |
244
+
245
+ ### InnoSetupConfig
246
+
247
+ 完整的 Innosetup 配置类型支持,包括以下部分:
248
+
249
+ - `Setup` - 安装配置
250
+ - `Languages` - 语言支持
251
+ - `Types` - 安装类型
252
+ - `Components` - 组件选项
253
+ - `Tasks` - 任务选项
254
+ - `Files` - 文件安装
255
+ - `Dirs` - 目录创建
256
+ - `Icons` - 快捷方式
257
+ - `Registry` - 注册表项
258
+ - `Run` - 安装后运行
259
+ - `UninstallRun` - 卸载时运行
260
+ - `InstallDelete` - 安装时删除
261
+ - `UninstallDelete` - 卸载时删除
262
+ - `INI` - INI 文件操作
263
+ - `Messages` - 自定义消息
264
+ - `CustomMessages` - 自定义消息
265
+ - `Code` - Pascal Script 代码
266
+
267
+ 所有配置项都有完整的 TypeScript 类型提示和文档。
268
+
269
+ ## 高级用法
270
+
271
+ ### 添加自定义 Pascal 代码
272
+
273
+ ```typescript
274
+ config: {
275
+ config: {
276
+ Code: `
277
+ function InitializeSetup(): Boolean;
278
+ begin
279
+ Result := True;
280
+ // 自定义初始化逻辑
281
+ end;
282
+
283
+ procedure CurStepChanged(CurStep: TSetupStep);
284
+ begin
285
+ if CurStep = ssPostInstall then
286
+ begin
287
+ // 安装后的自定义操作
288
+ end;
289
+ end;
290
+ `;
291
+ }
292
+ }
293
+ ```
294
+
295
+ ### 注册表操作
296
+
297
+ ```typescript
298
+ config: {
299
+ config: {
300
+ Registry: [
301
+ {
302
+ Root: "HKLM",
303
+ Subkey: "Software\\MyApp",
304
+ ValueType: "string",
305
+ ValueName: "InstallPath",
306
+ ValueData: "{app}",
307
+ Flags: "uninsdeletekey",
308
+ },
309
+ ];
310
+ }
311
+ }
312
+ ```
313
+
314
+ ### 多语言支持
315
+
316
+ ```typescript
317
+ config: {
318
+ config: {
319
+ Languages: [
320
+ {
321
+ Name: "english",
322
+ MessagesFile: "compiler:Default.isl",
323
+ },
324
+ {
325
+ Name: "chinesesimplified",
326
+ MessagesFile: "compiler:Languages\\ChineseSimplified.isl",
327
+ },
328
+ {
329
+ Name: "japanese",
330
+ MessagesFile: "compiler:Languages\\Japanese.isl",
331
+ },
332
+ ];
333
+ }
334
+ }
335
+ ```
336
+
337
+ ## 环境变量
338
+
339
+ - `INNOSETUP_PATH` - 指定 Innosetup 编译器路径
340
+
341
+ ## 编译器查找顺序
342
+
343
+ 1. 配置中指定的路径 (`config.innosetupPath`)
344
+ 2. 内置便携版 (`vendor/innosetup/ISCC.exe`)
345
+ 3. 环境变量 (`INNOSETUP_PATH`)
346
+ 4. 系统安装路径:
347
+ - `C:\Program Files (x86)\Inno Setup 6\ISCC.exe`
348
+ - `C:\Program Files\Inno Setup 6\ISCC.exe`
349
+ - `C:\Program Files (x86)\Inno Setup 5\ISCC.exe`
350
+ - `C:\Program Files\Inno Setup 5\ISCC.exe`
351
+
352
+ ## 许可证
353
+
354
+ MIT
355
+
356
+ ## 相关链接
357
+
358
+ - [Electron Forge](https://www.electronforge.io/)
359
+ - [Innosetup 官方文档](https://jrsoftware.org/ishelp/)
360
+ - [Innosetup 下载](https://jrsoftware.org/isdl.php)
@@ -0,0 +1,63 @@
1
+ import MakerBase, { MakerOptions } from "@electron-forge/maker-base";
2
+ import { ForgePlatform } from "@electron-forge/shared-types";
3
+ import { MakerInnosetupConfig } from "./types";
4
+ /**
5
+ * Electron Forge Maker for Innosetup
6
+ */
7
+ export default class MakerInnosetup extends MakerBase<MakerInnosetupConfig> {
8
+ name: string;
9
+ defaultPlatforms: ForgePlatform[];
10
+ private scriptGenerator;
11
+ constructor(config?: MakerInnosetupConfig, platforms?: ForgePlatform[]);
12
+ /**
13
+ * 从 ISS 文件解析配置
14
+ * @param issFilePath ISS 文件路径
15
+ * @returns MakerInnosetupConfig 配置对象
16
+ */
17
+ static fromIssFile(issFilePath: string): MakerInnosetupConfig;
18
+ /**
19
+ * 从 ISS 脚本内容解析配置
20
+ * @param issContent ISS 脚本内容
21
+ * @returns MakerInnosetupConfig 配置对象
22
+ */
23
+ static fromIssContent(issContent: string): MakerInnosetupConfig;
24
+ /**
25
+ * 检查是否支持当前平台
26
+ */
27
+ isSupportedOnCurrentPlatform(): boolean;
28
+ /**
29
+ * 查找 Innosetup 编译器路径
30
+ */
31
+ private findInnosetupCompiler;
32
+ /**
33
+ * 根据架构获取架构标识符
34
+ */
35
+ private getArchIdentifier;
36
+ /**
37
+ * 根据架构获取 ArchitecturesAllowed 配置
38
+ */
39
+ private getArchitecturesAllowed;
40
+ /**
41
+ * 生成默认配置
42
+ */
43
+ private generateDefaultConfig;
44
+ /**
45
+ * 合并用户配置和默认配置
46
+ */
47
+ private mergeConfig;
48
+ /**
49
+ * 添加任务(桌面图标、快速启动等)
50
+ */
51
+ private addTasks;
52
+ /**
53
+ * 执行 Innosetup 编译
54
+ */
55
+ private compileScript;
56
+ /**
57
+ * 制作安装包
58
+ */
59
+ make(options: MakerOptions): Promise<string[]>;
60
+ }
61
+ export * from "./types";
62
+ export { InnoScriptGenerator } from "./generator";
63
+ export { InnoScriptParser } from "./parser";