@simplysm/sd-cli 7.0.236 → 7.0.239

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.
@@ -1,74 +1,73 @@
1
- import { SdCliTsLibBuilder } from "../builder/SdCliTsLibBuilder";
2
- import { SdCliJsLibBuilder } from "../builder/SdCliJsLibBuilder";
3
- import { SdCliServerBuilder } from "../builder/SdCliServerBuilder";
4
- import { SdCliClientBuilder } from "../builder/SdCliClientBuilder";
5
- import { FsUtil, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
6
- import path from "path";
7
- import { JsonConvert } from "@simplysm/sd-core-common";
8
- import { TSdCliPackageConfig } from "../commons";
9
-
10
-
11
- if (process.env["SD_CLI_LOGGER_SEVERITY"] === "DEBUG") {
12
- Logger.setConfig({
13
- console: {
14
- level: LoggerSeverity.debug
15
- }
16
- });
17
- }
18
- else {
19
- Logger.setConfig({
20
- dot: true
21
- });
22
- }
23
-
24
- const type = process.argv[2] as ("build" | "watch");
25
- const rootPath = process.argv[3];
26
- const config = JsonConvert.parse(process.argv[4]) as TSdCliPackageConfig;
27
- const workspaceRootPath = process.argv[5];
28
-
29
- function createBuilder(): SdCliJsLibBuilder | SdCliTsLibBuilder | SdCliServerBuilder | SdCliClientBuilder {
30
- const isTs = FsUtil.exists(path.resolve(rootPath, "tsconfig.json"));
31
-
32
- if (config.type === "library") {
33
- return isTs ? new SdCliTsLibBuilder(rootPath, config, workspaceRootPath) : new SdCliJsLibBuilder(rootPath);
34
- }
35
- else if (config.type === "server") {
36
- return new SdCliServerBuilder(rootPath, config, workspaceRootPath);
37
- }
38
- else {
39
- return new SdCliClientBuilder(rootPath, config, workspaceRootPath);
40
- }
41
- }
42
-
43
- const builder = createBuilder();
44
-
45
- if (type === "build") {
46
- builder.buildAsync()
47
- .then((result) => {
48
- process.send!(JsonConvert.stringify(result));
49
- process.exit(0);
50
- })
51
- .catch((err) => {
52
- // eslint-disable-next-line no-console
53
- console.error(err);
54
- process.exit(1);
55
- });
56
- }
57
- else {
58
- builder
59
- .on("change", () => {
60
- process.send!(JsonConvert.stringify({ event: "change" }));
61
- })
62
- .on("complete", (results) => {
63
- process.send!(JsonConvert.stringify({ event: "complete", body: results }));
64
- })
65
- .watchAsync()
66
- .then(() => {
67
- process.send!(JsonConvert.stringify({ event: "ready" }));
68
- })
69
- .catch((err) => {
70
- // eslint-disable-next-line no-console
71
- console.error(err);
72
- process.exit(1);
73
- });
74
- }
1
+ import { SdCliTsLibBuilder } from "../builder/SdCliTsLibBuilder";
2
+ import { SdCliJsLibBuilder } from "../builder/SdCliJsLibBuilder";
3
+ import { SdCliServerBuilder } from "../builder/SdCliServerBuilder";
4
+ import { SdCliClientBuilder } from "../builder/SdCliClientBuilder";
5
+ import { FsUtil, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
6
+ import path from "path";
7
+ import { JsonConvert } from "@simplysm/sd-core-common";
8
+ import { TSdCliPackageConfig } from "../commons";
9
+
10
+ if (process.env["SD_CLI_LOGGER_SEVERITY"] === "DEBUG") {
11
+ Logger.setConfig({
12
+ console: {
13
+ level: LoggerSeverity.debug
14
+ }
15
+ });
16
+ }
17
+ else {
18
+ Logger.setConfig({
19
+ dot: true
20
+ });
21
+ }
22
+
23
+ const type = process.argv[2] as ("build" | "watch");
24
+ const rootPath = process.argv[3];
25
+ const config = JsonConvert.parse(process.argv[4]) as TSdCliPackageConfig;
26
+ const workspaceRootPath = process.argv[5];
27
+
28
+ function createBuilder(): SdCliJsLibBuilder | SdCliTsLibBuilder | SdCliServerBuilder | SdCliClientBuilder {
29
+ const isTs = FsUtil.exists(path.resolve(rootPath, "tsconfig.json"));
30
+
31
+ if (config.type === "library") {
32
+ return isTs ? new SdCliTsLibBuilder(rootPath, config, workspaceRootPath) : new SdCliJsLibBuilder(rootPath);
33
+ }
34
+ else if (config.type === "server") {
35
+ return new SdCliServerBuilder(rootPath, config, workspaceRootPath);
36
+ }
37
+ else {
38
+ return new SdCliClientBuilder(rootPath, config, workspaceRootPath);
39
+ }
40
+ }
41
+
42
+ const builder = createBuilder();
43
+
44
+ if (type === "build") {
45
+ builder.buildAsync()
46
+ .then((result) => {
47
+ process.send!(JsonConvert.stringify(result));
48
+ process.exit(0);
49
+ })
50
+ .catch((err) => {
51
+ // eslint-disable-next-line no-console
52
+ console.error(err);
53
+ process.exit(1);
54
+ });
55
+ }
56
+ else {
57
+ builder
58
+ .on("change", () => {
59
+ process.send!(JsonConvert.stringify({ event: "change" }));
60
+ })
61
+ .on("complete", (results) => {
62
+ process.send!(JsonConvert.stringify({ event: "complete", body: results }));
63
+ })
64
+ .watchAsync()
65
+ .then(() => {
66
+ process.send!(JsonConvert.stringify({ event: "ready" }));
67
+ })
68
+ .catch((err) => {
69
+ // eslint-disable-next-line no-console
70
+ console.error(err);
71
+ process.exit(1);
72
+ });
73
+ }
package/tsconfig.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "lib": [
5
- "ES2020"
6
- ],
7
- "outDir": "./dist",
8
- "baseUrl": ".",
9
- "paths": {
10
- "@simplysm/sd-core-common": [
11
- "../sd-core-common/src/index.ts"
12
- ],
13
- "@simplysm/sd-core-node": [
14
- "../sd-core-node/src/index.ts"
15
- ],
16
- "@simplysm/sd-service-common": [
17
- "../sd-service-common/src/index.ts"
18
- ],
19
- "@simplysm/sd-service-server": [
20
- "../sd-service-server/src/index.ts"
21
- ],
22
- "@simplysm/sd-orm-common": [
23
- "../sd-orm-common/src/index.ts"
24
- ],
25
- "@simplysm/sd-orm-node": [
26
- "../sd-orm-node/src/index.ts"
27
- ],
28
- "@simplysm/sd-storage": [
29
- "../sd-storage/src/index.ts"
30
- ]
31
- }
32
- },
33
- "files": [
34
- "src/bin/sd-cli.ts",
35
- "src/index.ts",
36
- "src/worker/build-worker.ts"
37
- ]
38
- }
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": [
5
+ "ES2020"
6
+ ],
7
+ "outDir": "./dist",
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "@simplysm/sd-core-common": [
11
+ "../sd-core-common/src/index.ts"
12
+ ],
13
+ "@simplysm/sd-core-node": [
14
+ "../sd-core-node/src/index.ts"
15
+ ],
16
+ "@simplysm/sd-service-common": [
17
+ "../sd-service-common/src/index.ts"
18
+ ],
19
+ "@simplysm/sd-service-server": [
20
+ "../sd-service-server/src/index.ts"
21
+ ],
22
+ "@simplysm/sd-orm-common": [
23
+ "../sd-orm-common/src/index.ts"
24
+ ],
25
+ "@simplysm/sd-orm-node": [
26
+ "../sd-orm-node/src/index.ts"
27
+ ],
28
+ "@simplysm/sd-storage": [
29
+ "../sd-storage/src/index.ts"
30
+ ]
31
+ }
32
+ },
33
+ "files": [
34
+ "src/bin/sd-cli.ts",
35
+ "src/index.ts",
36
+ "src/worker/build-worker.ts"
37
+ ]
38
+ }