@simplysm/sd-cli 11.1.59 → 11.2.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/package.json +11 -11
- package/src/entry/SdCliElectron.ts +196 -196
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-cli",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.3",
|
|
4
4
|
"description": "심플리즘 패키지 - CLI",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@angular-devkit/build-angular": "^17.3.8",
|
|
21
|
-
"@angular/common": "^17.3.
|
|
22
|
-
"@angular/compiler": "^17.3.
|
|
23
|
-
"@angular/compiler-cli": "^17.3.
|
|
24
|
-
"@angular/core": "^17.3.
|
|
21
|
+
"@angular/common": "^17.3.11",
|
|
22
|
+
"@angular/compiler": "^17.3.11",
|
|
23
|
+
"@angular/compiler-cli": "^17.3.11",
|
|
24
|
+
"@angular/core": "^17.3.11",
|
|
25
25
|
"@electron/rebuild": "^3.6.0",
|
|
26
|
-
"@simplysm/sd-core-common": "11.
|
|
27
|
-
"@simplysm/sd-core-node": "11.
|
|
28
|
-
"@simplysm/sd-service-server": "11.
|
|
29
|
-
"@simplysm/sd-storage": "11.
|
|
26
|
+
"@simplysm/sd-core-common": "11.2.3",
|
|
27
|
+
"@simplysm/sd-core-node": "11.2.3",
|
|
28
|
+
"@simplysm/sd-service-server": "11.2.3",
|
|
29
|
+
"@simplysm/sd-storage": "11.2.3",
|
|
30
30
|
"browserslist": "^4.23.0",
|
|
31
31
|
"cordova": "^12.0.0",
|
|
32
|
-
"electron": "^29.4.
|
|
32
|
+
"electron": "^29.4.2",
|
|
33
33
|
"electron-builder": "^24.13.3",
|
|
34
34
|
"esbuild": "^0.20.2",
|
|
35
35
|
"esbuild-plugin-tsc": "^0.4.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node-stdlib-browser": "^1.2.0",
|
|
39
39
|
"piscina": "^4.5.1",
|
|
40
40
|
"rxjs": "^7.8.1",
|
|
41
|
-
"sass": "^1.77.
|
|
41
|
+
"sass": "^1.77.4",
|
|
42
42
|
"semver": "^7.6.2",
|
|
43
43
|
"xml2js": "^0.6.2",
|
|
44
44
|
"yargs": "^17.7.2",
|
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
import {FsUtil, Logger, SdProcess} from "@simplysm/sd-core-node";
|
|
2
|
-
import {pathToFileURL} from "url";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import {INpmConfig, ISdCliClientBuilderElectronConfig, ISdCliConfig} from "../commons";
|
|
5
|
-
import electronBuilder from "electron-builder";
|
|
6
|
-
|
|
7
|
-
export class SdCliElectron {
|
|
8
|
-
public static async runAsync(opt: {
|
|
9
|
-
confFileRelPath: string;
|
|
10
|
-
optNames: string[];
|
|
11
|
-
pkgName: string;
|
|
12
|
-
}): Promise<void> {
|
|
13
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "runAsync"]);
|
|
14
|
-
|
|
15
|
-
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
16
|
-
const electronPath = path.resolve(pkgPath, "dist/electron");
|
|
17
|
-
|
|
18
|
-
logger.log("설정 가져오기...");
|
|
19
|
-
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames) as ISdCliConfig;
|
|
20
|
-
const pkgConf = projConf.packages[opt.pkgName];
|
|
21
|
-
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
22
|
-
throw new Error();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
logger.log("package.json 파일 쓰기...");
|
|
26
|
-
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`))) as INpmConfig;
|
|
27
|
-
|
|
28
|
-
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
29
|
-
|
|
30
|
-
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
31
|
-
name: npmConfig.name,
|
|
32
|
-
version: npmConfig.version,
|
|
33
|
-
description: npmConfig.description,
|
|
34
|
-
main: "electron-main.js",
|
|
35
|
-
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
36
|
-
scripts: {
|
|
37
|
-
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
38
|
-
},
|
|
39
|
-
} : {},
|
|
40
|
-
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies![item])
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
logger.log("npm install...");
|
|
44
|
-
await SdProcess.spawnAsync(`npm install`, {cwd: electronPath}, true);
|
|
45
|
-
|
|
46
|
-
for (const externalPkgName of externalPkgNames) {
|
|
47
|
-
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
48
|
-
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
49
|
-
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronPath}, true);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
logger.log("electron...");
|
|
54
|
-
await SdProcess.spawnAsync(`electron .`, {cwd: electronPath}, true);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public static async buildForDevAsync(opt: {
|
|
58
|
-
confFileRelPath: string;
|
|
59
|
-
optNames: string[];
|
|
60
|
-
pkgName: string;
|
|
61
|
-
}): Promise<void> {
|
|
62
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildForDevAsync"]);
|
|
63
|
-
|
|
64
|
-
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
65
|
-
const electronPath = path.resolve(pkgPath, "dist/electron");
|
|
66
|
-
const electronDistPath = path.resolve(pkgPath, ".electron/dist");
|
|
67
|
-
|
|
68
|
-
logger.log("설정 가져오기...");
|
|
69
|
-
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames) as ISdCliConfig;
|
|
70
|
-
const pkgConf = projConf.packages[opt.pkgName];
|
|
71
|
-
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
72
|
-
throw new Error();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
logger.log("package.json 파일 쓰기...");
|
|
76
|
-
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`))) as INpmConfig;
|
|
77
|
-
|
|
78
|
-
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
79
|
-
|
|
80
|
-
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
81
|
-
name: npmConfig.name,
|
|
82
|
-
version: npmConfig.version,
|
|
83
|
-
description: npmConfig.description,
|
|
84
|
-
main: "electron-main.js",
|
|
85
|
-
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
86
|
-
scripts: {
|
|
87
|
-
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
88
|
-
},
|
|
89
|
-
} : {},
|
|
90
|
-
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies![item])
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
logger.log("npm install...");
|
|
94
|
-
await SdProcess.spawnAsync(`npm install`, {cwd: electronPath}, true);
|
|
95
|
-
|
|
96
|
-
for (const externalPkgName of externalPkgNames) {
|
|
97
|
-
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
98
|
-
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
99
|
-
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronPath}, true);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
logger.log("build...");
|
|
104
|
-
|
|
105
|
-
await electronBuilder.build({
|
|
106
|
-
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
107
|
-
config: {
|
|
108
|
-
appId: pkgConf.builder.electron.appId,
|
|
109
|
-
productName: npmConfig.description,
|
|
110
|
-
// asar: false,
|
|
111
|
-
win: {
|
|
112
|
-
target: "nsis"
|
|
113
|
-
},
|
|
114
|
-
nsis: {},
|
|
115
|
-
directories: {
|
|
116
|
-
app: electronPath,
|
|
117
|
-
output: electronDistPath
|
|
118
|
-
},
|
|
119
|
-
...pkgConf.builder.electron.installerIcon !== undefined ? {
|
|
120
|
-
icon: path.resolve(pkgPath, "src", pkgConf.builder.electron.installerIcon)
|
|
121
|
-
} : {},
|
|
122
|
-
removePackageScripts: false
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
await FsUtil.copyAsync(
|
|
127
|
-
path.resolve(electronDistPath, `${npmConfig.description} Setup ${npmConfig.version}.exe`),
|
|
128
|
-
path.resolve(pkgPath, `dist/electron/${npmConfig.description}-dev.exe`)
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public static async buildAsync(opt: {
|
|
133
|
-
pkgPath: string;
|
|
134
|
-
config: ISdCliClientBuilderElectronConfig;
|
|
135
|
-
}): Promise<void> {
|
|
136
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildAsync"]);
|
|
137
|
-
|
|
138
|
-
const electronSrcPath = path.resolve(opt.pkgPath, ".electron/src");
|
|
139
|
-
const electronDistPath = path.resolve(opt.pkgPath, ".electron/dist");
|
|
140
|
-
|
|
141
|
-
logger.log("package.json 파일 쓰기...");
|
|
142
|
-
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(opt.pkgPath, `package.json`))) as INpmConfig;
|
|
143
|
-
|
|
144
|
-
const externalPkgNames = opt.config.reinstallDependencies ?? [];
|
|
145
|
-
|
|
146
|
-
await FsUtil.writeJsonAsync(path.resolve(electronSrcPath, `package.json`), {
|
|
147
|
-
name: npmConfig.name,
|
|
148
|
-
version: npmConfig.version,
|
|
149
|
-
description: npmConfig.description,
|
|
150
|
-
main: "electron-main.js",
|
|
151
|
-
...opt.config.postInstallScript !== undefined ? {
|
|
152
|
-
scripts: {
|
|
153
|
-
"postinstall": opt.config.postInstallScript
|
|
154
|
-
},
|
|
155
|
-
} : {},
|
|
156
|
-
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies![item])
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
logger.log("npm install...");
|
|
160
|
-
await SdProcess.spawnAsync(`npm install`, {cwd: electronSrcPath}, true);
|
|
161
|
-
|
|
162
|
-
for (const externalPkgName of externalPkgNames) {
|
|
163
|
-
if (FsUtil.exists(path.resolve(electronSrcPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
164
|
-
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
165
|
-
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronSrcPath}, true);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
logger.log("build...");
|
|
170
|
-
|
|
171
|
-
await electronBuilder.build({
|
|
172
|
-
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
173
|
-
config: {
|
|
174
|
-
appId: opt.config.appId,
|
|
175
|
-
productName: npmConfig.description,
|
|
176
|
-
// asar: false,
|
|
177
|
-
win: {
|
|
178
|
-
target: "nsis"
|
|
179
|
-
},
|
|
180
|
-
nsis: {},
|
|
181
|
-
directories: {
|
|
182
|
-
app: electronSrcPath,
|
|
183
|
-
output: electronDistPath
|
|
184
|
-
},
|
|
185
|
-
...opt.config.installerIcon !== undefined ? {
|
|
186
|
-
icon: path.resolve(opt.pkgPath, "src", opt.config.installerIcon)
|
|
187
|
-
} : {},
|
|
188
|
-
removePackageScripts: false
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
await FsUtil.copyAsync(
|
|
193
|
-
path.resolve(electronDistPath, `${npmConfig.description} Setup ${npmConfig.version}.exe`),
|
|
194
|
-
path.resolve(opt.pkgPath, `dist/electron/${npmConfig.description}-latest.exe`)
|
|
195
|
-
);
|
|
196
|
-
}
|
|
1
|
+
import {FsUtil, Logger, SdProcess} from "@simplysm/sd-core-node";
|
|
2
|
+
import {pathToFileURL} from "url";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import {INpmConfig, ISdCliClientBuilderElectronConfig, ISdCliConfig} from "../commons";
|
|
5
|
+
import electronBuilder from "electron-builder";
|
|
6
|
+
|
|
7
|
+
export class SdCliElectron {
|
|
8
|
+
public static async runAsync(opt: {
|
|
9
|
+
confFileRelPath: string;
|
|
10
|
+
optNames: string[];
|
|
11
|
+
pkgName: string;
|
|
12
|
+
}): Promise<void> {
|
|
13
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "runAsync"]);
|
|
14
|
+
|
|
15
|
+
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
16
|
+
const electronPath = path.resolve(pkgPath, "dist/electron");
|
|
17
|
+
|
|
18
|
+
logger.log("설정 가져오기...");
|
|
19
|
+
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames) as ISdCliConfig;
|
|
20
|
+
const pkgConf = projConf.packages[opt.pkgName];
|
|
21
|
+
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
22
|
+
throw new Error();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
logger.log("package.json 파일 쓰기...");
|
|
26
|
+
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`))) as INpmConfig;
|
|
27
|
+
|
|
28
|
+
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
29
|
+
|
|
30
|
+
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
31
|
+
name: npmConfig.name,
|
|
32
|
+
version: npmConfig.version,
|
|
33
|
+
description: npmConfig.description,
|
|
34
|
+
main: "electron-main.js",
|
|
35
|
+
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
36
|
+
scripts: {
|
|
37
|
+
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
38
|
+
},
|
|
39
|
+
} : {},
|
|
40
|
+
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies![item])
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
logger.log("npm install...");
|
|
44
|
+
await SdProcess.spawnAsync(`npm install`, {cwd: electronPath}, true);
|
|
45
|
+
|
|
46
|
+
for (const externalPkgName of externalPkgNames) {
|
|
47
|
+
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
48
|
+
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
49
|
+
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronPath}, true);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
logger.log("electron...");
|
|
54
|
+
await SdProcess.spawnAsync(`electron .`, {cwd: electronPath}, true);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public static async buildForDevAsync(opt: {
|
|
58
|
+
confFileRelPath: string;
|
|
59
|
+
optNames: string[];
|
|
60
|
+
pkgName: string;
|
|
61
|
+
}): Promise<void> {
|
|
62
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildForDevAsync"]);
|
|
63
|
+
|
|
64
|
+
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
65
|
+
const electronPath = path.resolve(pkgPath, "dist/electron");
|
|
66
|
+
const electronDistPath = path.resolve(pkgPath, ".electron/dist");
|
|
67
|
+
|
|
68
|
+
logger.log("설정 가져오기...");
|
|
69
|
+
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames) as ISdCliConfig;
|
|
70
|
+
const pkgConf = projConf.packages[opt.pkgName];
|
|
71
|
+
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
72
|
+
throw new Error();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
logger.log("package.json 파일 쓰기...");
|
|
76
|
+
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`))) as INpmConfig;
|
|
77
|
+
|
|
78
|
+
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
79
|
+
|
|
80
|
+
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
81
|
+
name: npmConfig.name,
|
|
82
|
+
version: npmConfig.version,
|
|
83
|
+
description: npmConfig.description,
|
|
84
|
+
main: "electron-main.js",
|
|
85
|
+
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
86
|
+
scripts: {
|
|
87
|
+
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
88
|
+
},
|
|
89
|
+
} : {},
|
|
90
|
+
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies![item])
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
logger.log("npm install...");
|
|
94
|
+
await SdProcess.spawnAsync(`npm install`, {cwd: electronPath}, true);
|
|
95
|
+
|
|
96
|
+
for (const externalPkgName of externalPkgNames) {
|
|
97
|
+
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
98
|
+
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
99
|
+
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronPath}, true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
logger.log("build...");
|
|
104
|
+
|
|
105
|
+
await electronBuilder.build({
|
|
106
|
+
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
107
|
+
config: {
|
|
108
|
+
appId: pkgConf.builder.electron.appId,
|
|
109
|
+
productName: npmConfig.description,
|
|
110
|
+
// asar: false,
|
|
111
|
+
win: {
|
|
112
|
+
target: "nsis"
|
|
113
|
+
},
|
|
114
|
+
nsis: {},
|
|
115
|
+
directories: {
|
|
116
|
+
app: electronPath,
|
|
117
|
+
output: electronDistPath
|
|
118
|
+
},
|
|
119
|
+
...pkgConf.builder.electron.installerIcon !== undefined ? {
|
|
120
|
+
icon: path.resolve(pkgPath, "src", pkgConf.builder.electron.installerIcon)
|
|
121
|
+
} : {},
|
|
122
|
+
removePackageScripts: false
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await FsUtil.copyAsync(
|
|
127
|
+
path.resolve(electronDistPath, `${npmConfig.description} Setup ${npmConfig.version}.exe`),
|
|
128
|
+
path.resolve(pkgPath, `dist/electron/${npmConfig.description}-dev.exe`)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public static async buildAsync(opt: {
|
|
133
|
+
pkgPath: string;
|
|
134
|
+
config: ISdCliClientBuilderElectronConfig;
|
|
135
|
+
}): Promise<void> {
|
|
136
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildAsync"]);
|
|
137
|
+
|
|
138
|
+
const electronSrcPath = path.resolve(opt.pkgPath, ".electron/src");
|
|
139
|
+
const electronDistPath = path.resolve(opt.pkgPath, ".electron/dist");
|
|
140
|
+
|
|
141
|
+
logger.log("package.json 파일 쓰기...");
|
|
142
|
+
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(opt.pkgPath, `package.json`))) as INpmConfig;
|
|
143
|
+
|
|
144
|
+
const externalPkgNames = opt.config.reinstallDependencies ?? [];
|
|
145
|
+
|
|
146
|
+
await FsUtil.writeJsonAsync(path.resolve(electronSrcPath, `package.json`), {
|
|
147
|
+
name: npmConfig.name,
|
|
148
|
+
version: npmConfig.version,
|
|
149
|
+
description: npmConfig.description,
|
|
150
|
+
main: "electron-main.js",
|
|
151
|
+
...opt.config.postInstallScript !== undefined ? {
|
|
152
|
+
scripts: {
|
|
153
|
+
"postinstall": opt.config.postInstallScript
|
|
154
|
+
},
|
|
155
|
+
} : {},
|
|
156
|
+
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies![item])
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
logger.log("npm install...");
|
|
160
|
+
await SdProcess.spawnAsync(`npm install`, {cwd: electronSrcPath}, true);
|
|
161
|
+
|
|
162
|
+
for (const externalPkgName of externalPkgNames) {
|
|
163
|
+
if (FsUtil.exists(path.resolve(electronSrcPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
164
|
+
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
165
|
+
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronSrcPath}, true);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
logger.log("build...");
|
|
170
|
+
|
|
171
|
+
await electronBuilder.build({
|
|
172
|
+
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
173
|
+
config: {
|
|
174
|
+
appId: opt.config.appId,
|
|
175
|
+
productName: npmConfig.description,
|
|
176
|
+
// asar: false,
|
|
177
|
+
win: {
|
|
178
|
+
target: "nsis"
|
|
179
|
+
},
|
|
180
|
+
nsis: {},
|
|
181
|
+
directories: {
|
|
182
|
+
app: electronSrcPath,
|
|
183
|
+
output: electronDistPath
|
|
184
|
+
},
|
|
185
|
+
...opt.config.installerIcon !== undefined ? {
|
|
186
|
+
icon: path.resolve(opt.pkgPath, "src", opt.config.installerIcon)
|
|
187
|
+
} : {},
|
|
188
|
+
removePackageScripts: false
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
await FsUtil.copyAsync(
|
|
193
|
+
path.resolve(electronDistPath, `${npmConfig.description} Setup ${npmConfig.version}.exe`),
|
|
194
|
+
path.resolve(opt.pkgPath, `dist/electron/${npmConfig.description}-latest.exe`)
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
197
|
}
|