@simplysm/sd-cli 12.7.7 → 12.7.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.
- package/dist/entry/sd-cli-ai-command.js +21 -22
- package/dist/entry/sd-cli-ai-command.js.map +1 -1
- package/dist/entry/sd-cli-cordova.d.ts +1 -1
- package/dist/entry/sd-cli-cordova.js +20 -14
- package/dist/entry/sd-cli-cordova.js.map +1 -1
- package/dist/entry/sd-cli-electron.d.ts +1 -1
- package/dist/entry/sd-cli-electron.js +2 -4
- package/dist/entry/sd-cli-electron.js.map +1 -1
- package/dist/entry/sd-cli-local-update.js +0 -1
- package/dist/entry/sd-cli-local-update.js.map +1 -1
- package/dist/entry/sd-cli-project.js +25 -16
- package/dist/entry/sd-cli-project.js.map +1 -1
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +1 -1
- package/dist/pkg-builders/client/sd-client.build-runner.d.ts +3 -3
- package/dist/pkg-builders/client/sd-client.build-runner.js +0 -3
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.d.ts +3 -3
- package/dist/pkg-builders/client/sd-ng.bundler.js +4 -10
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.d.ts +2 -2
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js +1 -4
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -1
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.d.ts +2 -2
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js +0 -3
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.d.ts +2 -2
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +0 -2
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.builder.d.ts +2 -2
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js +0 -1
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -1
- package/dist/pkg-builders/sd-multi.build-runner.d.ts +2 -2
- package/dist/pkg-builders/sd-multi.build-runner.js +0 -5
- package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.build-runner.d.ts +3 -3
- package/dist/pkg-builders/server/sd-server.build-runner.js +10 -8
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.bundler.d.ts +2 -2
- package/dist/pkg-builders/server/sd-server.bundler.js +0 -2
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.plugin-creator.d.ts +2 -2
- package/dist/pkg-builders/server/sd-server.plugin-creator.js +0 -3
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -1
- package/dist/ts-compiler/sd-ts-compiler.d.ts +2 -2
- package/dist/ts-compiler/sd-ts-compiler.js +0 -3
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -1
- package/dist/types/build-plugin.types.d.ts +1 -1
- package/dist/types/build-plugin.types.js +1 -2
- package/dist/types/build-plugin.types.js.map +1 -1
- package/dist/types/build-runner.types.d.ts +2 -2
- package/dist/types/build-runner.types.js +1 -2
- package/dist/types/build-runner.types.js.map +1 -1
- package/dist/types/build.types.d.ts +1 -1
- package/dist/types/build.types.js +1 -1
- package/dist/types/build.types.js.map +1 -1
- package/dist/types/ts-compiler.types.d.ts +3 -3
- package/dist/types/ts-compiler.types.js +1 -4
- package/dist/types/ts-compiler.types.js.map +1 -1
- package/dist/types/worker.types.d.ts +2 -2
- package/dist/types/worker.types.js +1 -2
- package/dist/types/worker.types.js.map +1 -1
- package/dist/utils/sd-cli-convert-message.utils.d.ts +2 -2
- package/dist/utils/sd-cli-convert-message.utils.js +0 -3
- package/dist/utils/sd-cli-convert-message.utils.js.map +1 -1
- package/dist/workers/build-runner.worker.js +0 -3
- package/dist/workers/build-runner.worker.js.map +1 -1
- package/dist/workers/server.worker.js +0 -1
- package/dist/workers/server.worker.js.map +1 -1
- package/package.json +6 -6
- package/src/entry/sd-cli-ai-command.ts +23 -25
- package/src/entry/sd-cli-cordova.ts +67 -38
- package/src/entry/sd-cli-electron.ts +4 -4
- package/src/entry/sd-cli-local-update.ts +1 -1
- package/src/entry/sd-cli-project.ts +67 -28
- package/src/pkg-builders/client/sd-cli-ng-routes.file-generator.ts +1 -1
- package/src/pkg-builders/client/sd-client.build-runner.ts +4 -4
- package/src/pkg-builders/client/sd-ng.bundler.ts +15 -15
- package/src/pkg-builders/client/sd-ng.plugin-creator.ts +4 -4
- package/src/pkg-builders/lib/sd-js-lib.build-runner.ts +2 -2
- package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +3 -3
- package/src/pkg-builders/lib/sd-ts-lib.builder.ts +2 -2
- package/src/pkg-builders/sd-multi.build-runner.ts +6 -6
- package/src/pkg-builders/server/sd-server.build-runner.ts +54 -38
- package/src/pkg-builders/server/sd-server.bundler.ts +4 -4
- package/src/pkg-builders/server/sd-server.plugin-creator.ts +3 -3
- package/src/ts-compiler/sd-ts-compiler.ts +6 -6
- package/src/types/build-plugin.types.ts +1 -1
- package/src/types/build-runner.types.ts +2 -2
- package/src/types/build.types.ts +1 -1
- package/src/types/ts-compiler.types.ts +3 -3
- package/src/types/worker.types.ts +2 -2
- package/src/utils/sd-cli-convert-message.utils.ts +2 -2
- package/src/workers/build-runner.worker.ts +3 -3
- package/src/workers/server.worker.ts +1 -1
|
@@ -2,10 +2,10 @@ import * as path from "path";
|
|
|
2
2
|
import { FsUtils, SdLogger, SdProcess } from "@simplysm/sd-core-node";
|
|
3
3
|
import xml2js from "xml2js";
|
|
4
4
|
import JSZip from "jszip";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { INpmConfig } from "../types/common-configs.types";
|
|
6
|
+
import { ISdClientBuilderCordovaConfig } from "../types/config.types";
|
|
7
7
|
|
|
8
|
-
const BIN_PATH = path.resolve(process.cwd(), "node_modules/.bin/cordova.cmd");
|
|
8
|
+
// const BIN_PATH = path.resolve(process.cwd(), "node_modules/.bin/cordova.cmd");
|
|
9
9
|
|
|
10
10
|
export class SdCliCordova {
|
|
11
11
|
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliCordova"]);
|
|
@@ -30,12 +30,13 @@ export class SdCliCordova {
|
|
|
30
30
|
|
|
31
31
|
if (FsUtils.exists(cordovaPath)) {
|
|
32
32
|
this._logger.log("이미 생성되어있는 '.cordova'를 사용합니다.");
|
|
33
|
-
}
|
|
34
|
-
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
await this._execAsync(`npx cordova telemetry on`, this._opt.pkgPath);
|
|
35
36
|
|
|
36
37
|
// 프로젝트 생성
|
|
37
38
|
await this._execAsync(
|
|
38
|
-
|
|
39
|
+
`npx cordova create "${cordovaPath}" "${this._opt.config.appId}" "${this._opt.config.appName}"`,
|
|
39
40
|
process.cwd(),
|
|
40
41
|
);
|
|
41
42
|
|
|
@@ -62,9 +63,10 @@ export class SdCliCordova {
|
|
|
62
63
|
if (!alreadyPlatforms.includes(platform)) {
|
|
63
64
|
// await this._execAsync(`${BIN_PATH} platform add ${platform}`, cordovaPath);
|
|
64
65
|
if (platform === "android") {
|
|
65
|
-
await this._execAsync(
|
|
66
|
-
}
|
|
67
|
-
|
|
66
|
+
await this._execAsync(`npx cordova platform add ${platform}@12.0.0`, cordovaPath);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
await this._execAsync(`npx cordova platform add ${platform}`, cordovaPath);
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -112,7 +114,7 @@ export class SdCliCordova {
|
|
|
112
114
|
// 미설치 플러그인들 설치
|
|
113
115
|
for (const usePlugin of usePlugins) {
|
|
114
116
|
if (!alreadyPlugins.some((item) => usePlugin === item.id || usePlugin === item.name)) {
|
|
115
|
-
await this._execAsync(
|
|
117
|
+
await this._execAsync(`npx cordova plugin add ${usePlugin}`, cordovaPath);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
|
|
@@ -122,7 +124,8 @@ export class SdCliCordova {
|
|
|
122
124
|
path.resolve(this._opt.pkgPath, this._opt.config.platform.android.sign.keystore),
|
|
123
125
|
path.resolve(cordovaPath, "android.keystore"),
|
|
124
126
|
);
|
|
125
|
-
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
126
129
|
FsUtils.remove(path.resolve(cordovaPath, "android.keystore"));
|
|
127
130
|
// SIGN을 안쓸경우 아래 파일이 생성되어 있으면 오류남
|
|
128
131
|
FsUtils.remove(path.resolve(cordovaPath, "platforms/android/release-signing.properties"));
|
|
@@ -132,21 +135,21 @@ export class SdCliCordova {
|
|
|
132
135
|
FsUtils.writeJson(path.resolve(cordovaPath, "build.json"), {
|
|
133
136
|
...(this._opt.config.platform?.android
|
|
134
137
|
? {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
},
|
|
138
|
+
android: {
|
|
139
|
+
release: {
|
|
140
|
+
packageType: this._opt.config.platform.android.bundle ? "bundle" : "apk",
|
|
141
|
+
...(this._opt.config.platform.android.sign
|
|
142
|
+
? {
|
|
143
|
+
keystore: path.resolve(cordovaPath, "android.keystore"),
|
|
144
|
+
storePassword: this._opt.config.platform.android.sign.storePassword,
|
|
145
|
+
alias: this._opt.config.platform.android.sign.alias,
|
|
146
|
+
password: this._opt.config.platform.android.sign.password,
|
|
147
|
+
keystoreType: this._opt.config.platform.android.sign.keystoreType,
|
|
148
|
+
}
|
|
149
|
+
: {}),
|
|
148
150
|
},
|
|
149
|
-
}
|
|
151
|
+
},
|
|
152
|
+
}
|
|
150
153
|
: {}),
|
|
151
154
|
});
|
|
152
155
|
|
|
@@ -156,7 +159,8 @@ export class SdCliCordova {
|
|
|
156
159
|
path.resolve(this._opt.pkgPath, this._opt.config.icon),
|
|
157
160
|
path.resolve(cordovaPath, "res/icons", path.basename(this._opt.config.icon)),
|
|
158
161
|
);
|
|
159
|
-
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
160
164
|
FsUtils.remove(path.resolve(cordovaPath, "res/icons"));
|
|
161
165
|
}
|
|
162
166
|
|
|
@@ -192,7 +196,14 @@ export class SdCliCordova {
|
|
|
192
196
|
|
|
193
197
|
// CONFIG: ICON 설정
|
|
194
198
|
if (this._opt.config.icon != null) {
|
|
195
|
-
configXml["widget"]["icon"] = [
|
|
199
|
+
configXml["widget"]["icon"] = [
|
|
200
|
+
{
|
|
201
|
+
$: {
|
|
202
|
+
src: "res/icons/"
|
|
203
|
+
+ path.basename(this._opt.config.icon),
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
];
|
|
196
207
|
}
|
|
197
208
|
|
|
198
209
|
// CONFIG: 접근허용 세팅
|
|
@@ -280,8 +291,8 @@ export class SdCliCordova {
|
|
|
280
291
|
"android:name": `android.permission.${perm.name}`,
|
|
281
292
|
...(perm.maxSdkVersion != null
|
|
282
293
|
? {
|
|
283
|
-
|
|
284
|
-
|
|
294
|
+
"android:maxSdkVersion": `${perm.maxSdkVersion}`,
|
|
295
|
+
}
|
|
285
296
|
: {}),
|
|
286
297
|
},
|
|
287
298
|
})),
|
|
@@ -306,7 +317,7 @@ export class SdCliCordova {
|
|
|
306
317
|
}*/
|
|
307
318
|
|
|
308
319
|
// 각 플랫폼 www 준비
|
|
309
|
-
await this._execAsync(
|
|
320
|
+
await this._execAsync(`npx cordova prepare`, cordovaPath);
|
|
310
321
|
}
|
|
311
322
|
|
|
312
323
|
public async buildAsync(outPath: string): Promise<void> {
|
|
@@ -315,7 +326,7 @@ export class SdCliCordova {
|
|
|
315
326
|
// 실행
|
|
316
327
|
const buildType = this._opt.config.debug ? "debug" : "release";
|
|
317
328
|
for (const platform of this._platforms) {
|
|
318
|
-
await this._execAsync(
|
|
329
|
+
await this._execAsync(`npx cordova build ${platform} --${buildType}`, cordovaPath);
|
|
319
330
|
}
|
|
320
331
|
|
|
321
332
|
for (const platform of Object.keys(this._opt.config.platform ?? {})) {
|
|
@@ -327,11 +338,18 @@ export class SdCliCordova {
|
|
|
327
338
|
? `app-${buildType}.apk`
|
|
328
339
|
: `app-${buildType}-unsigned.apk`;
|
|
329
340
|
const latestDistApkFileName = path.basename(
|
|
330
|
-
`${this._opt.config.appName}${this._opt.config.platform!.android!.sign
|
|
341
|
+
`${this._opt.config.appName}${this._opt.config.platform!.android!.sign
|
|
342
|
+
? ""
|
|
343
|
+
: "-unsigned"}-latest.apk`,
|
|
331
344
|
);
|
|
332
345
|
FsUtils.mkdirs(targetOutPath);
|
|
333
346
|
FsUtils.copy(
|
|
334
|
-
path.resolve(
|
|
347
|
+
path.resolve(
|
|
348
|
+
cordovaPath,
|
|
349
|
+
"platforms/android/app/build/outputs/apk",
|
|
350
|
+
buildType,
|
|
351
|
+
apkFileName,
|
|
352
|
+
),
|
|
335
353
|
path.resolve(targetOutPath, latestDistApkFileName),
|
|
336
354
|
);
|
|
337
355
|
}
|
|
@@ -344,7 +362,12 @@ export class SdCliCordova {
|
|
|
344
362
|
const fileBuffer = FsUtils.readFileBuffer(wwwFile);
|
|
345
363
|
zip.file(relFilePath, fileBuffer);
|
|
346
364
|
}
|
|
347
|
-
const platformWwwFiles = FsUtils.glob(path.resolve(
|
|
365
|
+
const platformWwwFiles = FsUtils.glob(path.resolve(
|
|
366
|
+
cordovaPath,
|
|
367
|
+
"platforms",
|
|
368
|
+
platform,
|
|
369
|
+
"platform_www/**/*",
|
|
370
|
+
), {
|
|
348
371
|
nodir: true,
|
|
349
372
|
});
|
|
350
373
|
for (const platformWwwFile of platformWwwFiles) {
|
|
@@ -363,7 +386,11 @@ export class SdCliCordova {
|
|
|
363
386
|
}
|
|
364
387
|
}
|
|
365
388
|
|
|
366
|
-
public static async runWebviewOnDeviceAsync(opt: {
|
|
389
|
+
public static async runWebviewOnDeviceAsync(opt: {
|
|
390
|
+
platform: string;
|
|
391
|
+
pkgName: string;
|
|
392
|
+
url?: string
|
|
393
|
+
}): Promise<void> {
|
|
367
394
|
const cordovaPath = path.resolve(process.cwd(), `packages/${opt.pkgName}/.cordova/`);
|
|
368
395
|
|
|
369
396
|
if (opt.url !== undefined) {
|
|
@@ -371,11 +398,13 @@ export class SdCliCordova {
|
|
|
371
398
|
FsUtils.mkdirs(path.resolve(cordovaPath, "www"));
|
|
372
399
|
FsUtils.writeFile(
|
|
373
400
|
path.resolve(cordovaPath, "www/index.html"),
|
|
374
|
-
`'${opt.url}'로 이동중... <script>setTimeout(function () {window.location.href = "${opt.url.replace(
|
|
401
|
+
`'${opt.url}'로 이동중... <script>setTimeout(function () {window.location.href = "${opt.url.replace(
|
|
402
|
+
/\/$/,
|
|
403
|
+
"",
|
|
404
|
+
)}/${opt.pkgName}/cordova/"}, 3000);</script>`.trim(),
|
|
375
405
|
);
|
|
376
406
|
}
|
|
377
407
|
|
|
378
|
-
|
|
379
|
-
await SdProcess.spawnAsync(`${binPath} run ${opt.platform} --device`, { cwd: cordovaPath }, true);
|
|
408
|
+
await SdProcess.spawnAsync(`npx cordova run ${opt.platform} --device`, { cwd: cordovaPath });
|
|
380
409
|
}
|
|
381
410
|
}
|
|
@@ -2,8 +2,8 @@ import { FsUtils, SdLogger, SdProcess } from "@simplysm/sd-core-node";
|
|
|
2
2
|
import { pathToFileURL } from "url";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import electronBuilder from "electron-builder";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ISdClientBuilderElectronConfig, ISdProjectConfig } from "../types/config.types";
|
|
6
|
+
import { INpmConfig } from "../types/common-configs.types";
|
|
7
7
|
|
|
8
8
|
export class SdCliElectron {
|
|
9
9
|
static async runAsync(opt: { confFileRelPath: string; optNames: string[]; pkgName: string }): Promise<void> {
|
|
@@ -49,7 +49,7 @@ export class SdCliElectron {
|
|
|
49
49
|
await SdProcess.spawnAsync(`npm install`, { cwd: electronPath }, true);
|
|
50
50
|
|
|
51
51
|
logger.log(`electron rebuild`);
|
|
52
|
-
await SdProcess.spawnAsync(`electron-rebuild`, { cwd: electronPath }, true);
|
|
52
|
+
await SdProcess.spawnAsync(`npx electron-rebuild`, { cwd: electronPath }, true);
|
|
53
53
|
|
|
54
54
|
/*for (const reinstallPkgName of reinstallPkgNames) {
|
|
55
55
|
if (FsUtil.exists(path.resolve(electronPath, "node_modules", reinstallPkgName, "binding.gyp"))) {
|
|
@@ -63,7 +63,7 @@ export class SdCliElectron {
|
|
|
63
63
|
}*/
|
|
64
64
|
|
|
65
65
|
logger.log("electron...");
|
|
66
|
-
await SdProcess.spawnAsync(`electron .`, { cwd: electronPath }, true);
|
|
66
|
+
await SdProcess.spawnAsync(`npx electron .`, { cwd: electronPath }, true);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
static async buildForDevAsync(opt: { confFileRelPath: string; optNames: string[]; pkgName: string }): Promise<void> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FsUtils, SdLogger, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { pathToFileURL } from "url";
|
|
4
|
-
import {
|
|
4
|
+
import { ISdProjectConfig } from "../types/config.types";
|
|
5
5
|
|
|
6
6
|
export class SdCliLocalUpdate {
|
|
7
7
|
static async runAsync(opt: { confFileRelPath: string; optNames: string[] }): Promise<void> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { FsUtils,
|
|
2
|
+
import { FsUtils, PathUtils, SdLogger, SdProcess } from "@simplysm/sd-core-node";
|
|
3
3
|
import { pathToFileURL } from "url";
|
|
4
4
|
import semver from "semver";
|
|
5
5
|
import { NeverEntryError, StringUtils, Wait } from "@simplysm/sd-core-common";
|
|
@@ -8,9 +8,9 @@ import { SdCliLocalUpdate } from "./sd-cli-local-update";
|
|
|
8
8
|
import xml2js from "xml2js";
|
|
9
9
|
import { SdMultiBuildRunner } from "../pkg-builders/sd-multi.build-runner";
|
|
10
10
|
import { SdCliConvertMessageUtils } from "../utils/sd-cli-convert-message.utils";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { ISdProjectConfig, TSdPackageConfig } from "../types/config.types";
|
|
12
|
+
import { INpmConfig } from "../types/common-configs.types";
|
|
13
|
+
import { ISdBuildMessage } from "../types/build.types";
|
|
14
14
|
|
|
15
15
|
export class SdCliProject {
|
|
16
16
|
static async watchAsync(opt: {
|
|
@@ -22,7 +22,10 @@ export class SdCliProject {
|
|
|
22
22
|
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliProject", "watchAsync"]);
|
|
23
23
|
|
|
24
24
|
logger.debug("프로젝트 설정 가져오기...");
|
|
25
|
-
const projConf = (await import(pathToFileURL(path.resolve(
|
|
25
|
+
const projConf = (await import(pathToFileURL(path.resolve(
|
|
26
|
+
process.cwd(),
|
|
27
|
+
opt.confFileRelPath,
|
|
28
|
+
)).href)).default(
|
|
26
29
|
true,
|
|
27
30
|
opt.optNames,
|
|
28
31
|
) as ISdProjectConfig;
|
|
@@ -77,11 +80,18 @@ export class SdCliProject {
|
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
static async buildAsync(opt: {
|
|
83
|
+
static async buildAsync(opt: {
|
|
84
|
+
confFileRelPath: string;
|
|
85
|
+
optNames: string[];
|
|
86
|
+
pkgNames: string[]
|
|
87
|
+
}): Promise<void> {
|
|
81
88
|
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliProject", "buildAsync"]);
|
|
82
89
|
|
|
83
90
|
logger.debug("프로젝트 설정 가져오기...");
|
|
84
|
-
const projConf = (await import(pathToFileURL(path.resolve(
|
|
91
|
+
const projConf = (await import(pathToFileURL(path.resolve(
|
|
92
|
+
process.cwd(),
|
|
93
|
+
opt.confFileRelPath,
|
|
94
|
+
)).href)).default(
|
|
85
95
|
false,
|
|
86
96
|
opt.optNames,
|
|
87
97
|
) as ISdProjectConfig;
|
|
@@ -93,7 +103,8 @@ export class SdCliProject {
|
|
|
93
103
|
if (!projNpmConf.workspaces) {
|
|
94
104
|
throw new Error("프로젝트 package.json에 workspaces가 설정되어있지 않습니다.");
|
|
95
105
|
}
|
|
96
|
-
const allPkgPaths = projNpmConf.workspaces.mapMany((item) => FsUtils.glob(item))
|
|
106
|
+
const allPkgPaths = projNpmConf.workspaces.mapMany((item) => FsUtils.glob(item))
|
|
107
|
+
.map((item) => PathUtils.norm(item));
|
|
97
108
|
let pkgPaths = allPkgPaths.filter((pkgPath) => path.basename(pkgPath) in projConf.packages);
|
|
98
109
|
if (opt.pkgNames.length !== 0) {
|
|
99
110
|
pkgPaths = pkgPaths.filter((pkgPath) => opt.pkgNames.includes(path.basename(pkgPath)));
|
|
@@ -124,7 +135,10 @@ export class SdCliProject {
|
|
|
124
135
|
const logger = SdLogger.get(["simplysm", "sd-cli", "SdCliProject", "publishAsync"]);
|
|
125
136
|
|
|
126
137
|
logger.debug("프로젝트 설정 가져오기...");
|
|
127
|
-
const projConf = (await import(pathToFileURL(path.resolve(
|
|
138
|
+
const projConf = (await import(pathToFileURL(path.resolve(
|
|
139
|
+
process.cwd(),
|
|
140
|
+
opt.confFileRelPath,
|
|
141
|
+
)).href)).default(
|
|
128
142
|
false,
|
|
129
143
|
opt.optNames,
|
|
130
144
|
) as ISdProjectConfig;
|
|
@@ -163,19 +177,25 @@ export class SdCliProject {
|
|
|
163
177
|
await this._upgradeVersionAsync(projNpmConf, allPkgPaths);
|
|
164
178
|
|
|
165
179
|
// 빌드
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
try {
|
|
181
|
+
if (!opt.noBuild) {
|
|
182
|
+
logger.debug("빌드 프로세스 시작...");
|
|
183
|
+
const multiBuildRunner = new SdMultiBuildRunner();
|
|
184
|
+
|
|
185
|
+
const messages = await pkgPaths.parallelAsync(async (pkgPath) => {
|
|
186
|
+
return await multiBuildRunner.runAsync({
|
|
187
|
+
cmd: "build",
|
|
188
|
+
pkgPath,
|
|
189
|
+
projConf: projConf,
|
|
190
|
+
});
|
|
175
191
|
});
|
|
176
|
-
});
|
|
177
192
|
|
|
178
|
-
|
|
193
|
+
this.#logging(messages.mapMany(), logger);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
await SdProcess.spawnAsync("git checkout .");
|
|
198
|
+
throw err;
|
|
179
199
|
}
|
|
180
200
|
|
|
181
201
|
// GIT 사용중일경우, 새 버전 커밋 및 TAG 생성
|
|
@@ -217,7 +237,8 @@ export class SdCliProject {
|
|
|
217
237
|
return process.env[envName] ?? item;
|
|
218
238
|
});
|
|
219
239
|
await SdProcess.spawnAsync(script);
|
|
220
|
-
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
221
242
|
throw new NeverEntryError();
|
|
222
243
|
}
|
|
223
244
|
}
|
|
@@ -226,10 +247,14 @@ export class SdCliProject {
|
|
|
226
247
|
logger.info(`모든 배포가 완료되었습니다. (v${projNpmConf.version})`);
|
|
227
248
|
}
|
|
228
249
|
|
|
229
|
-
private static async _publishPkgAsync(
|
|
250
|
+
private static async _publishPkgAsync(
|
|
251
|
+
pkgPath: string,
|
|
252
|
+
pkgPubConf: TSdPackageConfig["publish"],
|
|
253
|
+
): Promise<void> {
|
|
230
254
|
if (pkgPubConf === "npm") {
|
|
231
255
|
await SdProcess.spawnAsync("yarn npm publish --access public", { cwd: pkgPath });
|
|
232
|
-
}
|
|
256
|
+
}
|
|
257
|
+
else if (pkgPubConf?.type === "local-directory") {
|
|
233
258
|
const pkgNpmConf = FsUtils.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
|
|
234
259
|
|
|
235
260
|
const targetRootPath = pkgPubConf.path.replace(/%([^%]*)%/g, (item) => {
|
|
@@ -253,7 +278,13 @@ export class SdCliProject {
|
|
|
253
278
|
const targetPath = PathUtils.posix(targetRootPath, relativeFilePath);
|
|
254
279
|
FsUtils.copy(filePath, targetPath);
|
|
255
280
|
}
|
|
256
|
-
}
|
|
281
|
+
}
|
|
282
|
+
else if (pkgPubConf?.type
|
|
283
|
+
=== "ftp"
|
|
284
|
+
|| pkgPubConf?.type
|
|
285
|
+
=== "ftps"
|
|
286
|
+
|| pkgPubConf?.type
|
|
287
|
+
=== "sftp") {
|
|
257
288
|
const ftp = await SdStorage.connectAsync(pkgPubConf.type, {
|
|
258
289
|
host: pkgPubConf.host,
|
|
259
290
|
port: pkgPubConf.port,
|
|
@@ -262,7 +293,8 @@ export class SdCliProject {
|
|
|
262
293
|
});
|
|
263
294
|
await ftp.uploadDirAsync(path.resolve(pkgPath, "dist"), pkgPubConf.path ?? "/");
|
|
264
295
|
await ftp.closeAsync();
|
|
265
|
-
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
266
298
|
throw new NeverEntryError();
|
|
267
299
|
}
|
|
268
300
|
}
|
|
@@ -280,7 +312,10 @@ export class SdCliProject {
|
|
|
280
312
|
process.stdout.clearLine(0);
|
|
281
313
|
}
|
|
282
314
|
|
|
283
|
-
private static async _upgradeVersionAsync(
|
|
315
|
+
private static async _upgradeVersionAsync(
|
|
316
|
+
projNpmConf: INpmConfig,
|
|
317
|
+
allPkgPaths: string[],
|
|
318
|
+
): Promise<void> {
|
|
284
319
|
// 작업공간 package.json 버전 설정
|
|
285
320
|
const newVersion = semver.inc(projNpmConf.version, "patch")!;
|
|
286
321
|
projNpmConf.version = newVersion;
|
|
@@ -321,10 +356,14 @@ export class SdCliProject {
|
|
|
321
356
|
|
|
322
357
|
if (FsUtils.exists(path.resolve(pkgPath, "plugin.xml"))) {
|
|
323
358
|
const cordovaPluginConfFilePath = path.resolve(pkgPath, "plugin.xml");
|
|
324
|
-
const cordovaPluginConfXml = await xml2js.parseStringPromise(FsUtils.readFile(
|
|
359
|
+
const cordovaPluginConfXml = await xml2js.parseStringPromise(FsUtils.readFile(
|
|
360
|
+
cordovaPluginConfFilePath));
|
|
325
361
|
cordovaPluginConfXml.plugin.$.version = newVersion;
|
|
326
362
|
|
|
327
|
-
FsUtils.writeFile(
|
|
363
|
+
FsUtils.writeFile(
|
|
364
|
+
cordovaPluginConfFilePath,
|
|
365
|
+
new xml2js.Builder().buildObject(cordovaPluginConfXml),
|
|
366
|
+
);
|
|
328
367
|
}
|
|
329
368
|
});
|
|
330
369
|
}
|
|
@@ -77,7 +77,7 @@ export class SdCliNgRoutesFileGenerator {
|
|
|
77
77
|
const routes = fn(result, 2);
|
|
78
78
|
|
|
79
79
|
const content = `
|
|
80
|
-
import
|
|
80
|
+
import { Routes } from "@angular/router";
|
|
81
81
|
${imports.join("\n")}
|
|
82
82
|
export const routes: Routes = [
|
|
83
83
|
${routes}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import { FsUtils, SdLogger, PathUtils, SdFsWatcher,
|
|
2
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher, TNormPath } from "@simplysm/sd-core-node";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { SdNgBundler } from "./sd-ng.bundler";
|
|
5
5
|
import { SdCliNgRoutesFileGenerator } from "./sd-cli-ng-routes.file-generator";
|
|
6
6
|
import { SdCliCordova } from "../../entry/sd-cli-cordova";
|
|
7
7
|
import { SdCliElectron } from "../../entry/sd-cli-electron";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { ISdClientPackageConfig, ISdProjectConfig } from "../../types/config.types";
|
|
9
|
+
import { INpmConfig } from "../../types/common-configs.types";
|
|
10
|
+
import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.types";
|
|
11
11
|
|
|
12
12
|
export class SdClientBuildRunner extends EventEmitter {
|
|
13
13
|
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import esbuild, {
|
|
3
|
-
import { FsUtils, PathUtils, SdLogger,
|
|
2
|
+
import esbuild, { Metafile } from "esbuild";
|
|
3
|
+
import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import nodeStdLibBrowser from "node-stdlib-browser";
|
|
6
6
|
import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
transformSupportedBrowsersToTargets,
|
|
14
14
|
} from "@angular/build/src/tools/esbuild/utils";
|
|
15
15
|
import {
|
|
16
|
-
|
|
16
|
+
BuildOutputFile,
|
|
17
17
|
BuildOutputFileType,
|
|
18
|
-
|
|
18
|
+
InitialFileRecord,
|
|
19
19
|
} from "@angular/build/src/tools/esbuild/bundler-context";
|
|
20
20
|
import { extractLicenses } from "@angular/build/src/tools/esbuild/license-extractor";
|
|
21
21
|
import {
|
|
22
|
-
|
|
22
|
+
HintMode,
|
|
23
23
|
IndexHtmlGenerator,
|
|
24
|
-
|
|
24
|
+
IndexHtmlProcessResult,
|
|
25
25
|
} from "@angular/build/src/utils/index-file/index-html-generator";
|
|
26
|
-
import {
|
|
26
|
+
import { Entrypoint } from "@angular/build/src/utils/index-file/augment-index-html";
|
|
27
27
|
import { CrossOrigin } from "@angular/build/src/builders/application/schema";
|
|
28
28
|
import { augmentAppWithServiceWorkerEsbuild } from "@angular/build/src/utils/service-worker";
|
|
29
29
|
import {
|
|
@@ -40,10 +40,10 @@ import {
|
|
|
40
40
|
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
41
41
|
import { createSdNgPlugin } from "./sd-ng.plugin-creator";
|
|
42
42
|
import { SdCliPerformanceTimer } from "../../utils/sd-cli-performance-time";
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
43
|
+
import { INpmConfig } from "../../types/common-configs.types";
|
|
44
|
+
import { ISdClientBuilderCordovaConfig } from "../../types/config.types";
|
|
45
|
+
import { ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
|
|
46
|
+
import { ISdBuildMessage } from "../../types/build.types";
|
|
47
47
|
import nodeModule from "node:module";
|
|
48
48
|
|
|
49
49
|
export class SdNgBundler {
|
|
@@ -428,7 +428,7 @@ export class SdNgBundler {
|
|
|
428
428
|
pure: ["forwardRef"],
|
|
429
429
|
outdir: this._opt.pkgPath,
|
|
430
430
|
outExtension: undefined,
|
|
431
|
-
sourcemap:
|
|
431
|
+
sourcemap: this._opt.dev,
|
|
432
432
|
chunkNames: "[name]-[hash]",
|
|
433
433
|
tsconfig: this.#tsConfigFilePath,
|
|
434
434
|
write: false,
|
|
@@ -540,7 +540,7 @@ export class SdNgBundler {
|
|
|
540
540
|
private _getStyleContext(): SdNgBundlerContext {
|
|
541
541
|
const pluginFactory = new StylesheetPluginFactory(
|
|
542
542
|
{
|
|
543
|
-
sourcemap:
|
|
543
|
+
sourcemap: this._opt.dev,
|
|
544
544
|
includePaths: [],
|
|
545
545
|
},
|
|
546
546
|
this.#styleLoadResultCache,
|
|
@@ -554,7 +554,7 @@ export class SdNgBundler {
|
|
|
554
554
|
logLevel: "silent",
|
|
555
555
|
minify: !this._opt.dev,
|
|
556
556
|
metafile: true,
|
|
557
|
-
sourcemap:
|
|
557
|
+
sourcemap: this._opt.dev,
|
|
558
558
|
outdir: this._opt.pkgPath,
|
|
559
559
|
write: false,
|
|
560
560
|
platform: "browser",
|
|
@@ -588,7 +588,7 @@ export class SdNgBundler {
|
|
|
588
588
|
logLevel: "silent",
|
|
589
589
|
minify: !this._opt.dev,
|
|
590
590
|
outdir: this._opt.pkgPath,
|
|
591
|
-
sourcemap:
|
|
591
|
+
sourcemap: this._opt.dev,
|
|
592
592
|
tsconfig: this.#tsConfigFilePath,
|
|
593
593
|
write: false,
|
|
594
594
|
preserveSymlinks: false,
|
|
@@ -2,11 +2,11 @@ import esbuild from "esbuild";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
4
|
import { JavaScriptTransformer } from "@angular/build/src/tools/esbuild/javascript-transformer";
|
|
5
|
-
import { SdLogger, PathUtils,
|
|
5
|
+
import { SdLogger, PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
6
6
|
import { SdCliPerformanceTimer } from "../../utils/sd-cli-performance-time";
|
|
7
7
|
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
|
|
9
|
+
import { ISdTsCompilerResult } from "../../types/ts-compiler.types";
|
|
10
10
|
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
11
11
|
|
|
12
12
|
export function createSdNgPlugin(conf: {
|
|
@@ -106,7 +106,7 @@ export function createSdNgPlugin(conf: {
|
|
|
106
106
|
const javascriptTransformer = new JavaScriptTransformer(
|
|
107
107
|
{
|
|
108
108
|
thirdPartySourcemaps: conf.dev,
|
|
109
|
-
sourcemap:
|
|
109
|
+
sourcemap: conf.dev,
|
|
110
110
|
jit: false,
|
|
111
111
|
advancedOptimizations: true,
|
|
112
112
|
},
|
|
@@ -3,8 +3,8 @@ import path from "path";
|
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
4
|
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
5
5
|
// import { TSdLintWorkerType } from "../../types/workers.type";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ISdProjectConfig } from "../../types/config.types";
|
|
7
|
+
import { ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
8
|
import { ESLint } from "eslint";
|
|
9
9
|
|
|
10
10
|
export class SdJsLibBuildRunner extends EventEmitter {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FsUtils, SdLogger, PathUtils, SdFsWatcher,
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher, TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
4
|
import { SdCliIndexFileGenerator } from "./sd-cli-index.file-generator";
|
|
5
5
|
import { SdTsLibBuilder } from "./sd-ts-lib.builder";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ISdLibPackageConfig, ISdProjectConfig } from "../../types/config.types";
|
|
7
|
+
import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
8
|
|
|
9
9
|
export class SdTsLibBuildRunner extends EventEmitter {
|
|
10
10
|
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
3
|
-
import { FsUtils, PathUtils,
|
|
4
|
-
import {
|
|
3
|
+
import { FsUtils, PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
4
|
+
import { ISdBuildMessage } from "../../types/build.types";
|
|
5
5
|
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
6
6
|
|
|
7
7
|
export class SdTsLibBuilder {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FsUtils, SdLogger, PathUtils, SdWorker,
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdWorker, TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { ISdServerPackageConfig } from "../types/config.types";
|
|
5
|
+
import { ISdBuildMessage, ISdBuildRunnerResult } from "../types/build.types";
|
|
6
|
+
import { TSdBuildRunnerWorkerType, TServerWorkerType } from "../types/worker.types";
|
|
7
|
+
import { INpmConfig } from "../types/common-configs.types";
|
|
8
|
+
import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.types";
|
|
9
9
|
|
|
10
10
|
export class SdMultiBuildRunner extends EventEmitter {
|
|
11
11
|
#logger = SdLogger.get(["simplysm", "sd-cli", "SdMultiBuildRunner"]);
|