@tsed/cli 6.0.0 → 6.0.2
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/lib/esm/commands/init/InitCmd.js +1 -1
- package/lib/esm/constants/index.js +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/constants/index.d.ts +1 -1
- package/package.json +13 -11
- package/templates/generate/factory.hbs +8 -32
- package/templates/generate/server.hbs +3 -7
- package/templates/generate/value.hbs +2 -31
- package/templates/init/src/index.ts.hbs +29 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const PKG: import("read-pkg-up").NormalizedPackageJson;
|
|
2
2
|
export declare const MINIMAL_TSED_VERSION = "8";
|
|
3
|
-
export declare const DEFAULT_TSED_TAGS = "
|
|
3
|
+
export declare const DEFAULT_TSED_TAGS = "rc";
|
|
4
4
|
export declare const IGNORE_VERSIONS: string[];
|
|
5
5
|
export declare const IGNORE_TAGS: false | RegExp;
|
|
6
6
|
export declare const TEMPLATE_DIR: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli",
|
|
3
3
|
"description": "CLI to bootstrap your Ts.ED project",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"source": "./src/index.ts",
|
|
@@ -66,12 +66,13 @@
|
|
|
66
66
|
"@swc-node/register": "^1.10.9",
|
|
67
67
|
"@swc/core": "1.7.26",
|
|
68
68
|
"@swc/helpers": "^0.5.13",
|
|
69
|
-
"@tsed/cli-core": "6.0.
|
|
70
|
-
"@tsed/core": ">=8.0.0-
|
|
71
|
-
"@tsed/di": ">=8.0.0-
|
|
69
|
+
"@tsed/cli-core": "6.0.2",
|
|
70
|
+
"@tsed/core": ">=8.0.0-rc.6",
|
|
71
|
+
"@tsed/di": ">=8.0.0-rc.6",
|
|
72
|
+
"@tsed/hooks": ">=8.0.0-rc.6",
|
|
72
73
|
"@tsed/logger": ">=6.2.1",
|
|
73
|
-
"@tsed/openspec": ">=8.0.0-
|
|
74
|
-
"@tsed/schema": ">=8.0.0-
|
|
74
|
+
"@tsed/openspec": ">=8.0.0-rc.6",
|
|
75
|
+
"@tsed/schema": ">=8.0.0-rc.6",
|
|
75
76
|
"chalk": "^5.3.0",
|
|
76
77
|
"change-case": "^5.4.4",
|
|
77
78
|
"esm-module-alias": "^2.2.1",
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
"tslib": "^2.7.0"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
|
-
"@tsed/typescript": "6.0.
|
|
85
|
+
"@tsed/typescript": "6.0.2",
|
|
85
86
|
"@types/change-case": "^2.3.1",
|
|
86
87
|
"cross-env": "7.0.3",
|
|
87
88
|
"typescript": "5.6.2",
|
|
@@ -89,11 +90,12 @@
|
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"@tsed/cli-core": "workspace:*",
|
|
92
|
-
"@tsed/core": ">=8.0.0-
|
|
93
|
-
"@tsed/di": ">=8.0.0-
|
|
93
|
+
"@tsed/core": ">=8.0.0-rc.6",
|
|
94
|
+
"@tsed/di": ">=8.0.0-rc.6",
|
|
95
|
+
"@tsed/hooks": ">=8.0.0-rc.6",
|
|
94
96
|
"@tsed/logger": ">=6.2.1",
|
|
95
|
-
"@tsed/openspec": ">=8.0.0-
|
|
96
|
-
"@tsed/schema": ">=8.0.0-
|
|
97
|
+
"@tsed/openspec": ">=8.0.0-rc.6",
|
|
98
|
+
"@tsed/schema": ">=8.0.0-rc.6"
|
|
97
99
|
},
|
|
98
100
|
"repository": "https://github.com/tsedio/tsed-cli",
|
|
99
101
|
"bugs": {
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Inject {{symbolName}} to the service, controller, etc...
|
|
5
|
-
*
|
|
6
|
-
* ## Usage
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import {Injectable} from "@tsed/di";
|
|
10
|
-
* import {{{symbolName}}} from "./{{symbolName}}";
|
|
11
|
-
*
|
|
12
|
-
* @Injectable()
|
|
13
|
-
* class MyService {
|
|
14
|
-
* @{{symbolName}}()
|
|
15
|
-
* private factory: {{symbolName}};
|
|
16
|
-
*
|
|
17
|
-
* // or
|
|
18
|
-
* constructor(@{{symbolName}}() private factory: {{symbolName}}){}
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* @decorator
|
|
22
|
-
*/
|
|
23
|
-
export function {{symbolName}}() {
|
|
24
|
-
return Inject({{symbolName}});
|
|
25
|
-
}
|
|
1
|
+
import {constant, injectable} from "@tsed/di";
|
|
26
2
|
|
|
27
3
|
export type {{symbolName}} = any; // implement type or interface for type checking
|
|
4
|
+
export const {{symbolName}} = injectable(Symbol.for("{{symbolName}}")
|
|
5
|
+
.factory(() => {
|
|
6
|
+
// retrieve custom configuration from settings (e.g.: `@Configuration({hello: "value"})`)
|
|
7
|
+
const hello = constant("hello");
|
|
28
8
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
useFactory(settings: Configuration) {
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
});
|
|
9
|
+
return {hello};
|
|
10
|
+
})
|
|
11
|
+
.token();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {join} from "path";
|
|
2
|
-
import {Configuration
|
|
3
|
-
import {
|
|
2
|
+
import {Configuration} from "@tsed/di";
|
|
3
|
+
import {application} from "@tsed/platform-http";
|
|
4
4
|
{{#forEach imports}}{{#if tsIngore}}
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
{{/if}}import {{symbols}}{{#if symbols}} from {{/if}}"{{from}}";{{comment}}
|
|
@@ -53,9 +53,5 @@ import {PlatformApplication} from "@tsed/platform-http";
|
|
|
53
53
|
]
|
|
54
54
|
})
|
|
55
55
|
export class {{symbolName}} {
|
|
56
|
-
|
|
57
|
-
protected app: PlatformApplication;
|
|
58
|
-
|
|
59
|
-
@Configuration()
|
|
60
|
-
protected settings: Configuration;
|
|
56
|
+
protected app = application();
|
|
61
57
|
}
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {injectable} from "@tsed/di";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* Inject {{symbolName}} to the service, controller, etc...
|
|
5
|
-
*
|
|
6
|
-
* ## Usage
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import {Injectable} from "@tsed/di";
|
|
10
|
-
* import {{{symbolName}}} from "./{{symbolName}}";
|
|
11
|
-
*
|
|
12
|
-
* @Injectable()
|
|
13
|
-
* class MyService {
|
|
14
|
-
* @{{symbolName}}()
|
|
15
|
-
* private value: {{symbolName}};
|
|
16
|
-
*
|
|
17
|
-
* // or
|
|
18
|
-
* constructor(@{{symbolName}}() private value: {{symbolName}}){}
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* @decorator
|
|
22
|
-
*/
|
|
23
|
-
export function {{symbolName}}() {
|
|
24
|
-
return Inject({{symbolName}});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type {{symbolName}} = any; // implement type or interface for type checking
|
|
28
|
-
|
|
29
|
-
registerProvider({
|
|
30
|
-
provide: {{symbolName}},
|
|
31
|
-
useValue: {}
|
|
32
|
-
});
|
|
3
|
+
export const {{symbolName}} = injectable(Symbol.for("{{symbolName}}")).value({}).token();
|
|
@@ -2,17 +2,35 @@ import {$log} from "@tsed/logger";
|
|
|
2
2
|
import { {{platformSymbol}} } from "@tsed/platform-{{platform}}";
|
|
3
3
|
import {Server} from "./{{entryServer}}.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const SIG_EVENTS = [
|
|
6
|
+
"beforeExit",
|
|
7
|
+
"SIGHUP",
|
|
8
|
+
"SIGINT",
|
|
9
|
+
"SIGQUIT",
|
|
10
|
+
"SIGILL",
|
|
11
|
+
"SIGTRAP",
|
|
12
|
+
"SIGABRT",
|
|
13
|
+
"SIGBUS",
|
|
14
|
+
"SIGFPE",
|
|
15
|
+
"SIGUSR1",
|
|
16
|
+
"SIGSEGV",
|
|
17
|
+
"SIGUSR2",
|
|
18
|
+
"SIGTERM"
|
|
19
|
+
];
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
try {
|
|
22
|
+
const platform = await {{platformSymbol}}.bootstrap(Server);
|
|
23
|
+
await platform.listen();
|
|
24
|
+
|
|
25
|
+
SIG_EVENTS.forEach((evt) => process.on(evt, close));
|
|
26
|
+
|
|
27
|
+
["uncaughtException", "unhandledRejection"].forEach((evt) =>
|
|
28
|
+
process.on(evt, async (error) => {
|
|
29
|
+
$log.error({event: "SERVER_" + evt.toUpperCase(), message: error.message, stack: error.stack});
|
|
30
|
+
await stop();
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
$log.error({event: "SERVER_BOOTSTRAP_ERROR", message: error.message, stack: error.stack});
|
|
16
35
|
}
|
|
17
36
|
|
|
18
|
-
bootstrap();
|