@tsed/cli 3.24.0 → 3.26.0-beta.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.
Files changed (88) hide show
  1. package/lib/cjs/Cli.js +35 -4
  2. package/lib/cjs/Cli.js.map +1 -1
  3. package/lib/cjs/bin/tsed.js +1 -23
  4. package/lib/cjs/bin/tsed.js.map +1 -1
  5. package/lib/cjs/commands/init/InitCmd.js +58 -34
  6. package/lib/cjs/commands/init/InitCmd.js.map +1 -1
  7. package/lib/cjs/commands/init/config/FeaturesPrompt.js +406 -0
  8. package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -0
  9. package/lib/cjs/commands/init/config/InitFileSchema.js +49 -0
  10. package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -0
  11. package/lib/cjs/commands/init/interfaces/InitCmdContext.js +3 -0
  12. package/lib/cjs/commands/init/interfaces/InitCmdContext.js.map +1 -0
  13. package/lib/cjs/commands/init/interfaces/InitOptions.js +3 -0
  14. package/lib/cjs/commands/init/interfaces/InitOptions.js.map +1 -0
  15. package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js +3 -0
  16. package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  17. package/lib/cjs/commands/init/mappers/mapToContext.js +16 -0
  18. package/lib/cjs/commands/init/mappers/mapToContext.js.map +1 -0
  19. package/lib/cjs/commands/init/mappers/mapUniqFeatures.js +18 -0
  20. package/lib/cjs/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  21. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +25 -0
  22. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  23. package/lib/cjs/commands/init/utils/hasFeature.js +13 -0
  24. package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -0
  25. package/lib/cjs/commands/init/utils/isPlatform.js +8 -0
  26. package/lib/cjs/commands/init/utils/isPlatform.js.map +1 -0
  27. package/lib/cjs/index.js +6 -1
  28. package/lib/cjs/index.js.map +1 -1
  29. package/lib/cjs/interfaces/PlatformType.js +9 -0
  30. package/lib/cjs/interfaces/PlatformType.js.map +1 -0
  31. package/lib/cjs/interfaces/index.js +1 -0
  32. package/lib/cjs/interfaces/index.js.map +1 -1
  33. package/lib/cjs/services/Features.js +118 -133
  34. package/lib/cjs/services/Features.js.map +1 -1
  35. package/lib/esm/Cli.js +35 -4
  36. package/lib/esm/Cli.js.map +1 -1
  37. package/lib/esm/bin/tsed.js +1 -22
  38. package/lib/esm/bin/tsed.js.map +1 -1
  39. package/lib/esm/commands/init/InitCmd.js +61 -37
  40. package/lib/esm/commands/init/InitCmd.js.map +1 -1
  41. package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
  42. package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
  43. package/lib/esm/commands/init/config/InitFileSchema.js +46 -0
  44. package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
  45. package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
  46. package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
  47. package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
  48. package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
  49. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
  50. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  51. package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
  52. package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
  53. package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
  54. package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  55. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
  56. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  57. package/lib/esm/commands/init/utils/hasFeature.js +8 -0
  58. package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
  59. package/lib/esm/commands/init/utils/isPlatform.js +4 -0
  60. package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
  61. package/lib/esm/index.js +6 -1
  62. package/lib/esm/index.js.map +1 -1
  63. package/lib/esm/interfaces/PlatformType.js +6 -0
  64. package/lib/esm/interfaces/PlatformType.js.map +1 -0
  65. package/lib/esm/interfaces/index.js +1 -0
  66. package/lib/esm/interfaces/index.js.map +1 -1
  67. package/lib/esm/services/Features.js +117 -128
  68. package/lib/esm/services/Features.js.map +1 -1
  69. package/lib/types/Cli.d.ts +23 -1
  70. package/lib/types/commands/index.d.ts +1 -1
  71. package/lib/types/commands/init/InitCmd.d.ts +8 -24
  72. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
  73. package/lib/types/commands/init/config/InitFileSchema.d.ts +45 -0
  74. package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
  75. package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
  76. package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
  77. package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
  78. package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
  79. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
  80. package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
  81. package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
  82. package/lib/types/index.d.ts +6 -1
  83. package/lib/types/interfaces/PlatformType.d.ts +4 -0
  84. package/lib/types/interfaces/index.d.ts +1 -0
  85. package/lib/types/services/Features.d.ts +0 -18
  86. package/package.json +7 -4
  87. package/readme.md +33 -8
  88. package/templates/init/tsconfig.json.hbs +3 -5
@@ -0,0 +1,19 @@
1
+ import { PackageManager } from "@tsed/cli-core";
2
+ import { PlatformType } from "../../../interfaces/PlatformType";
3
+ import { ArchitectureConvention } from "../../../interfaces/ArchitectureConvention";
4
+ import { ProjectConvention } from "../../../interfaces/ProjectConvention";
5
+ import { FeatureType } from "../config/FeaturesPrompt";
6
+ export interface InitOptions {
7
+ root: string;
8
+ projectName: string;
9
+ features: FeatureType[];
10
+ skipPrompt: boolean;
11
+ platform: PlatformType;
12
+ tsedVersion: string;
13
+ cliVersion: string;
14
+ architecture: ArchitectureConvention;
15
+ convention: ProjectConvention;
16
+ packageManager: PackageManager;
17
+ oidcBasePath: string;
18
+ file: string;
19
+ }
@@ -0,0 +1,16 @@
1
+ import { PackageManager } from "@tsed/cli-core";
2
+ import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
3
+ export interface InitPromptAnswers {
4
+ projectName: string;
5
+ platform: PlatformType;
6
+ architecture: ArchitectureConvention;
7
+ convention: ProjectConvention;
8
+ features: string[];
9
+ featuresDB: string[];
10
+ featuresTypeORM: string;
11
+ featuresTesting: string;
12
+ featuresExtraLinter: string[];
13
+ featuresBundler: string;
14
+ oidcBasePath: string;
15
+ packageManager: PackageManager;
16
+ }
@@ -0,0 +1,2 @@
1
+ import { InitCmdContext } from "../interfaces/InitCmdContext";
2
+ export declare function mapToContext(options: any): InitCmdContext;
@@ -0,0 +1,3 @@
1
+ import { InitPromptAnswers } from "../interfaces/InitPromptAnswers";
2
+ import { InitOptions } from "../interfaces/InitOptions";
3
+ export declare function mapUniqFeatures(answers: InitPromptAnswers & any): InitOptions;
@@ -0,0 +1,2 @@
1
+ import { InitOptions } from "../interfaces/InitOptions";
2
+ export declare function getFeaturesPrompt(options: Partial<InitOptions>): any[];
@@ -0,0 +1,2 @@
1
+ export declare function hasValue(expression: string, value: any): (ctx: any) => boolean;
2
+ export declare function hasFeature(feature: string): (ctx: any) => boolean;
@@ -0,0 +1 @@
1
+ export declare function isPlatform(...types: string[]): (ctx: any) => boolean;
@@ -1,9 +1,14 @@
1
1
  export * from "./commands/add/AddCmd";
2
2
  export * from "./commands/init/InitCmd";
3
+ export * from "./commands/init/interfaces/InitCmdContext";
4
+ export * from "./commands/init/interfaces/InitOptions";
5
+ export * from "./commands/init/config/FeaturesPrompt";
6
+ export * from "./commands/init/config/FeaturesPrompt";
3
7
  export * from "./commands/generate/GenerateCmd";
4
8
  export * from "./commands/update/UpdateCmd";
9
+ export * from "./commands/init/prompts/getFeaturesPrompt";
5
10
  export * from "./interfaces";
6
11
  export * from "./services/ProvidersInfoService";
7
- export * from "./services/Features";
8
12
  export * from "./pipes";
9
13
  export * from "./constants";
14
+ export * from "./Cli";
@@ -0,0 +1,4 @@
1
+ export declare enum PlatformType {
2
+ EXPRESS = "express",
3
+ KOA = "koa"
4
+ }
@@ -1,2 +1,3 @@
1
1
  export * from "./ProjectConvention";
2
+ export * from "./PlatformType";
2
3
  export * from "./ArchitectureConvention";
@@ -1,22 +1,4 @@
1
1
  import { ProjectConvention } from "../interfaces";
2
- export interface FeatureValue {
3
- type: string;
4
- dependencies?: {
5
- [key: string]: string | undefined;
6
- };
7
- devDependencies?: {
8
- [key: string]: string | undefined;
9
- };
10
- }
11
- export interface Feature {
12
- name: string;
13
- value: FeatureValue;
14
- }
15
- export declare type Features = Feature[];
16
- export declare function Features(): Function;
17
- export declare function hasFeature(feature: string): (ctx: any) => boolean;
18
- export declare function hasValue(expression: string, value: any): (ctx: any) => boolean;
19
- export declare function isPlatform(...types: string[]): (ctx: any) => boolean;
20
2
  export declare const FEATURES_TYPEORM_CONNECTION_TYPES: ({
21
3
  name: string;
22
4
  value: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/cli",
3
- "version": "3.24.0",
3
+ "version": "3.26.0-beta.1",
4
4
  "source": "./src/index.ts",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -56,7 +56,7 @@
56
56
  "node": ">=14"
57
57
  },
58
58
  "dependencies": {
59
- "@tsed/cli-core": "3.24.0",
59
+ "@tsed/cli-core": "3.26.0-beta.1",
60
60
  "@tsed/core": ">=6.114.14",
61
61
  "@tsed/di": ">=6.114.14",
62
62
  "@tsed/logger": ">=6.0.0",
@@ -80,7 +80,10 @@
80
80
  "bugs": {
81
81
  "url": "https://github.com/tsedio/tsed-cli/issues"
82
82
  },
83
- "homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli",
83
+ "homepage": "https://github.com/tsedio/tsed-cli/tree/beta/packages/cli",
84
84
  "author": "Romain Lenzotti",
85
- "license": "MIT"
85
+ "license": "MIT",
86
+ "publishConfig": {
87
+ "tag": "beta"
88
+ }
86
89
  }
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # @tsed/cli
1
+ # @tsed/cli
2
2
 
3
3
  <p style="text-align: center" align="center">
4
4
  <a href="https://tsed.io" target="_blank"><img src="https://tsed.io/tsed-og.png" width="200" alt="Ts.ED logo"/></a>
@@ -45,24 +45,42 @@ https-proxy=http://username:password@host:port
45
45
  https_proxy=http://username:password@host:port
46
46
  ```
47
47
 
48
- > Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY` and `NODE_TLS_REJECT_UNAUTHORIZED`.
48
+ > Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY`
49
+ > and `NODE_TLS_REJECT_UNAUTHORIZED`.
50
+
51
+ ## Init project
52
+
53
+ ```typescript
54
+
55
+ ```
56
+
57
+ ## Run Cli from code
58
+
59
+ ```typescript
60
+ import {Cli} from "@tsed/cli";
61
+
62
+ Cli.dispatch("init", {
63
+ //... init options
64
+ });
65
+
66
+ ```
49
67
 
50
68
  ## Contributors
69
+
51
70
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
52
71
 
53
72
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
54
73
 
55
-
56
74
  ## Backers
57
75
 
58
76
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
59
77
 
60
78
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
61
79
 
62
-
63
80
  ## Sponsors
64
81
 
65
- Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
82
+ Support this project by becoming a sponsor. Your logo will show up here with a link to your
83
+ website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
66
84
 
67
85
  ## License
68
86
 
@@ -70,8 +88,15 @@ The MIT License (MIT)
70
88
 
71
89
  Copyright (c) 2016 - 2018 Romain Lenzotti
72
90
 
73
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
91
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
92
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
93
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
94
+ persons to whom the Software is furnished to do so, subject to the following conditions:
74
95
 
75
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
96
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
97
+ Software.
76
98
 
77
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
100
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
101
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
102
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "baseUrl": ".",
4
+ "sourceRoot": "src",
4
5
  "module": "commonjs",
5
6
  "target": "esnext",
6
7
  "sourceMap": true,
@@ -29,11 +30,8 @@
29
30
  "./node_modules/@types"
30
31
  ]
31
32
  },
32
- "exclude": [
33
- "node_modules",
34
- "./public",
35
- "dist",
36
- "test"
33
+ "include": [
34
+ "src"
37
35
  ],
38
36
  "linterOptions": {
39
37
  "exclude": []