@simplysm/sd-cli 11.0.40 → 11.1.1
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 +35 -35
- package/dist/build-tools/SdNgBundler.js +545 -533
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdNgBundlerContext.d.ts +16 -16
- package/dist/build-tools/SdNgBundlerContext.js +97 -97
- 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 +9 -9
- package/dist/utils/SdMemoryLoadResultCache.js +34 -34
- package/dist/utils/SdSourceFileCache.d.ts +6 -6
- package/dist/utils/SdSourceFileCache.js +14 -14
- package/dist/utils/SdSourceFileCache.js.map +1 -1
- package/package.json +18 -18
- package/src/build-tools/SdNgBundler.ts +21 -12
- package/src/utils/SdSourceFileCache.ts +1 -1
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
3
|
-
import { FunctionQueue } from "@simplysm/sd-core-common";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { SdNgBundler } from "../build-tools/SdNgBundler";
|
|
6
|
-
import { SdLinter } from "../build-tools/SdLinter";
|
|
7
|
-
import { SdCliCordova } from "../build-tools/SdCliCordova";
|
|
8
|
-
import { SdCliNgRoutesFileGenerator } from "../build-tools/SdCliNgRoutesFileGenerator";
|
|
9
|
-
export class SdCliClientBuilder extends EventEmitter {
|
|
10
|
-
constructor(_projConf, _pkgPath) {
|
|
11
|
-
super();
|
|
12
|
-
this._projConf = _projConf;
|
|
13
|
-
this._pkgPath = _pkgPath;
|
|
14
|
-
this._logger = Logger.get(["simplysm", "sd-cli", "SdCliClientBuilder"]);
|
|
15
|
-
this._pkgConf = this._projConf.packages[path.basename(_pkgPath)];
|
|
16
|
-
}
|
|
17
|
-
on(event, listener) {
|
|
18
|
-
super.on(event, listener);
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
async buildAsync() {
|
|
22
|
-
this._debug("dist 초기화...");
|
|
23
|
-
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
24
|
-
this._debug(`GEN index.ts...`);
|
|
25
|
-
await SdCliNgRoutesFileGenerator.runAsync(this._pkgPath);
|
|
26
|
-
this._debug("GEN .config...");
|
|
27
|
-
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
28
|
-
await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
29
|
-
return await this._runAsync({ dev: false });
|
|
30
|
-
}
|
|
31
|
-
async watchAsync() {
|
|
32
|
-
this.emit("change");
|
|
33
|
-
this._debug("dist 초기화...");
|
|
34
|
-
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
35
|
-
this._debug(`WATCH GEN index.ts...`);
|
|
36
|
-
await SdCliNgRoutesFileGenerator.watchAsync(this._pkgPath);
|
|
37
|
-
this._debug("GEN .config...");
|
|
38
|
-
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
39
|
-
await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
40
|
-
const result = await this._runAsync({ dev: true });
|
|
41
|
-
this.emit("complete", result);
|
|
42
|
-
this._debug("WATCH...");
|
|
43
|
-
let changeFiles = [];
|
|
44
|
-
const fnQ = new FunctionQueue();
|
|
45
|
-
const watcher = SdFsWatcher
|
|
46
|
-
.watch(result.watchFilePaths)
|
|
47
|
-
.onChange({ delay: 100 }, (changeInfos) => {
|
|
48
|
-
changeFiles.push(...changeInfos.map((item) => item.path));
|
|
49
|
-
fnQ.runLast(async () => {
|
|
50
|
-
const currChangeFiles = [...changeFiles];
|
|
51
|
-
changeFiles = [];
|
|
52
|
-
this.emit("change");
|
|
53
|
-
for (const builder of this._builders) {
|
|
54
|
-
builder.removeCache(currChangeFiles);
|
|
55
|
-
}
|
|
56
|
-
const watchResult = await this._runAsync({ dev: true });
|
|
57
|
-
this.emit("complete", watchResult);
|
|
58
|
-
watcher.add(watchResult.watchFilePaths);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
async _runAsync(opt) {
|
|
63
|
-
const builderTypes = Object.keys(this._pkgConf.builder ?? { web: {} });
|
|
64
|
-
if (this._pkgConf.builder?.cordova && !this._cordova) {
|
|
65
|
-
this._debug("CORDOVA 준비...");
|
|
66
|
-
this._cordova = new SdCliCordova({
|
|
67
|
-
pkgPath: this._pkgPath,
|
|
68
|
-
config: this._pkgConf.builder.cordova,
|
|
69
|
-
cordovaPath: path.resolve(this._pkgPath, ".cordova")
|
|
70
|
-
});
|
|
71
|
-
await this._cordova.initializeAsync();
|
|
72
|
-
}
|
|
73
|
-
if (!this._builders) {
|
|
74
|
-
this._debug(`BUILD 준비...`);
|
|
75
|
-
this._builders = builderTypes.map((builderType) => new SdNgBundler({
|
|
76
|
-
dev: opt.dev,
|
|
77
|
-
builderType: builderType,
|
|
78
|
-
pkgPath: this._pkgPath,
|
|
79
|
-
outputPath: builderType === "web" ? path.resolve(this._pkgPath, "dist")
|
|
80
|
-
: builderType === "electron" ? path.resolve(this._pkgPath, ".electron/src")
|
|
81
|
-
: builderType === "cordova" && !opt.dev ? path.resolve(this._pkgPath, ".cordova/www")
|
|
82
|
-
: path.resolve(this._pkgPath, "dist", builderType),
|
|
83
|
-
env: {
|
|
84
|
-
...this._pkgConf.env,
|
|
85
|
-
...this._pkgConf.builder?.[builderType]?.env
|
|
86
|
-
},
|
|
87
|
-
cordovaConfig: builderType === "cordova" ? this._pkgConf.builder.cordova : undefined,
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
this._debug(`BUILD & CHECK...`);
|
|
91
|
-
const buildResults = await Promise.all(this._builders.map((builder) => builder.bundleAsync()));
|
|
92
|
-
const filePaths = buildResults.mapMany(item => item.filePaths).distinct();
|
|
93
|
-
const affectedFilePaths = buildResults.mapMany(item => item.affectedFilePaths).distinct();
|
|
94
|
-
const results = buildResults.mapMany((item) => item.results).distinct();
|
|
95
|
-
this._debug(`LINT...`);
|
|
96
|
-
const lintResults = await SdLinter.lintAsync(affectedFilePaths, this._pkgPath);
|
|
97
|
-
if (!opt.dev && this._cordova) {
|
|
98
|
-
this._debug("CORDOVA BUILD...");
|
|
99
|
-
await this._cordova.buildAsync(path.resolve(this._pkgPath, "dist"));
|
|
100
|
-
}
|
|
101
|
-
this._debug(`빌드 완료`);
|
|
102
|
-
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {})
|
|
103
|
-
.mapMany((key) => FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)));
|
|
104
|
-
/*const watchFilePaths = filePaths
|
|
105
|
-
.map((item) => {
|
|
106
|
-
if (PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../"))) {
|
|
107
|
-
return path.resolve(this._pkgPath, "..", path.relative(path.resolve(this._pkgPath, "../"), item).split("\\").slice(0, 2).join("/"), "**!/!*.*");
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const localUpdatePath = localUpdatePaths.single((lu) => PathUtil.isChildPath(item, lu));
|
|
111
|
-
if (localUpdatePath != null) {
|
|
112
|
-
return path.resolve(localUpdatePath, path.relative(localUpdatePath, item).split("\\").slice(0, 1).join("/"), "**!/!*.*");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return undefined;
|
|
116
|
-
}).filterExists().distinct();
|
|
117
|
-
console.log(watchFilePaths);*/
|
|
118
|
-
const watchFilePaths = filePaths.filter(item => PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
119
|
-
localUpdatePaths.some((lu) => PathUtil.isChildPath(item, lu)));
|
|
120
|
-
return {
|
|
121
|
-
watchFilePaths: watchFilePaths,
|
|
122
|
-
affectedFilePaths: affectedFilePaths,
|
|
123
|
-
buildResults: [...results, ...lintResults]
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
_debug(msg) {
|
|
127
|
-
this._logger.debug(`[${path.basename(this._pkgPath)}] ${msg}`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
3
|
+
import { FunctionQueue } from "@simplysm/sd-core-common";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { SdNgBundler } from "../build-tools/SdNgBundler";
|
|
6
|
+
import { SdLinter } from "../build-tools/SdLinter";
|
|
7
|
+
import { SdCliCordova } from "../build-tools/SdCliCordova";
|
|
8
|
+
import { SdCliNgRoutesFileGenerator } from "../build-tools/SdCliNgRoutesFileGenerator";
|
|
9
|
+
export class SdCliClientBuilder extends EventEmitter {
|
|
10
|
+
constructor(_projConf, _pkgPath) {
|
|
11
|
+
super();
|
|
12
|
+
this._projConf = _projConf;
|
|
13
|
+
this._pkgPath = _pkgPath;
|
|
14
|
+
this._logger = Logger.get(["simplysm", "sd-cli", "SdCliClientBuilder"]);
|
|
15
|
+
this._pkgConf = this._projConf.packages[path.basename(_pkgPath)];
|
|
16
|
+
}
|
|
17
|
+
on(event, listener) {
|
|
18
|
+
super.on(event, listener);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
async buildAsync() {
|
|
22
|
+
this._debug("dist 초기화...");
|
|
23
|
+
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
24
|
+
this._debug(`GEN index.ts...`);
|
|
25
|
+
await SdCliNgRoutesFileGenerator.runAsync(this._pkgPath);
|
|
26
|
+
this._debug("GEN .config...");
|
|
27
|
+
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
28
|
+
await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
29
|
+
return await this._runAsync({ dev: false });
|
|
30
|
+
}
|
|
31
|
+
async watchAsync() {
|
|
32
|
+
this.emit("change");
|
|
33
|
+
this._debug("dist 초기화...");
|
|
34
|
+
await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
|
|
35
|
+
this._debug(`WATCH GEN index.ts...`);
|
|
36
|
+
await SdCliNgRoutesFileGenerator.watchAsync(this._pkgPath);
|
|
37
|
+
this._debug("GEN .config...");
|
|
38
|
+
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
39
|
+
await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
40
|
+
const result = await this._runAsync({ dev: true });
|
|
41
|
+
this.emit("complete", result);
|
|
42
|
+
this._debug("WATCH...");
|
|
43
|
+
let changeFiles = [];
|
|
44
|
+
const fnQ = new FunctionQueue();
|
|
45
|
+
const watcher = SdFsWatcher
|
|
46
|
+
.watch(result.watchFilePaths)
|
|
47
|
+
.onChange({ delay: 100 }, (changeInfos) => {
|
|
48
|
+
changeFiles.push(...changeInfos.map((item) => item.path));
|
|
49
|
+
fnQ.runLast(async () => {
|
|
50
|
+
const currChangeFiles = [...changeFiles];
|
|
51
|
+
changeFiles = [];
|
|
52
|
+
this.emit("change");
|
|
53
|
+
for (const builder of this._builders) {
|
|
54
|
+
builder.removeCache(currChangeFiles);
|
|
55
|
+
}
|
|
56
|
+
const watchResult = await this._runAsync({ dev: true });
|
|
57
|
+
this.emit("complete", watchResult);
|
|
58
|
+
watcher.add(watchResult.watchFilePaths);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async _runAsync(opt) {
|
|
63
|
+
const builderTypes = Object.keys(this._pkgConf.builder ?? { web: {} });
|
|
64
|
+
if (this._pkgConf.builder?.cordova && !this._cordova) {
|
|
65
|
+
this._debug("CORDOVA 준비...");
|
|
66
|
+
this._cordova = new SdCliCordova({
|
|
67
|
+
pkgPath: this._pkgPath,
|
|
68
|
+
config: this._pkgConf.builder.cordova,
|
|
69
|
+
cordovaPath: path.resolve(this._pkgPath, ".cordova")
|
|
70
|
+
});
|
|
71
|
+
await this._cordova.initializeAsync();
|
|
72
|
+
}
|
|
73
|
+
if (!this._builders) {
|
|
74
|
+
this._debug(`BUILD 준비...`);
|
|
75
|
+
this._builders = builderTypes.map((builderType) => new SdNgBundler({
|
|
76
|
+
dev: opt.dev,
|
|
77
|
+
builderType: builderType,
|
|
78
|
+
pkgPath: this._pkgPath,
|
|
79
|
+
outputPath: builderType === "web" ? path.resolve(this._pkgPath, "dist")
|
|
80
|
+
: builderType === "electron" ? path.resolve(this._pkgPath, ".electron/src")
|
|
81
|
+
: builderType === "cordova" && !opt.dev ? path.resolve(this._pkgPath, ".cordova/www")
|
|
82
|
+
: path.resolve(this._pkgPath, "dist", builderType),
|
|
83
|
+
env: {
|
|
84
|
+
...this._pkgConf.env,
|
|
85
|
+
...this._pkgConf.builder?.[builderType]?.env
|
|
86
|
+
},
|
|
87
|
+
cordovaConfig: builderType === "cordova" ? this._pkgConf.builder.cordova : undefined,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
this._debug(`BUILD & CHECK...`);
|
|
91
|
+
const buildResults = await Promise.all(this._builders.map((builder) => builder.bundleAsync()));
|
|
92
|
+
const filePaths = buildResults.mapMany(item => item.filePaths).distinct();
|
|
93
|
+
const affectedFilePaths = buildResults.mapMany(item => item.affectedFilePaths).distinct();
|
|
94
|
+
const results = buildResults.mapMany((item) => item.results).distinct();
|
|
95
|
+
this._debug(`LINT...`);
|
|
96
|
+
const lintResults = await SdLinter.lintAsync(affectedFilePaths, this._pkgPath);
|
|
97
|
+
if (!opt.dev && this._cordova) {
|
|
98
|
+
this._debug("CORDOVA BUILD...");
|
|
99
|
+
await this._cordova.buildAsync(path.resolve(this._pkgPath, "dist"));
|
|
100
|
+
}
|
|
101
|
+
this._debug(`빌드 완료`);
|
|
102
|
+
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {})
|
|
103
|
+
.mapMany((key) => FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)));
|
|
104
|
+
/*const watchFilePaths = filePaths
|
|
105
|
+
.map((item) => {
|
|
106
|
+
if (PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../"))) {
|
|
107
|
+
return path.resolve(this._pkgPath, "..", path.relative(path.resolve(this._pkgPath, "../"), item).split("\\").slice(0, 2).join("/"), "**!/!*.*");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const localUpdatePath = localUpdatePaths.single((lu) => PathUtil.isChildPath(item, lu));
|
|
111
|
+
if (localUpdatePath != null) {
|
|
112
|
+
return path.resolve(localUpdatePath, path.relative(localUpdatePath, item).split("\\").slice(0, 1).join("/"), "**!/!*.*");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return undefined;
|
|
116
|
+
}).filterExists().distinct();
|
|
117
|
+
console.log(watchFilePaths);*/
|
|
118
|
+
const watchFilePaths = filePaths.filter(item => PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
119
|
+
localUpdatePaths.some((lu) => PathUtil.isChildPath(item, lu)));
|
|
120
|
+
return {
|
|
121
|
+
watchFilePaths: watchFilePaths,
|
|
122
|
+
affectedFilePaths: affectedFilePaths,
|
|
123
|
+
buildResults: [...results, ...lintResults]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
_debug(msg) {
|
|
127
|
+
this._logger.debug(`[${path.basename(this._pkgPath)}] ${msg}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
130
|
//# sourceMappingURL=SdCliClientBuilder.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ISdCliBuilderResult } from "../commons";
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
|
-
export declare class SdCliJsLibLinter extends EventEmitter {
|
|
5
|
-
private readonly _pkgPath;
|
|
6
|
-
private readonly _logger;
|
|
7
|
-
private readonly _pkgName;
|
|
8
|
-
constructor(_pkgPath: string);
|
|
9
|
-
on(event: "change", listener: () => void): this;
|
|
10
|
-
on(event: "complete", listener: (result: ISdCliBuilderResult) => void): this;
|
|
11
|
-
buildAsync(): Promise<ISdCliBuilderResult>;
|
|
12
|
-
watchAsync(): Promise<void>;
|
|
13
|
-
private _debug;
|
|
14
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ISdCliBuilderResult } from "../commons";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
export declare class SdCliJsLibLinter extends EventEmitter {
|
|
5
|
+
private readonly _pkgPath;
|
|
6
|
+
private readonly _logger;
|
|
7
|
+
private readonly _pkgName;
|
|
8
|
+
constructor(_pkgPath: string);
|
|
9
|
+
on(event: "change", listener: () => void): this;
|
|
10
|
+
on(event: "complete", listener: (result: ISdCliBuilderResult) => void): this;
|
|
11
|
+
buildAsync(): Promise<ISdCliBuilderResult>;
|
|
12
|
+
watchAsync(): Promise<void>;
|
|
13
|
+
private _debug;
|
|
14
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { FsUtil, Logger, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
|
-
import { SdLinter } from "../build-tools/SdLinter";
|
|
5
|
-
export class SdCliJsLibLinter extends EventEmitter {
|
|
6
|
-
constructor(_pkgPath) {
|
|
7
|
-
super();
|
|
8
|
-
this._pkgPath = _pkgPath;
|
|
9
|
-
this._logger = Logger.get(["simplysm", "sd-cli", "SdCliJsLibLinter"]);
|
|
10
|
-
this._pkgName = path.basename(_pkgPath);
|
|
11
|
-
}
|
|
12
|
-
on(event, listener) {
|
|
13
|
-
super.on(event, listener);
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
async buildAsync() {
|
|
17
|
-
this._debug("LINT...");
|
|
18
|
-
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.+(js|cjs|mjs)");
|
|
19
|
-
const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
20
|
-
const lintResults = await SdLinter.lintAsync(srcFilePaths);
|
|
21
|
-
this._debug(`LINT 완료`);
|
|
22
|
-
return {
|
|
23
|
-
affectedFilePaths: srcFilePaths,
|
|
24
|
-
buildResults: lintResults
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
async watchAsync() {
|
|
28
|
-
this.emit("change");
|
|
29
|
-
this._debug("LINT...");
|
|
30
|
-
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.+(js|cjs|mjs)");
|
|
31
|
-
const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
32
|
-
const lintResults = await SdLinter.lintAsync(srcFilePaths);
|
|
33
|
-
this._debug(`LINT 완료`);
|
|
34
|
-
this.emit("complete", {
|
|
35
|
-
affectedFilePaths: srcFilePaths,
|
|
36
|
-
buildResults: lintResults
|
|
37
|
-
});
|
|
38
|
-
SdFsWatcher
|
|
39
|
-
.watch([srcGlobPath])
|
|
40
|
-
.onChange({
|
|
41
|
-
delay: 100
|
|
42
|
-
}, async (changeInfos) => {
|
|
43
|
-
const watchFilePaths = changeInfos.filter((item) => FsUtil.exists(item.path)).map((item) => item.path);
|
|
44
|
-
if (watchFilePaths.length < 1)
|
|
45
|
-
return;
|
|
46
|
-
this.emit("change");
|
|
47
|
-
this._debug("LINT...");
|
|
48
|
-
const watchLintResults = await SdLinter.lintAsync(watchFilePaths);
|
|
49
|
-
this._debug(`LINT 완료`);
|
|
50
|
-
this.emit("complete", {
|
|
51
|
-
affectedFilePaths: changeInfos.map((item) => item.path),
|
|
52
|
-
buildResults: watchLintResults
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
_debug(msg) {
|
|
57
|
-
this._logger.debug(`[${this._pkgName}] ${msg}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
import { FsUtil, Logger, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
import { SdLinter } from "../build-tools/SdLinter";
|
|
5
|
+
export class SdCliJsLibLinter extends EventEmitter {
|
|
6
|
+
constructor(_pkgPath) {
|
|
7
|
+
super();
|
|
8
|
+
this._pkgPath = _pkgPath;
|
|
9
|
+
this._logger = Logger.get(["simplysm", "sd-cli", "SdCliJsLibLinter"]);
|
|
10
|
+
this._pkgName = path.basename(_pkgPath);
|
|
11
|
+
}
|
|
12
|
+
on(event, listener) {
|
|
13
|
+
super.on(event, listener);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
async buildAsync() {
|
|
17
|
+
this._debug("LINT...");
|
|
18
|
+
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.+(js|cjs|mjs)");
|
|
19
|
+
const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
20
|
+
const lintResults = await SdLinter.lintAsync(srcFilePaths);
|
|
21
|
+
this._debug(`LINT 완료`);
|
|
22
|
+
return {
|
|
23
|
+
affectedFilePaths: srcFilePaths,
|
|
24
|
+
buildResults: lintResults
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async watchAsync() {
|
|
28
|
+
this.emit("change");
|
|
29
|
+
this._debug("LINT...");
|
|
30
|
+
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.+(js|cjs|mjs)");
|
|
31
|
+
const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
|
|
32
|
+
const lintResults = await SdLinter.lintAsync(srcFilePaths);
|
|
33
|
+
this._debug(`LINT 완료`);
|
|
34
|
+
this.emit("complete", {
|
|
35
|
+
affectedFilePaths: srcFilePaths,
|
|
36
|
+
buildResults: lintResults
|
|
37
|
+
});
|
|
38
|
+
SdFsWatcher
|
|
39
|
+
.watch([srcGlobPath])
|
|
40
|
+
.onChange({
|
|
41
|
+
delay: 100
|
|
42
|
+
}, async (changeInfos) => {
|
|
43
|
+
const watchFilePaths = changeInfos.filter((item) => FsUtil.exists(item.path)).map((item) => item.path);
|
|
44
|
+
if (watchFilePaths.length < 1)
|
|
45
|
+
return;
|
|
46
|
+
this.emit("change");
|
|
47
|
+
this._debug("LINT...");
|
|
48
|
+
const watchLintResults = await SdLinter.lintAsync(watchFilePaths);
|
|
49
|
+
this._debug(`LINT 완료`);
|
|
50
|
+
this.emit("complete", {
|
|
51
|
+
affectedFilePaths: changeInfos.map((item) => item.path),
|
|
52
|
+
buildResults: watchLintResults
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
_debug(msg) {
|
|
57
|
+
this._logger.debug(`[${this._pkgName}] ${msg}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
60
|
//# sourceMappingURL=SdCliJsLibLinter.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
import { ISdCliBuilderResult, ISdCliConfig } from "../commons";
|
|
4
|
-
export declare class SdCliServerBuilder extends EventEmitter {
|
|
5
|
-
private readonly _projConf;
|
|
6
|
-
private readonly _pkgPath;
|
|
7
|
-
private readonly _logger;
|
|
8
|
-
private readonly _pkgConf;
|
|
9
|
-
private _builder?;
|
|
10
|
-
private _checker?;
|
|
11
|
-
private _extModules?;
|
|
12
|
-
constructor(_projConf: ISdCliConfig, _pkgPath: string);
|
|
13
|
-
on(event: "change", listener: () => void): this;
|
|
14
|
-
on(event: "complete", listener: (result: ISdCliBuilderResult) => void): this;
|
|
15
|
-
watchAsync(): Promise<void>;
|
|
16
|
-
buildAsync(): Promise<ISdCliBuilderResult>;
|
|
17
|
-
private _runAsync;
|
|
18
|
-
private _getExternalModulesAsync;
|
|
19
|
-
private _debug;
|
|
20
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
import { ISdCliBuilderResult, ISdCliConfig } from "../commons";
|
|
4
|
+
export declare class SdCliServerBuilder extends EventEmitter {
|
|
5
|
+
private readonly _projConf;
|
|
6
|
+
private readonly _pkgPath;
|
|
7
|
+
private readonly _logger;
|
|
8
|
+
private readonly _pkgConf;
|
|
9
|
+
private _builder?;
|
|
10
|
+
private _checker?;
|
|
11
|
+
private _extModules?;
|
|
12
|
+
constructor(_projConf: ISdCliConfig, _pkgPath: string);
|
|
13
|
+
on(event: "change", listener: () => void): this;
|
|
14
|
+
on(event: "complete", listener: (result: ISdCliBuilderResult) => void): this;
|
|
15
|
+
watchAsync(): Promise<void>;
|
|
16
|
+
buildAsync(): Promise<ISdCliBuilderResult>;
|
|
17
|
+
private _runAsync;
|
|
18
|
+
private _getExternalModulesAsync;
|
|
19
|
+
private _debug;
|
|
20
|
+
}
|