@simplysm/sd-cli 7.0.266 → 7.0.269
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/README.md +1 -1
- package/dist/bin/sd-cli.mjs +11 -11
- package/dist/build-tool/SdCliCordova.mjs +2 -2
- package/dist/build-tool/SdCliElectron.mjs +2 -2
- package/dist/builder/SdCliClientBuilder.d.ts +2 -2
- package/dist/builder/SdCliClientBuilder.mjs +28 -28
- package/dist/builder/SdCliServerBuilder.d.ts +2 -2
- package/dist/builder/SdCliServerBuilder.mjs +18 -18
- package/dist/builder/SdCliTsLibBuilder.d.ts +2 -2
- package/dist/builder/SdCliTsLibBuilder.mjs +7 -7
- package/dist/entry-points/{SdCliWorkspace.d.ts → SdCliProject.d.ts} +1 -1
- package/dist/entry-points/SdCliProject.mjs +416 -0
- package/dist/entry-points/SdCliProjectGenerator.mjs +3 -3
- package/dist/entry-points/file/project/fc_project_tsconfig.mjs +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/packages/SdCliPackage.d.ts +2 -2
- package/dist/packages/SdCliPackage.mjs +5 -5
- package/dist/worker/build-worker.mjs +5 -5
- package/package.json +6 -6
- package/src/bin/sd-cli.ts +10 -10
- package/src/build-tool/SdCliCordova.ts +1 -1
- package/src/build-tool/SdCliElectron.ts +1 -1
- package/src/builder/SdCliClientBuilder.ts +29 -28
- package/src/builder/SdCliServerBuilder.ts +16 -16
- package/src/builder/SdCliTsLibBuilder.ts +5 -5
- package/src/entry-points/{SdCliWorkspace.ts → SdCliProject.ts} +3 -1
- package/src/entry-points/SdCliProjectGenerator.ts +2 -2
- package/src/entry-points/file/project/fc_project_tsconfig.ts +0 -1
- package/src/index.ts +1 -1
- package/src/packages/SdCliPackage.ts +3 -3
- package/src/worker/build-worker.ts +4 -4
- package/dist/entry-points/SdCliWorkspace.mjs +0 -414
|
@@ -28,7 +28,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
28
28
|
|
|
29
29
|
public constructor(private readonly _rootPath: string,
|
|
30
30
|
private readonly _config: ISdCliServerPackageConfig,
|
|
31
|
-
private readonly
|
|
31
|
+
private readonly _projRootPath: string) {
|
|
32
32
|
super();
|
|
33
33
|
|
|
34
34
|
// tsconfig
|
|
@@ -44,12 +44,12 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
private async _checkCacheAsync(watch: boolean): Promise<void> {
|
|
47
|
-
const
|
|
47
|
+
const projPkgLockContent = await FsUtil.readFileAsync(path.resolve(this._projRootPath, "package-lock.json"));
|
|
48
48
|
|
|
49
49
|
// const cachePath = path.resolve(cacheBasePath, pkgVersion);
|
|
50
50
|
|
|
51
51
|
const versionHash = createHash("sha1")
|
|
52
|
-
.update(
|
|
52
|
+
.update(projPkgLockContent)
|
|
53
53
|
.update(JSON.stringify(this._parsedTsconfig.options))
|
|
54
54
|
.update(JSON.stringify(this._config))
|
|
55
55
|
.update(watch.toString())
|
|
@@ -246,18 +246,18 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
private _getInternalModuleCachePaths(
|
|
249
|
+
private _getInternalModuleCachePaths(projName: string): string[] {
|
|
250
250
|
return [
|
|
251
|
-
...FsUtil.findAllParentChildDirPaths("node_modules/*/package.json", this._rootPath, this.
|
|
252
|
-
...FsUtil.findAllParentChildDirPaths(`node_modules/!(@simplysm|@${
|
|
251
|
+
...FsUtil.findAllParentChildDirPaths("node_modules/*/package.json", this._rootPath, this._projRootPath),
|
|
252
|
+
...FsUtil.findAllParentChildDirPaths(`node_modules/!(@simplysm|@${projName})/*/package.json`, this._rootPath, this._projRootPath),
|
|
253
253
|
].map((p) => path.dirname(p));
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
private _getWebpackConfig(watch: boolean, extModules: { name: string; exists: boolean }[]): webpack.Configuration {
|
|
257
|
-
const
|
|
258
|
-
const
|
|
257
|
+
const projNpmConfig = this._getNpmConfig(this._projRootPath)!;
|
|
258
|
+
const projName = projNpmConfig.name;
|
|
259
259
|
|
|
260
|
-
const internalModuleCachePaths = watch ? this._getInternalModuleCachePaths(
|
|
260
|
+
const internalModuleCachePaths = watch ? this._getInternalModuleCachePaths(projName) : undefined;
|
|
261
261
|
|
|
262
262
|
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
263
263
|
const pkgKey = npmConfig.name.split("/").last()!;
|
|
@@ -274,14 +274,14 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
274
274
|
roots: [this._rootPath],
|
|
275
275
|
extensions: [".ts", ".js", ".mjs", ".cjs"],
|
|
276
276
|
symlinks: true,
|
|
277
|
-
modules: [this.
|
|
277
|
+
modules: [this._projRootPath, "node_modules"],
|
|
278
278
|
mainFields: ["es2020", "default", "module", "main"],
|
|
279
279
|
conditionNames: ["es2020", "..."]
|
|
280
280
|
},
|
|
281
281
|
resolveLoader: {
|
|
282
282
|
symlinks: true
|
|
283
283
|
},
|
|
284
|
-
context: this.
|
|
284
|
+
context: this._projRootPath,
|
|
285
285
|
entry: {
|
|
286
286
|
main: [
|
|
287
287
|
path.resolve(this._rootPath, "src/main.ts")
|
|
@@ -369,10 +369,10 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
369
369
|
loader: "source-map-loader",
|
|
370
370
|
options: {
|
|
371
371
|
filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
|
|
372
|
-
const
|
|
372
|
+
const projRegex = new RegExp(`node_modules[\\\\/]@${projName}[\\\\/]`);
|
|
373
373
|
return !resourcePath.includes("node_modules")
|
|
374
374
|
|| (/node_modules[\\/]@simplysm[\\/]/).test(resourcePath)
|
|
375
|
-
||
|
|
375
|
+
|| projRegex.test(resourcePath);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
@@ -435,7 +435,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
435
435
|
}),
|
|
436
436
|
new ESLintWebpackPlugin({
|
|
437
437
|
context: this._rootPath,
|
|
438
|
-
eslintPath: path.resolve(this.
|
|
438
|
+
eslintPath: path.resolve(this._projRootPath, "node_modules", "eslint"),
|
|
439
439
|
exclude: ["node_modules"],
|
|
440
440
|
extensions: ["ts", "js", "mjs", "cjs"],
|
|
441
441
|
fix: false,
|
|
@@ -489,7 +489,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
489
489
|
if (loadedModuleNames.includes(moduleName)) continue;
|
|
490
490
|
loadedModuleNames.push(moduleName);
|
|
491
491
|
|
|
492
|
-
const modulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + moduleName, currPath, this.
|
|
492
|
+
const modulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + moduleName, currPath, this._projRootPath).first();
|
|
493
493
|
if (StringUtil.isNullOrEmpty(modulePath)) {
|
|
494
494
|
continue;
|
|
495
495
|
}
|
|
@@ -509,7 +509,7 @@ export class SdCliServerBuilder extends EventEmitter {
|
|
|
509
509
|
if (loadedModuleNames.includes(optModuleName)) continue;
|
|
510
510
|
loadedModuleNames.push(optModuleName);
|
|
511
511
|
|
|
512
|
-
const optModulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + optModuleName, currPath, this.
|
|
512
|
+
const optModulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + optModuleName, currPath, this._projRootPath).first();
|
|
513
513
|
if (StringUtil.isNullOrEmpty(optModulePath)) {
|
|
514
514
|
results.push({ name: optModuleName, exists: false });
|
|
515
515
|
continue;
|
|
@@ -41,7 +41,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
41
41
|
|
|
42
42
|
public constructor(private readonly _rootPath: string,
|
|
43
43
|
private readonly _config: ISdCliLibPackageConfig,
|
|
44
|
-
private readonly
|
|
44
|
+
private readonly _projRootPath: string) {
|
|
45
45
|
super();
|
|
46
46
|
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
47
47
|
|
|
@@ -212,15 +212,15 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
private async getAllRelatedPathsAsync(): Promise<string[]> {
|
|
215
|
-
const
|
|
216
|
-
const
|
|
215
|
+
const projNpmConfig = this._getNpmConfig(this._projRootPath)!;
|
|
216
|
+
const projName = projNpmConfig.name;
|
|
217
217
|
|
|
218
218
|
const fileCachePaths = Array.from(this._fileCache.keys())
|
|
219
219
|
.filter((filePath) => {
|
|
220
|
-
const
|
|
220
|
+
const projRegex = new RegExp(`node_modules[\\\\/]@${projName}[\\\\/]`);
|
|
221
221
|
return !filePath.includes("node_modules")
|
|
222
222
|
|| (/node_modules[\\/]@simplysm[\\/]/).test(filePath)
|
|
223
|
-
||
|
|
223
|
+
|| projRegex.test(filePath);
|
|
224
224
|
});
|
|
225
225
|
const mySourceGlobPath = path.resolve(this._rootPath, "**", "+(*.js|*.cjs|*.mjs|*.ts|*.scss)");
|
|
226
226
|
const mySourceFilePaths = await FsUtil.globAsync(mySourceGlobPath, {
|
|
@@ -11,7 +11,7 @@ import { SdCliLocalUpdate } from "./SdCliLocalUpdate";
|
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
import cp from "child_process";
|
|
13
13
|
|
|
14
|
-
export class
|
|
14
|
+
export class SdCliProject {
|
|
15
15
|
private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
|
|
16
16
|
|
|
17
17
|
private readonly _npmConfig: INpmConfig;
|
|
@@ -225,6 +225,8 @@ export class SdCliWorkspace {
|
|
|
225
225
|
|
|
226
226
|
this._logger.debug("배포 시작...");
|
|
227
227
|
await pkgs.parallelAsync(async (pkg) => {
|
|
228
|
+
if (pkg.config.publish == null) return;
|
|
229
|
+
|
|
228
230
|
this._logger.debug(`[${pkg.name}] 배포를 시작합니다...`);
|
|
229
231
|
await pkg.publishAsync();
|
|
230
232
|
this._logger.debug(`[${pkg.name}] 배포가 완료되었습니다.`);
|
|
@@ -275,7 +275,7 @@ export class SdCliProjectGenerator {
|
|
|
275
275
|
|
|
276
276
|
this._logger.log(`[${pkgName}] 'src/index.html' 파일 등록`);
|
|
277
277
|
await FsUtil.writeFileAsync(path.resolve(pkgPath, "src/index.html"), fc_package_index({
|
|
278
|
-
description: opt.description
|
|
278
|
+
description: projNpmConfig.description + " - " + opt.description
|
|
279
279
|
}));
|
|
280
280
|
|
|
281
281
|
this._logger.log(`[${pkgName}] 'src/main.ts' 파일 등록`);
|
|
@@ -283,7 +283,7 @@ export class SdCliProjectGenerator {
|
|
|
283
283
|
|
|
284
284
|
this._logger.log(`[${pkgName}] 'src/manifest.json' 파일 등록`);
|
|
285
285
|
await FsUtil.writeFileAsync(path.resolve(pkgPath, "src/manifest.json"), fc_package_manifest({
|
|
286
|
-
description: projNpmConfig.description,
|
|
286
|
+
description: projNpmConfig.description + " - " + opt.description,
|
|
287
287
|
author: projNpmConfig.author,
|
|
288
288
|
version: projNpmConfig.version
|
|
289
289
|
}));
|
package/src/index.ts
CHANGED
|
@@ -36,8 +36,8 @@ export * from "./entry-points/SdCliFileCrypto";
|
|
|
36
36
|
export * from "./entry-points/SdCliLocalUpdate";
|
|
37
37
|
export * from "./entry-points/SdCliNpm";
|
|
38
38
|
export * from "./entry-points/SdCliPrepare";
|
|
39
|
+
export * from "./entry-points/SdCliProject";
|
|
39
40
|
export * from "./entry-points/SdCliProjectGenerator";
|
|
40
|
-
export * from "./entry-points/SdCliWorkspace";
|
|
41
41
|
export * from "./ng-tools/babel/SdCliBbFileMetadata";
|
|
42
42
|
export * from "./ng-tools/babel/SdCliBbRootMetadata";
|
|
43
43
|
export * from "./ng-tools/babel/SdCliBbUtil";
|
|
@@ -14,7 +14,7 @@ export class SdCliPackage extends EventEmitter {
|
|
|
14
14
|
private readonly _npmConfig: INpmConfig;
|
|
15
15
|
|
|
16
16
|
public get basename(): string {
|
|
17
|
-
return path.basename(this.
|
|
17
|
+
return path.basename(this._projRootPath);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
public get name(): string {
|
|
@@ -32,7 +32,7 @@ export class SdCliPackage extends EventEmitter {
|
|
|
32
32
|
].distinct();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
public constructor(private readonly
|
|
35
|
+
public constructor(private readonly _projRootPath: string,
|
|
36
36
|
public readonly rootPath: string,
|
|
37
37
|
public readonly config: TSdCliPackageConfig) {
|
|
38
38
|
super();
|
|
@@ -216,7 +216,7 @@ export class SdCliPackage extends EventEmitter {
|
|
|
216
216
|
cmd,
|
|
217
217
|
this.rootPath,
|
|
218
218
|
JsonConvert.stringify(this.config),
|
|
219
|
-
this.
|
|
219
|
+
this._projRootPath
|
|
220
220
|
],
|
|
221
221
|
{
|
|
222
222
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
@@ -23,19 +23,19 @@ else {
|
|
|
23
23
|
const type = process.argv[2] as ("build" | "watch");
|
|
24
24
|
const rootPath = process.argv[3];
|
|
25
25
|
const config = JsonConvert.parse(process.argv[4]) as TSdCliPackageConfig;
|
|
26
|
-
const
|
|
26
|
+
const projRootPath = process.argv[5];
|
|
27
27
|
|
|
28
28
|
function createBuilder(): SdCliJsLibBuilder | SdCliTsLibBuilder | SdCliServerBuilder | SdCliClientBuilder {
|
|
29
29
|
const isTs = FsUtil.exists(path.resolve(rootPath, "tsconfig.json"));
|
|
30
30
|
|
|
31
31
|
if (config.type === "library") {
|
|
32
|
-
return isTs ? new SdCliTsLibBuilder(rootPath, config,
|
|
32
|
+
return isTs ? new SdCliTsLibBuilder(rootPath, config, projRootPath) : new SdCliJsLibBuilder(rootPath);
|
|
33
33
|
}
|
|
34
34
|
else if (config.type === "server") {
|
|
35
|
-
return new SdCliServerBuilder(rootPath, config,
|
|
35
|
+
return new SdCliServerBuilder(rootPath, config, projRootPath);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
return new SdCliClientBuilder(rootPath, config,
|
|
38
|
+
return new SdCliClientBuilder(rootPath, config, projRootPath);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|