@simplysm/sd-cli 7.0.224 → 7.0.231

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/src/bin/sd-cli.ts CHANGED
@@ -1,274 +1,274 @@
1
- #!/usr/bin/env node --experimental-specifier-resolution=node --experimental-import-meta-resolve
2
-
3
- import yargs from "yargs";
4
- import { hideBin } from "yargs/helpers";
5
- import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
6
- import { SdCliWorkspace } from "../entry-points/SdCliWorkspace";
7
- import { SdCliLocalUpdate } from "../entry-points/SdCliLocalUpdate";
8
- import { SdCliNpm } from "../entry-points/SdCliNpm";
9
- import { SdCliPrepare } from "../entry-points/SdCliPrepare";
10
- import { SdCliFileCrypto } from "../entry-points/SdCliFileCrypto";
11
- import { SdCliCordova } from "../build-tool/SdCliCordova";
12
- import { SdCliElectron } from "../build-tool/SdCliElectron";
13
-
14
- Error.stackTraceLimit = Infinity;
15
-
16
- const argv = yargs(hideBin(process.argv))
17
- .version(false)
18
- .help("help", "도움말")
19
- .alias("help", "h")
20
- .options({
21
- debug: {
22
- type: "boolean",
23
- describe: "디버그 로그를 표시할 것인지 여부",
24
- default: false
25
- }
26
- })
27
- .command(
28
- "prepare",
29
- "sd-cli 준비",
30
- (cmd) => cmd.version(false)
31
- )
32
- .command(
33
- "update",
34
- "패키지 업데이트 (npm update)",
35
- (cmd) => cmd.version(false)
36
- )
37
- .command(
38
- "local-update",
39
- "로컬 라이브러리 업데이트를 수행합니다.",
40
- (cmd) => cmd.version(false)
41
- .options({
42
- config: {
43
- type: "string",
44
- describe: "simplysm.json 파일 경로"
45
- }
46
- })
47
- )
48
- .command(
49
- "watch",
50
- "프로젝트의 각 패키지에 대한 변경감지 빌드를 수행합니다.",
51
- (cmd) => cmd.version(false)
52
- .options({
53
- config: {
54
- type: "string",
55
- describe: "simplysm.json 파일 경로"
56
- },
57
- options: {
58
- type: "string",
59
- array: true,
60
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
61
- },
62
- packages: {
63
- type: "string",
64
- array: true,
65
- describe: "수행할 패키지 설정"
66
- }
67
- })
68
- )
69
- .command(
70
- "run-electron <package> <url>",
71
- "변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
72
- (cmd) => cmd
73
- .positional("package", {
74
- type: "string",
75
- describe: "패키지명",
76
- demandOption: true
77
- })
78
- .positional("url", {
79
- type: "string",
80
- describe: "Webview로 오픈할 URL",
81
- demandOption: true
82
- })
83
- .options({
84
- config: {
85
- type: "string",
86
- describe: "simplysm.json 파일 경로"
87
- },
88
- options: {
89
- type: "string",
90
- array: true,
91
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
92
- }
93
- })
94
- )
95
- .command(
96
- "run-cordova <platform> <package> <url>",
97
- "변경감지중인 플랫폼을 코도바 디바이스에 앱 형태로 띄웁니다.",
98
- (cmd) => cmd
99
- .positional("platform", {
100
- type: "string",
101
- describe: "빌드 플랫폼(android,...)",
102
- demandOption: true
103
- })
104
- .positional("package", {
105
- type: "string",
106
- describe: "패키지명",
107
- demandOption: true
108
- })
109
- .positional("url", {
110
- type: "string",
111
- describe: "Webview로 오픈할 URL",
112
- demandOption: true
113
- })
114
- )
115
- .command(
116
- "build",
117
- "프로젝트의 각 패키지에 대한 빌드를 수행합니다.",
118
- (cmd) => cmd.version(false)
119
- .options({
120
- config: {
121
- type: "string",
122
- describe: "simplysm.json 파일 경로"
123
- },
124
- options: {
125
- type: "string",
126
- array: true,
127
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
128
- },
129
- packages: {
130
- type: "string",
131
- array: true,
132
- describe: "수행할 패키지 설정"
133
- }
134
- })
135
- )
136
- .command(
137
- "publish",
138
- "프로젝트의 각 패키지를 배포합니다.",
139
- (cmd) => cmd.version(false)
140
- .options({
141
- noBuild: {
142
- type: "boolean",
143
- describe: "빌드를 하지않고 배포합니다.",
144
- default: false
145
- },
146
- config: {
147
- type: "string",
148
- describe: "simplysm.json 파일 경로"
149
- },
150
- options: {
151
- type: "string",
152
- array: true,
153
- describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
154
- },
155
- packages: {
156
- type: "string",
157
- array: true,
158
- describe: "수행할 패키지 설정"
159
- }
160
- })
161
- )
162
- .command(
163
- "enc-file <file>",
164
- "파일을 암호화 합니다.",
165
- (cmd) => cmd.version(false)
166
- .positional("file", {
167
- type: "string",
168
- describe: "암호화할 파일명"
169
- })
170
- )
171
- .command(
172
- "dec-file <file>",
173
- "파일을 복호화 합니다.",
174
- (cmd) => cmd.version(false)
175
- .positional("file", {
176
- type: "string",
177
- describe: "암호화된 파일명"
178
- })
179
- )
180
- .parseSync();
181
-
182
- if (argv.debug) {
183
- process.env["SD_CLI_LOGGER_SEVERITY"] = "DEBUG";
184
-
185
- Logger.setConfig({
186
- console: {
187
- level: LoggerSeverity.debug
188
- }
189
- });
190
- }
191
- else {
192
- Logger.setConfig({
193
- dot: true
194
- });
195
- }
196
-
197
- const logger = Logger.get(["simplysm", "sd-cli", "bin", "sd-cli"]);
198
-
199
- (async () => {
200
- if (argv._[0] === "prepare") {
201
- await new SdCliPrepare()
202
- .prepareAsync();
203
- }
204
- else if (argv._[0] === "update") {
205
- await new SdCliNpm(process.cwd())
206
- .updateAsync();
207
- }
208
- else if (argv._[0] === "local-update") {
209
- await new SdCliLocalUpdate(process.cwd())
210
- .runAsync({
211
- confFileRelPath: argv.config ?? "simplysm.json"
212
- });
213
- }
214
- else if (argv._[0] === "watch") {
215
- await new SdCliWorkspace(process.cwd())
216
- .watchAsync({
217
- confFileRelPath: argv.config ?? "simplysm.json",
218
- optNames: argv.options ?? [],
219
- pkgs: argv.packages ?? []
220
- });
221
- }
222
- else if (argv._[0] === "run-electron") {
223
- await new SdCliElectron(process.cwd())
224
- .runWebviewOnDeviceAsync(
225
- argv.package,
226
- argv.url,
227
- {
228
- confFileRelPath: argv.config ?? "simplysm.json",
229
- optNames: argv.options ?? []
230
- }
231
- );
232
- }
233
- else if (argv._[0] === "run-cordova") {
234
- await SdCliCordova.runWebviewOnDeviceAsync(
235
- process.cwd(),
236
- argv.platform as "browser" | "android",
237
- argv.package,
238
- argv.url
239
- );
240
- }
241
- else if (argv._[0] === "build") {
242
- await new SdCliWorkspace(process.cwd())
243
- .buildAsync({
244
- confFileRelPath: argv.config ?? "simplysm.json",
245
- optNames: argv.options ?? [],
246
- pkgs: argv.packages ?? []
247
- });
248
- process.exit(0);
249
- }
250
- else if (argv._[0] === "publish") {
251
- await new SdCliWorkspace(process.cwd())
252
- .publishAsync({
253
- noBuild: argv.noBuild,
254
- confFileRelPath: argv.config ?? "simplysm.json",
255
- optNames: argv.options ?? [],
256
- pkgs: argv.packages ?? []
257
- });
258
- if (!argv.noBuild) {
259
- process.exit(0);
260
- }
261
- }
262
- else if (argv._[0] === "enc-file") {
263
- await new SdCliFileCrypto().encryptAsync(argv.file!);
264
- }
265
- else if (argv._[0] === "dec-file") {
266
- await new SdCliFileCrypto().decryptAsync(argv.file!);
267
- }
268
- else {
269
- throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
270
- }
271
- })().catch((err) => {
272
- logger.error(err);
273
- process.exit(1);
274
- });
1
+ #!/usr/bin/env node --experimental-specifier-resolution=node --experimental-import-meta-resolve
2
+
3
+ import yargs from "yargs";
4
+ import { hideBin } from "yargs/helpers";
5
+ import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
6
+ import { SdCliWorkspace } from "../entry-points/SdCliWorkspace";
7
+ import { SdCliLocalUpdate } from "../entry-points/SdCliLocalUpdate";
8
+ import { SdCliNpm } from "../entry-points/SdCliNpm";
9
+ import { SdCliPrepare } from "../entry-points/SdCliPrepare";
10
+ import { SdCliFileCrypto } from "../entry-points/SdCliFileCrypto";
11
+ import { SdCliCordova } from "../build-tool/SdCliCordova";
12
+ import { SdCliElectron } from "../build-tool/SdCliElectron";
13
+
14
+ Error.stackTraceLimit = Infinity;
15
+
16
+ const argv = yargs(hideBin(process.argv))
17
+ .version(false)
18
+ .help("help", "도움말")
19
+ .alias("help", "h")
20
+ .options({
21
+ debug: {
22
+ type: "boolean",
23
+ describe: "디버그 로그를 표시할 것인지 여부",
24
+ default: false
25
+ }
26
+ })
27
+ .command(
28
+ "prepare",
29
+ "sd-cli 준비",
30
+ (cmd) => cmd.version(false)
31
+ )
32
+ .command(
33
+ "update",
34
+ "패키지 업데이트 (yarn update)",
35
+ (cmd) => cmd.version(false)
36
+ )
37
+ .command(
38
+ "local-update",
39
+ "로컬 라이브러리 업데이트를 수행합니다.",
40
+ (cmd) => cmd.version(false)
41
+ .options({
42
+ config: {
43
+ type: "string",
44
+ describe: "simplysm.json 파일 경로"
45
+ }
46
+ })
47
+ )
48
+ .command(
49
+ "watch",
50
+ "프로젝트의 각 패키지에 대한 변경감지 빌드를 수행합니다.",
51
+ (cmd) => cmd.version(false)
52
+ .options({
53
+ config: {
54
+ type: "string",
55
+ describe: "simplysm.json 파일 경로"
56
+ },
57
+ options: {
58
+ type: "string",
59
+ array: true,
60
+ describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
61
+ },
62
+ packages: {
63
+ type: "string",
64
+ array: true,
65
+ describe: "수행할 패키지 설정"
66
+ }
67
+ })
68
+ )
69
+ .command(
70
+ "run-electron <package> <url>",
71
+ "변경감지중인 플랫폼을 ELECTRON 앱 형태로 띄웁니다.",
72
+ (cmd) => cmd
73
+ .positional("package", {
74
+ type: "string",
75
+ describe: "패키지명",
76
+ demandOption: true
77
+ })
78
+ .positional("url", {
79
+ type: "string",
80
+ describe: "Webview로 오픈할 URL",
81
+ demandOption: true
82
+ })
83
+ .options({
84
+ config: {
85
+ type: "string",
86
+ describe: "simplysm.json 파일 경로"
87
+ },
88
+ options: {
89
+ type: "string",
90
+ array: true,
91
+ describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
92
+ }
93
+ })
94
+ )
95
+ .command(
96
+ "run-cordova <platform> <package> <url>",
97
+ "변경감지중인 플랫폼을 코도바 디바이스에 앱 형태로 띄웁니다.",
98
+ (cmd) => cmd
99
+ .positional("platform", {
100
+ type: "string",
101
+ describe: "빌드 플랫폼(android,...)",
102
+ demandOption: true
103
+ })
104
+ .positional("package", {
105
+ type: "string",
106
+ describe: "패키지명",
107
+ demandOption: true
108
+ })
109
+ .positional("url", {
110
+ type: "string",
111
+ describe: "Webview로 오픈할 URL",
112
+ demandOption: true
113
+ })
114
+ )
115
+ .command(
116
+ "build",
117
+ "프로젝트의 각 패키지에 대한 빌드를 수행합니다.",
118
+ (cmd) => cmd.version(false)
119
+ .options({
120
+ config: {
121
+ type: "string",
122
+ describe: "simplysm.json 파일 경로"
123
+ },
124
+ options: {
125
+ type: "string",
126
+ array: true,
127
+ describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
128
+ },
129
+ packages: {
130
+ type: "string",
131
+ array: true,
132
+ describe: "수행할 패키지 설정"
133
+ }
134
+ })
135
+ )
136
+ .command(
137
+ "publish",
138
+ "프로젝트의 각 패키지를 배포합니다.",
139
+ (cmd) => cmd.version(false)
140
+ .options({
141
+ noBuild: {
142
+ type: "boolean",
143
+ describe: "빌드를 하지않고 배포합니다.",
144
+ default: false
145
+ },
146
+ config: {
147
+ type: "string",
148
+ describe: "simplysm.json 파일 경로"
149
+ },
150
+ options: {
151
+ type: "string",
152
+ array: true,
153
+ describe: "옵션 설정 (설정파일에서 @로 시작하는 부분)"
154
+ },
155
+ packages: {
156
+ type: "string",
157
+ array: true,
158
+ describe: "수행할 패키지 설정"
159
+ }
160
+ })
161
+ )
162
+ .command(
163
+ "enc-file <file>",
164
+ "파일을 암호화 합니다.",
165
+ (cmd) => cmd.version(false)
166
+ .positional("file", {
167
+ type: "string",
168
+ describe: "암호화할 파일명"
169
+ })
170
+ )
171
+ .command(
172
+ "dec-file <file>",
173
+ "파일을 복호화 합니다.",
174
+ (cmd) => cmd.version(false)
175
+ .positional("file", {
176
+ type: "string",
177
+ describe: "암호화된 파일명"
178
+ })
179
+ )
180
+ .parseSync();
181
+
182
+ if (argv.debug) {
183
+ process.env["SD_CLI_LOGGER_SEVERITY"] = "DEBUG";
184
+
185
+ Logger.setConfig({
186
+ console: {
187
+ level: LoggerSeverity.debug
188
+ }
189
+ });
190
+ }
191
+ else {
192
+ Logger.setConfig({
193
+ dot: true
194
+ });
195
+ }
196
+
197
+ const logger = Logger.get(["simplysm", "sd-cli", "bin", "sd-cli"]);
198
+
199
+ (async () => {
200
+ if (argv._[0] === "prepare") {
201
+ await new SdCliPrepare()
202
+ .prepareAsync();
203
+ }
204
+ else if (argv._[0] === "update") {
205
+ await new SdCliNpm(process.cwd())
206
+ .updateAsync();
207
+ }
208
+ else if (argv._[0] === "local-update") {
209
+ await new SdCliLocalUpdate(process.cwd())
210
+ .runAsync({
211
+ confFileRelPath: argv.config ?? "simplysm.json"
212
+ });
213
+ }
214
+ else if (argv._[0] === "watch") {
215
+ await new SdCliWorkspace(process.cwd())
216
+ .watchAsync({
217
+ confFileRelPath: argv.config ?? "simplysm.json",
218
+ optNames: argv.options ?? [],
219
+ pkgs: argv.packages ?? []
220
+ });
221
+ }
222
+ else if (argv._[0] === "run-electron") {
223
+ await new SdCliElectron(process.cwd())
224
+ .runWebviewOnDeviceAsync(
225
+ argv.package,
226
+ argv.url,
227
+ {
228
+ confFileRelPath: argv.config ?? "simplysm.json",
229
+ optNames: argv.options ?? []
230
+ }
231
+ );
232
+ }
233
+ else if (argv._[0] === "run-cordova") {
234
+ await SdCliCordova.runWebviewOnDeviceAsync(
235
+ process.cwd(),
236
+ argv.platform as "browser" | "android",
237
+ argv.package,
238
+ argv.url
239
+ );
240
+ }
241
+ else if (argv._[0] === "build") {
242
+ await new SdCliWorkspace(process.cwd())
243
+ .buildAsync({
244
+ confFileRelPath: argv.config ?? "simplysm.json",
245
+ optNames: argv.options ?? [],
246
+ pkgs: argv.packages ?? []
247
+ });
248
+ process.exit(0);
249
+ }
250
+ else if (argv._[0] === "publish") {
251
+ await new SdCliWorkspace(process.cwd())
252
+ .publishAsync({
253
+ noBuild: argv.noBuild,
254
+ confFileRelPath: argv.config ?? "simplysm.json",
255
+ optNames: argv.options ?? [],
256
+ pkgs: argv.packages ?? []
257
+ });
258
+ if (!argv.noBuild) {
259
+ process.exit(0);
260
+ }
261
+ }
262
+ else if (argv._[0] === "enc-file") {
263
+ await new SdCliFileCrypto().encryptAsync(argv.file!);
264
+ }
265
+ else if (argv._[0] === "dec-file") {
266
+ await new SdCliFileCrypto().decryptAsync(argv.file!);
267
+ }
268
+ else {
269
+ throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
270
+ }
271
+ })().catch((err) => {
272
+ logger.error(err);
273
+ process.exit(1);
274
+ });