@simplysm/sd-cli 11.0.40 → 11.1.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/dist/build-cluster.d.ts +1 -1
- package/dist/build-cluster.js +181 -181
- package/dist/build-tools/SdCliCordova.d.ts +21 -21
- package/dist/build-tools/SdCliCordova.js +217 -217
- package/dist/build-tools/SdCliIndexFileGenerator.d.ts +5 -5
- package/dist/build-tools/SdCliIndexFileGenerator.js +50 -50
- package/dist/build-tools/SdCliNgRoutesFileGenerator.d.ts +4 -4
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js +57 -57
- package/dist/build-tools/SdLinter.d.ts +5 -5
- package/dist/build-tools/SdLinter.js +54 -54
- package/dist/build-tools/SdNgBundler.d.ts +34 -35
- package/dist/build-tools/SdNgBundler.js +534 -533
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdNgBundlerContext.d.ts +15 -16
- package/dist/build-tools/SdNgBundlerContext.js +97 -97
- package/dist/build-tools/SdNgBundlerContext.js.map +1 -1
- package/dist/build-tools/SdTsBundler.d.ts +15 -15
- package/dist/build-tools/SdTsBundler.js +87 -87
- package/dist/build-tools/SdTsCompiler.d.ts +29 -29
- package/dist/build-tools/SdTsCompiler.js +227 -227
- package/dist/builders/SdCliClientBuilder.d.ts +18 -18
- package/dist/builders/SdCliClientBuilder.js +129 -129
- package/dist/builders/SdCliJsLibLinter.d.ts +14 -14
- package/dist/builders/SdCliJsLibLinter.js +59 -59
- package/dist/builders/SdCliServerBuilder.d.ts +20 -20
- package/dist/builders/SdCliServerBuilder.js +215 -215
- package/dist/builders/SdCliTsLibBuilder.d.ts +17 -17
- package/dist/builders/SdCliTsLibBuilder.js +79 -79
- package/dist/commons.d.ts +132 -132
- package/dist/commons.js +1 -1
- package/dist/entry/SdCliElectron.d.ts +12 -12
- package/dist/entry/SdCliElectron.js +99 -99
- package/dist/entry/SdCliLocalUpdate.d.ts +12 -12
- package/dist/entry/SdCliLocalUpdate.js +90 -90
- package/dist/entry/SdCliProject.d.ts +26 -26
- package/dist/entry/SdCliProject.js +477 -477
- package/dist/index.d.ts +19 -19
- package/dist/index.js +19 -19
- package/dist/sd-cli.d.ts +2 -2
- package/dist/sd-cli.js +210 -210
- package/dist/server-worker.d.ts +1 -1
- package/dist/server-worker.js +38 -38
- package/dist/utils/SdCliBuildResultUtil.d.ts +6 -6
- package/dist/utils/SdCliBuildResultUtil.js +37 -37
- package/dist/utils/SdMemoryLoadResultCache.d.ts +10 -9
- package/dist/utils/SdMemoryLoadResultCache.js +36 -34
- package/dist/utils/SdMemoryLoadResultCache.js.map +1 -1
- package/dist/utils/SdSourceFileCache.d.ts +6 -6
- package/dist/utils/SdSourceFileCache.js +21 -14
- package/dist/utils/SdSourceFileCache.js.map +1 -1
- package/package.json +18 -18
- package/src/build-tools/SdNgBundler.ts +30 -36
- package/src/build-tools/SdNgBundlerContext.ts +11 -11
- package/src/utils/SdMemoryLoadResultCache.ts +4 -1
- package/src/utils/SdSourceFileCache.ts +10 -3
package/dist/commons.d.ts
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
export interface INpmConfig {
|
|
2
|
-
name: string;
|
|
3
|
-
description?: string;
|
|
4
|
-
version: string;
|
|
5
|
-
workspaces?: string[];
|
|
6
|
-
dependencies?: Record<string, string>;
|
|
7
|
-
optionalDependencies?: Record<string, string>;
|
|
8
|
-
devDependencies?: Record<string, string>;
|
|
9
|
-
peerDependencies?: Record<string, string>;
|
|
10
|
-
peerDependenciesMeta?: Record<string, {
|
|
11
|
-
optional?: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
resolutions?: Record<string, string>;
|
|
14
|
-
scripts?: Record<string, string>;
|
|
15
|
-
}
|
|
16
|
-
export interface ITsConfig {
|
|
17
|
-
files?: string[];
|
|
18
|
-
compilerOptions: {
|
|
19
|
-
lib: string[];
|
|
20
|
-
};
|
|
21
|
-
angularCompilerOptions?: {};
|
|
22
|
-
}
|
|
23
|
-
export interface ISdCliBuildClusterReqMessage {
|
|
24
|
-
cmd: "watch" | "build";
|
|
25
|
-
projConf: ISdCliConfig;
|
|
26
|
-
pkgPath: string;
|
|
27
|
-
}
|
|
28
|
-
export interface ISdCliBuildClusterResMessage {
|
|
29
|
-
req: ISdCliBuildClusterReqMessage;
|
|
30
|
-
type: "change" | "complete" | "ready";
|
|
31
|
-
result?: ISdCliBuilderResult;
|
|
32
|
-
}
|
|
33
|
-
export interface ISdCliBuilderResult {
|
|
34
|
-
port?: number;
|
|
35
|
-
affectedFilePaths: string[];
|
|
36
|
-
buildResults: ISdCliPackageBuildResult[];
|
|
37
|
-
}
|
|
38
|
-
export interface ISdCliPackageBuildResult {
|
|
39
|
-
filePath: string | undefined;
|
|
40
|
-
line: number | undefined;
|
|
41
|
-
char: number | undefined;
|
|
42
|
-
code: string | undefined;
|
|
43
|
-
severity: "error" | "warning" | "suggestion" | "message";
|
|
44
|
-
message: string;
|
|
45
|
-
type: "build" | "lint" | "style" | undefined;
|
|
46
|
-
}
|
|
47
|
-
export interface ISdCliConfig {
|
|
48
|
-
packages: Record<string, TSdCliPackageConfig | undefined>;
|
|
49
|
-
localUpdates?: Record<string, string>;
|
|
50
|
-
}
|
|
51
|
-
export type TSdCliConfigFn = (isDev: boolean, opts?: string[]) => ISdCliConfig;
|
|
52
|
-
export type TSdCliPackageConfig = ISdCliLibPackageConfig | ISdCliServerPackageConfig | ISdCliClientPackageConfig;
|
|
53
|
-
export interface ISdCliLibPackageConfig {
|
|
54
|
-
type: "library";
|
|
55
|
-
publish?: "npm";
|
|
56
|
-
polyfills?: string[];
|
|
57
|
-
noGenIndex?: boolean;
|
|
58
|
-
}
|
|
59
|
-
export interface ISdCliServerPackageConfig {
|
|
60
|
-
type: "server";
|
|
61
|
-
externals?: string[];
|
|
62
|
-
publish?: ISdCliLocalDirectoryPublishConfig | ISdCliFtpPublishConfig;
|
|
63
|
-
configs?: Record<string, any>;
|
|
64
|
-
env?: Record<string, string>;
|
|
65
|
-
pm2?: {
|
|
66
|
-
ignoreWatchPaths?: string[];
|
|
67
|
-
noInterpreter?: boolean;
|
|
68
|
-
noStartScript?: boolean;
|
|
69
|
-
};
|
|
70
|
-
iis?: {
|
|
71
|
-
nodeExeFilePath?: string;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
export interface ISdCliClientPackageConfig {
|
|
75
|
-
type: "client";
|
|
76
|
-
server?: string;
|
|
77
|
-
publish?: ISdCliLocalDirectoryPublishConfig | ISdCliFtpPublishConfig;
|
|
78
|
-
env?: Record<string, string>;
|
|
79
|
-
configs?: Record<string, any>;
|
|
80
|
-
builder?: {
|
|
81
|
-
web?: ISdCliClientBuilderWebConfig;
|
|
82
|
-
electron?: ISdCliClientBuilderElectronConfig;
|
|
83
|
-
cordova?: ISdCliClientBuilderCordovaConfig;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
export interface ISdCliLocalDirectoryPublishConfig {
|
|
87
|
-
type: "local-directory";
|
|
88
|
-
path: string;
|
|
89
|
-
}
|
|
90
|
-
export interface ISdCliFtpPublishConfig {
|
|
91
|
-
type: "ftp" | "ftps" | "sftp";
|
|
92
|
-
host: string;
|
|
93
|
-
port?: number;
|
|
94
|
-
path?: string;
|
|
95
|
-
user?: string;
|
|
96
|
-
pass?: string;
|
|
97
|
-
}
|
|
98
|
-
export interface ISdCliClientBuilderElectronConfig {
|
|
99
|
-
appId: string;
|
|
100
|
-
installerIcon?: string;
|
|
101
|
-
postInstallScript?: string;
|
|
102
|
-
devServerHost?: string;
|
|
103
|
-
devServerPort?: number;
|
|
104
|
-
reinstallDependencies?: string[];
|
|
105
|
-
env?: Record<string, string>;
|
|
106
|
-
}
|
|
107
|
-
export interface ISdCliClientBuilderWebConfig {
|
|
108
|
-
devServerHost?: string;
|
|
109
|
-
devServerPort?: number;
|
|
110
|
-
env?: Record<string, string>;
|
|
111
|
-
}
|
|
112
|
-
export interface ISdCliClientBuilderCordovaConfig {
|
|
113
|
-
appId: string;
|
|
114
|
-
appName: string;
|
|
115
|
-
plugins?: string[];
|
|
116
|
-
icon?: string;
|
|
117
|
-
debug?: boolean;
|
|
118
|
-
platform?: {
|
|
119
|
-
browser?: {};
|
|
120
|
-
android?: {
|
|
121
|
-
bundle?: boolean;
|
|
122
|
-
sign?: {
|
|
123
|
-
keystore: string;
|
|
124
|
-
storePassword: string;
|
|
125
|
-
alias: string;
|
|
126
|
-
password: string;
|
|
127
|
-
keystoreType: string;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
env?: Record<string, string>;
|
|
132
|
-
}
|
|
1
|
+
export interface INpmConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
version: string;
|
|
5
|
+
workspaces?: string[];
|
|
6
|
+
dependencies?: Record<string, string>;
|
|
7
|
+
optionalDependencies?: Record<string, string>;
|
|
8
|
+
devDependencies?: Record<string, string>;
|
|
9
|
+
peerDependencies?: Record<string, string>;
|
|
10
|
+
peerDependenciesMeta?: Record<string, {
|
|
11
|
+
optional?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
resolutions?: Record<string, string>;
|
|
14
|
+
scripts?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface ITsConfig {
|
|
17
|
+
files?: string[];
|
|
18
|
+
compilerOptions: {
|
|
19
|
+
lib: string[];
|
|
20
|
+
};
|
|
21
|
+
angularCompilerOptions?: {};
|
|
22
|
+
}
|
|
23
|
+
export interface ISdCliBuildClusterReqMessage {
|
|
24
|
+
cmd: "watch" | "build";
|
|
25
|
+
projConf: ISdCliConfig;
|
|
26
|
+
pkgPath: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ISdCliBuildClusterResMessage {
|
|
29
|
+
req: ISdCliBuildClusterReqMessage;
|
|
30
|
+
type: "change" | "complete" | "ready";
|
|
31
|
+
result?: ISdCliBuilderResult;
|
|
32
|
+
}
|
|
33
|
+
export interface ISdCliBuilderResult {
|
|
34
|
+
port?: number;
|
|
35
|
+
affectedFilePaths: string[];
|
|
36
|
+
buildResults: ISdCliPackageBuildResult[];
|
|
37
|
+
}
|
|
38
|
+
export interface ISdCliPackageBuildResult {
|
|
39
|
+
filePath: string | undefined;
|
|
40
|
+
line: number | undefined;
|
|
41
|
+
char: number | undefined;
|
|
42
|
+
code: string | undefined;
|
|
43
|
+
severity: "error" | "warning" | "suggestion" | "message";
|
|
44
|
+
message: string;
|
|
45
|
+
type: "build" | "lint" | "style" | undefined;
|
|
46
|
+
}
|
|
47
|
+
export interface ISdCliConfig {
|
|
48
|
+
packages: Record<string, TSdCliPackageConfig | undefined>;
|
|
49
|
+
localUpdates?: Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
export type TSdCliConfigFn = (isDev: boolean, opts?: string[]) => ISdCliConfig;
|
|
52
|
+
export type TSdCliPackageConfig = ISdCliLibPackageConfig | ISdCliServerPackageConfig | ISdCliClientPackageConfig;
|
|
53
|
+
export interface ISdCliLibPackageConfig {
|
|
54
|
+
type: "library";
|
|
55
|
+
publish?: "npm";
|
|
56
|
+
polyfills?: string[];
|
|
57
|
+
noGenIndex?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface ISdCliServerPackageConfig {
|
|
60
|
+
type: "server";
|
|
61
|
+
externals?: string[];
|
|
62
|
+
publish?: ISdCliLocalDirectoryPublishConfig | ISdCliFtpPublishConfig;
|
|
63
|
+
configs?: Record<string, any>;
|
|
64
|
+
env?: Record<string, string>;
|
|
65
|
+
pm2?: {
|
|
66
|
+
ignoreWatchPaths?: string[];
|
|
67
|
+
noInterpreter?: boolean;
|
|
68
|
+
noStartScript?: boolean;
|
|
69
|
+
};
|
|
70
|
+
iis?: {
|
|
71
|
+
nodeExeFilePath?: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface ISdCliClientPackageConfig {
|
|
75
|
+
type: "client";
|
|
76
|
+
server?: string;
|
|
77
|
+
publish?: ISdCliLocalDirectoryPublishConfig | ISdCliFtpPublishConfig;
|
|
78
|
+
env?: Record<string, string>;
|
|
79
|
+
configs?: Record<string, any>;
|
|
80
|
+
builder?: {
|
|
81
|
+
web?: ISdCliClientBuilderWebConfig;
|
|
82
|
+
electron?: ISdCliClientBuilderElectronConfig;
|
|
83
|
+
cordova?: ISdCliClientBuilderCordovaConfig;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface ISdCliLocalDirectoryPublishConfig {
|
|
87
|
+
type: "local-directory";
|
|
88
|
+
path: string;
|
|
89
|
+
}
|
|
90
|
+
export interface ISdCliFtpPublishConfig {
|
|
91
|
+
type: "ftp" | "ftps" | "sftp";
|
|
92
|
+
host: string;
|
|
93
|
+
port?: number;
|
|
94
|
+
path?: string;
|
|
95
|
+
user?: string;
|
|
96
|
+
pass?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ISdCliClientBuilderElectronConfig {
|
|
99
|
+
appId: string;
|
|
100
|
+
installerIcon?: string;
|
|
101
|
+
postInstallScript?: string;
|
|
102
|
+
devServerHost?: string;
|
|
103
|
+
devServerPort?: number;
|
|
104
|
+
reinstallDependencies?: string[];
|
|
105
|
+
env?: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
export interface ISdCliClientBuilderWebConfig {
|
|
108
|
+
devServerHost?: string;
|
|
109
|
+
devServerPort?: number;
|
|
110
|
+
env?: Record<string, string>;
|
|
111
|
+
}
|
|
112
|
+
export interface ISdCliClientBuilderCordovaConfig {
|
|
113
|
+
appId: string;
|
|
114
|
+
appName: string;
|
|
115
|
+
plugins?: string[];
|
|
116
|
+
icon?: string;
|
|
117
|
+
debug?: boolean;
|
|
118
|
+
platform?: {
|
|
119
|
+
browser?: {};
|
|
120
|
+
android?: {
|
|
121
|
+
bundle?: boolean;
|
|
122
|
+
sign?: {
|
|
123
|
+
keystore: string;
|
|
124
|
+
storePassword: string;
|
|
125
|
+
alias: string;
|
|
126
|
+
password: string;
|
|
127
|
+
keystoreType: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
env?: Record<string, string>;
|
|
132
|
+
}
|
package/dist/commons.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=commons.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare class SdCliElectron {
|
|
2
|
-
static runAsync(opt: {
|
|
3
|
-
confFileRelPath: string;
|
|
4
|
-
optNames: string[];
|
|
5
|
-
pkgName: string;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
-
static buildForDevAsync(opt: {
|
|
8
|
-
confFileRelPath: string;
|
|
9
|
-
optNames: string[];
|
|
10
|
-
pkgName: string;
|
|
11
|
-
}): Promise<void>;
|
|
12
|
-
}
|
|
1
|
+
export declare class SdCliElectron {
|
|
2
|
+
static runAsync(opt: {
|
|
3
|
+
confFileRelPath: string;
|
|
4
|
+
optNames: string[];
|
|
5
|
+
pkgName: string;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
static buildForDevAsync(opt: {
|
|
8
|
+
confFileRelPath: string;
|
|
9
|
+
optNames: string[];
|
|
10
|
+
pkgName: string;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
}
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core-node";
|
|
2
|
-
import { pathToFileURL } from "url";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import electronBuilder from "electron-builder";
|
|
5
|
-
export class SdCliElectron {
|
|
6
|
-
static async runAsync(opt) {
|
|
7
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "runAsync"]);
|
|
8
|
-
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
9
|
-
const electronPath = path.resolve(pkgPath, ".electron/dev/src");
|
|
10
|
-
logger.log("설정 가져오기...");
|
|
11
|
-
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames);
|
|
12
|
-
const pkgConf = projConf.packages[opt.pkgName];
|
|
13
|
-
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
14
|
-
throw new Error();
|
|
15
|
-
}
|
|
16
|
-
logger.log("package.json 파일 쓰기...");
|
|
17
|
-
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`)));
|
|
18
|
-
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
19
|
-
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
20
|
-
name: npmConfig.name,
|
|
21
|
-
version: npmConfig.version,
|
|
22
|
-
description: npmConfig.description,
|
|
23
|
-
main: "electron-main.js",
|
|
24
|
-
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
25
|
-
scripts: {
|
|
26
|
-
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
27
|
-
},
|
|
28
|
-
} : {},
|
|
29
|
-
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies[item])
|
|
30
|
-
});
|
|
31
|
-
logger.log("npm install...");
|
|
32
|
-
await SdProcess.spawnAsync(`npm install`, { cwd: electronPath }, true);
|
|
33
|
-
for (const externalPkgName of externalPkgNames) {
|
|
34
|
-
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
35
|
-
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
36
|
-
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, { cwd: electronPath }, true);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
logger.log("electron...");
|
|
40
|
-
await SdProcess.spawnAsync(`electron .`, { cwd: electronPath }, true);
|
|
41
|
-
}
|
|
42
|
-
static async buildForDevAsync(opt) {
|
|
43
|
-
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildForDevAsync"]);
|
|
44
|
-
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
45
|
-
const electronPath = path.resolve(pkgPath, ".electron/dev/src");
|
|
46
|
-
const electronDistPath = path.resolve(pkgPath, ".electron/dev/dist");
|
|
47
|
-
logger.log("설정 가져오기...");
|
|
48
|
-
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames);
|
|
49
|
-
const pkgConf = projConf.packages[opt.pkgName];
|
|
50
|
-
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
51
|
-
throw new Error();
|
|
52
|
-
}
|
|
53
|
-
logger.log("package.json 파일 쓰기...");
|
|
54
|
-
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`)));
|
|
55
|
-
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
56
|
-
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
57
|
-
name: npmConfig.name,
|
|
58
|
-
version: npmConfig.version,
|
|
59
|
-
description: npmConfig.description,
|
|
60
|
-
main: "electron-main.js",
|
|
61
|
-
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
62
|
-
scripts: {
|
|
63
|
-
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
64
|
-
},
|
|
65
|
-
} : {},
|
|
66
|
-
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies[item])
|
|
67
|
-
});
|
|
68
|
-
logger.log("npm install...");
|
|
69
|
-
await SdProcess.spawnAsync(`npm install`, { cwd: electronPath }, true);
|
|
70
|
-
for (const externalPkgName of externalPkgNames) {
|
|
71
|
-
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
72
|
-
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
73
|
-
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, { cwd: electronPath }, true);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
logger.log("build...");
|
|
77
|
-
await electronBuilder.build({
|
|
78
|
-
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
79
|
-
config: {
|
|
80
|
-
appId: pkgConf.builder.electron.appId,
|
|
81
|
-
productName: npmConfig.description,
|
|
82
|
-
// asar: false,
|
|
83
|
-
win: {
|
|
84
|
-
target: "nsis"
|
|
85
|
-
},
|
|
86
|
-
nsis: {},
|
|
87
|
-
directories: {
|
|
88
|
-
app: electronPath,
|
|
89
|
-
output: electronDistPath
|
|
90
|
-
},
|
|
91
|
-
...pkgConf.builder.electron.installerIcon !== undefined ? {
|
|
92
|
-
icon: path.resolve(pkgPath, "src", pkgConf.builder.electron.installerIcon)
|
|
93
|
-
} : {},
|
|
94
|
-
removePackageScripts: false
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
await FsUtil.copyAsync(path.resolve(electronDistPath, `${npmConfig.description} Setup ${npmConfig.version}.exe`), path.resolve(pkgPath, `dist/electron/${npmConfig.description}-dev.exe`));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
1
|
+
import { FsUtil, Logger, SdProcess } from "@simplysm/sd-core-node";
|
|
2
|
+
import { pathToFileURL } from "url";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import electronBuilder from "electron-builder";
|
|
5
|
+
export class SdCliElectron {
|
|
6
|
+
static async runAsync(opt) {
|
|
7
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "runAsync"]);
|
|
8
|
+
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
9
|
+
const electronPath = path.resolve(pkgPath, ".electron/dev/src");
|
|
10
|
+
logger.log("설정 가져오기...");
|
|
11
|
+
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames);
|
|
12
|
+
const pkgConf = projConf.packages[opt.pkgName];
|
|
13
|
+
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
14
|
+
throw new Error();
|
|
15
|
+
}
|
|
16
|
+
logger.log("package.json 파일 쓰기...");
|
|
17
|
+
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`)));
|
|
18
|
+
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
19
|
+
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
20
|
+
name: npmConfig.name,
|
|
21
|
+
version: npmConfig.version,
|
|
22
|
+
description: npmConfig.description,
|
|
23
|
+
main: "electron-main.js",
|
|
24
|
+
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
25
|
+
scripts: {
|
|
26
|
+
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
27
|
+
},
|
|
28
|
+
} : {},
|
|
29
|
+
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies[item])
|
|
30
|
+
});
|
|
31
|
+
logger.log("npm install...");
|
|
32
|
+
await SdProcess.spawnAsync(`npm install`, { cwd: electronPath }, true);
|
|
33
|
+
for (const externalPkgName of externalPkgNames) {
|
|
34
|
+
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
35
|
+
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
36
|
+
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, { cwd: electronPath }, true);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
logger.log("electron...");
|
|
40
|
+
await SdProcess.spawnAsync(`electron .`, { cwd: electronPath }, true);
|
|
41
|
+
}
|
|
42
|
+
static async buildForDevAsync(opt) {
|
|
43
|
+
const logger = Logger.get(["simplysm", "sd-cli", "SdCliElectron", "buildForDevAsync"]);
|
|
44
|
+
const pkgPath = path.resolve(process.cwd(), `packages/${opt.pkgName}`);
|
|
45
|
+
const electronPath = path.resolve(pkgPath, ".electron/dev/src");
|
|
46
|
+
const electronDistPath = path.resolve(pkgPath, ".electron/dev/dist");
|
|
47
|
+
logger.log("설정 가져오기...");
|
|
48
|
+
const projConf = (await import(pathToFileURL(path.resolve(process.cwd(), opt.confFileRelPath)).href)).default(true, opt.optNames);
|
|
49
|
+
const pkgConf = projConf.packages[opt.pkgName];
|
|
50
|
+
if (pkgConf?.type !== "client" || pkgConf.builder?.electron === undefined) {
|
|
51
|
+
throw new Error();
|
|
52
|
+
}
|
|
53
|
+
logger.log("package.json 파일 쓰기...");
|
|
54
|
+
const npmConfig = (await FsUtil.readJsonAsync(path.resolve(pkgPath, `package.json`)));
|
|
55
|
+
const externalPkgNames = pkgConf.builder.electron.reinstallDependencies ?? [];
|
|
56
|
+
await FsUtil.writeJsonAsync(path.resolve(electronPath, `package.json`), {
|
|
57
|
+
name: npmConfig.name,
|
|
58
|
+
version: npmConfig.version,
|
|
59
|
+
description: npmConfig.description,
|
|
60
|
+
main: "electron-main.js",
|
|
61
|
+
...pkgConf.builder.electron.postInstallScript !== undefined ? {
|
|
62
|
+
scripts: {
|
|
63
|
+
"postinstall": pkgConf.builder.electron.postInstallScript
|
|
64
|
+
},
|
|
65
|
+
} : {},
|
|
66
|
+
dependencies: externalPkgNames.toObject((item) => item, (item) => npmConfig.dependencies[item])
|
|
67
|
+
});
|
|
68
|
+
logger.log("npm install...");
|
|
69
|
+
await SdProcess.spawnAsync(`npm install`, { cwd: electronPath }, true);
|
|
70
|
+
for (const externalPkgName of externalPkgNames) {
|
|
71
|
+
if (FsUtil.exists(path.resolve(electronPath, "node_modules", externalPkgName, "binding.gyp"))) {
|
|
72
|
+
logger.log(`electron rebuild (${externalPkgName})...`);
|
|
73
|
+
await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, { cwd: electronPath }, true);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
logger.log("build...");
|
|
77
|
+
await electronBuilder.build({
|
|
78
|
+
targets: electronBuilder.Platform.WINDOWS.createTarget(),
|
|
79
|
+
config: {
|
|
80
|
+
appId: pkgConf.builder.electron.appId,
|
|
81
|
+
productName: npmConfig.description,
|
|
82
|
+
// asar: false,
|
|
83
|
+
win: {
|
|
84
|
+
target: "nsis"
|
|
85
|
+
},
|
|
86
|
+
nsis: {},
|
|
87
|
+
directories: {
|
|
88
|
+
app: electronPath,
|
|
89
|
+
output: electronDistPath
|
|
90
|
+
},
|
|
91
|
+
...pkgConf.builder.electron.installerIcon !== undefined ? {
|
|
92
|
+
icon: path.resolve(pkgPath, "src", pkgConf.builder.electron.installerIcon)
|
|
93
|
+
} : {},
|
|
94
|
+
removePackageScripts: false
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
await FsUtil.copyAsync(path.resolve(electronDistPath, `${npmConfig.description} Setup ${npmConfig.version}.exe`), path.resolve(pkgPath, `dist/electron/${npmConfig.description}-dev.exe`));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
100
|
//# sourceMappingURL=SdCliElectron.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare class SdCliLocalUpdate {
|
|
2
|
-
static runAsync(opt: {
|
|
3
|
-
confFileRelPath: string;
|
|
4
|
-
optNames: string[];
|
|
5
|
-
}): Promise<void>;
|
|
6
|
-
static watchAsync(opt: {
|
|
7
|
-
confFileRelPath: string;
|
|
8
|
-
optNames: string[];
|
|
9
|
-
}): Promise<void>;
|
|
10
|
-
private static _getUpdatePathInfosAsync;
|
|
11
|
-
private static _getWatchPathsAsync;
|
|
12
|
-
}
|
|
1
|
+
export declare class SdCliLocalUpdate {
|
|
2
|
+
static runAsync(opt: {
|
|
3
|
+
confFileRelPath: string;
|
|
4
|
+
optNames: string[];
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
static watchAsync(opt: {
|
|
7
|
+
confFileRelPath: string;
|
|
8
|
+
optNames: string[];
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
private static _getUpdatePathInfosAsync;
|
|
11
|
+
private static _getWatchPathsAsync;
|
|
12
|
+
}
|