@rxap/plugin-nestjs 19.0.4-dev.9 → 19.0.5-dev.0

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 (53) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/GUIDES.md +7 -0
  3. package/package.json +14 -13
  4. package/src/generators/feature-microservice/generator.js +1 -1
  5. package/src/generators/feature-microservice/generator.js.map +1 -1
  6. package/src/generators/feature-microservice/schema.json +95 -14
  7. package/src/generators/frontend-microservice/generator.js +1 -1
  8. package/src/generators/frontend-microservice/generator.js.map +1 -1
  9. package/src/generators/frontend-microservice/schema.json +101 -20
  10. package/src/generators/init-application/assert-main-statements.d.ts +3 -0
  11. package/src/generators/init-application/assert-main-statements.js +66 -0
  12. package/src/generators/init-application/assert-main-statements.js.map +1 -0
  13. package/src/generators/init-application/coerce-environment-files.d.ts +6 -0
  14. package/src/generators/init-application/coerce-environment-files.js +64 -0
  15. package/src/generators/init-application/coerce-environment-files.js.map +1 -0
  16. package/src/generators/init-application/coerce-open-api-client-sdk-library.d.ts +3 -0
  17. package/src/generators/init-application/coerce-open-api-client-sdk-library.js +34 -0
  18. package/src/generators/init-application/coerce-open-api-client-sdk-library.js.map +1 -0
  19. package/src/generators/init-application/generator.js +22 -395
  20. package/src/generators/init-application/generator.js.map +1 -1
  21. package/src/generators/init-application/get-port.d.ts +3 -0
  22. package/src/generators/init-application/get-port.js +29 -0
  23. package/src/generators/init-application/get-port.js.map +1 -0
  24. package/src/generators/init-application/remove-app-controller-spec-file.d.ts +2 -0
  25. package/src/generators/init-application/remove-app-controller-spec-file.js +22 -0
  26. package/src/generators/init-application/remove-app-controller-spec-file.js.map +1 -0
  27. package/src/generators/init-application/remove-app-service-file.d.ts +2 -0
  28. package/src/generators/init-application/remove-app-service-file.js +35 -0
  29. package/src/generators/init-application/remove-app-service-file.js.map +1 -0
  30. package/src/generators/init-application/schema.json +2 -4
  31. package/src/generators/init-application/set-general-target-defaults.d.ts +3 -0
  32. package/src/generators/init-application/set-general-target-defaults.js +27 -0
  33. package/src/generators/init-application/set-general-target-defaults.js.map +1 -0
  34. package/src/generators/init-application/update-api-configuration-file.d.ts +2 -0
  35. package/src/generators/init-application/update-api-configuration-file.js +13 -0
  36. package/src/generators/init-application/update-api-configuration-file.js.map +1 -0
  37. package/src/generators/init-application/update-git-ignore.d.ts +3 -0
  38. package/src/generators/init-application/update-git-ignore.js +12 -0
  39. package/src/generators/init-application/update-git-ignore.js.map +1 -0
  40. package/src/generators/init-application/update-main-file.d.ts +3 -0
  41. package/src/generators/init-application/update-main-file.js +76 -0
  42. package/src/generators/init-application/update-main-file.js.map +1 -0
  43. package/src/generators/init-application/update-project-targets.d.ts +3 -0
  44. package/src/generators/init-application/update-project-targets.js +70 -0
  45. package/src/generators/init-application/update-project-targets.js.map +1 -0
  46. package/src/generators/init-application/update-tags.d.ts +3 -0
  47. package/src/generators/init-application/update-tags.js +35 -0
  48. package/src/generators/init-application/update-tags.js.map +1 -0
  49. package/src/generators/init-library/generator.js +1 -0
  50. package/src/generators/init-library/generator.js.map +1 -1
  51. package/src/generators/microservice/generator.js +14 -6
  52. package/src/generators/microservice/generator.js.map +1 -1
  53. package/src/generators/microservice/schema.json +111 -16
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [19.0.5-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@19.0.4...@rxap/plugin-nestjs@19.0.5-dev.0) (2024-06-18)
7
+
8
+ **Note:** Version bump only for package @rxap/plugin-nestjs
9
+
10
+ ## [19.0.4](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@19.0.4-dev.12...@rxap/plugin-nestjs@19.0.4) (2024-06-18)
11
+
12
+ **Note:** Version bump only for package @rxap/plugin-nestjs
13
+
14
+ ## [19.0.4-dev.12](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@19.0.4-dev.11...@rxap/plugin-nestjs@19.0.4-dev.12) (2024-06-18)
15
+
16
+ ### Bug Fixes
17
+
18
+ - support new directory and name definition ([f9a44f5](https://gitlab.com/rxap/packages/commit/f9a44f5441020f4eb574598e03dbde7b3c77fc6c))
19
+
20
+ ## [19.0.4-dev.11](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@19.0.4-dev.10...@rxap/plugin-nestjs@19.0.4-dev.11) (2024-06-18)
21
+
22
+ ### Bug Fixes
23
+
24
+ - add defaults ([2db7304](https://gitlab.com/rxap/packages/commit/2db73049adf2167a5fb61f2c63fbdbe1cb0f5480))
25
+
26
+ ## [19.0.4-dev.10](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@19.0.4-dev.9...@rxap/plugin-nestjs@19.0.4-dev.10) (2024-06-18)
27
+
28
+ **Note:** Version bump only for package @rxap/plugin-nestjs
29
+
6
30
  ## [19.0.4-dev.9](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@19.0.4-dev.8...@rxap/plugin-nestjs@19.0.4-dev.9) (2024-06-18)
7
31
 
8
32
  **Note:** Version bump only for package @rxap/plugin-nestjs
package/GUIDES.md CHANGED
@@ -0,0 +1,7 @@
1
+ # Frontend Microservice
2
+
3
+ Run the following command to create a new frontend microservice:
4
+
5
+ ```bash
6
+ nx g @rxap/plugin-nestjs:frontend-microservice --feature $FEATURE --frontend $PROJECT
7
+ ```
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
- "version": "19.0.4-dev.9",
2
+ "version": "19.0.5-dev.0",
3
3
  "name": "@rxap/plugin-nestjs",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
6
- "@nx/devkit": "19.1.1",
7
- "@nx/js": "19.1.1",
8
- "@nx/nest": "19.1.1",
9
- "@rxap/node-utilities": "^1.3.0-dev.0",
10
- "@rxap/plugin-application": "^19.0.3-dev.4",
11
- "@rxap/plugin-library": "^19.2.0-dev.8",
12
- "@rxap/plugin-utilities": "^19.0.3-dev.4",
13
- "@rxap/ts-morph": "^1.4.0-dev.3",
14
- "@rxap/utilities": "^16.2.3-dev.0",
15
- "@rxap/workspace-ts-morph": "^19.1.0-dev.4",
16
- "@rxap/workspace-utilities": "^19.2.0-dev.8",
6
+ "@nx/devkit": "19.3.0",
7
+ "@nx/js": "19.3.0",
8
+ "@nx/nest": "19.3.0",
9
+ "@rxap/node-utilities": "^1.3.0",
10
+ "@rxap/plugin-application": "^19.0.4-dev.0",
11
+ "@rxap/plugin-library": "^19.2.1-dev.0",
12
+ "@rxap/plugin-open-api": "^19.1.1-dev.0",
13
+ "@rxap/plugin-utilities": "^19.0.4-dev.0",
14
+ "@rxap/ts-morph": "^1.4.0",
15
+ "@rxap/utilities": "^16.2.3",
16
+ "@rxap/workspace-ts-morph": "^19.1.1-dev.0",
17
+ "@rxap/workspace-utilities": "^19.2.1-dev.0",
17
18
  "colors": "1.4.0",
18
19
  "semver": "7.5.3",
19
20
  "ts-morph": "18.0.0",
@@ -53,6 +54,6 @@
53
54
  },
54
55
  "schematics": "./generators.json",
55
56
  "type": "commonjs",
56
- "gitHead": "a261f463bc7d9023674bf53bbbc80d80df38a906",
57
+ "gitHead": "ffe854d3d7cf69a737411c0798157c1c945e3b5c",
57
58
  "main": "./src/index.js"
58
59
  }
@@ -12,7 +12,7 @@ function featureMicroserviceGenerator(tree, options) {
12
12
  throw new Error('No nx.json found');
13
13
  }
14
14
  const presetOptions = (_b = (_a = nxJson.generators) === null || _a === void 0 ? void 0 : _a['@rxap/plugin-nestjs:microservice']) !== null && _b !== void 0 ? _b : {};
15
- yield (0, generator_1.default)(tree, Object.assign(Object.assign(Object.assign(Object.assign({}, presetOptions), { apiPrefix: ['api', 'feature', options.feature].join('/') }), options), { name: options.feature, directory: ['service', 'feature'].join('/') }));
15
+ yield (0, generator_1.default)(tree, Object.assign(Object.assign(Object.assign(Object.assign({}, presetOptions), { apiPrefix: ['api', 'feature', options.feature].join('/') }), options), { name: ['service', 'feature', options.feature].join('-'), directory: ['service', 'feature', options.feature].join('/') }));
16
16
  });
17
17
  }
18
18
  exports.featureMicroserviceGenerator = featureMicroserviceGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/feature-microservice/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAGoB;AACpB,yDAA8D;AAG9D,SAAsB,4BAA4B,CAChD,IAAU,EACV,OAA2C;;;QAG3C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,aAAa,GAAG,MAAA,MAAA,MAAM,CAAC,UAAU,0CAAG,kCAAkC,CAAC,mCAAI,EAAE,CAAC;QAEpF,MAAM,IAAA,mBAAqB,EAAC,IAAI,8DAC3B,aAAa,KAChB,SAAS,EAAE,CAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KACvD,OAAO,KACV,IAAI,EAAE,OAAO,CAAC,OAAO,EACrB,SAAS,EAAE,CAAE,SAAS,EAAE,SAAS,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAC7C,CAAC;IAEL,CAAC;CAAA;AAnBD,oEAmBC;AAED,kBAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/feature-microservice/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAGoB;AACpB,yDAA8D;AAG9D,SAAsB,4BAA4B,CAChD,IAAU,EACV,OAA2C;;;QAG3C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,aAAa,GAAG,MAAA,MAAA,MAAM,CAAC,UAAU,0CAAG,kCAAkC,CAAC,mCAAI,EAAE,CAAC;QAEpF,MAAM,IAAA,mBAAqB,EAAC,IAAI,8DAC3B,aAAa,KAChB,SAAS,EAAE,CAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KACvD,OAAO,KACV,IAAI,EAAE,CAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EACzD,SAAS,EAAE,CAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAC9D,CAAC;IAEL,CAAC;CAAA;AAnBD,oEAmBC;AAED,kBAAe,4BAA4B,CAAC"}
@@ -2,22 +2,103 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "$id": "FeatureMicroservice",
4
4
  "title": "",
5
- "allOf": [
6
- {
7
- "type": "object",
8
- "properties": {
9
- "feature": {
10
- "type": "string",
11
- "description": "The feature of the frontend project",
12
- "x-prompt": "For which feature of the frontend should the microservice be created?"
13
- }
5
+ "type": "object",
6
+ "properties": {
7
+ "feature": {
8
+ "type": "string",
9
+ "description": "The feature of the frontend project",
10
+ "x-prompt": "For which feature of the frontend should the microservice be created?"
11
+ },
12
+
13
+ "sentry": {
14
+ "type": "boolean",
15
+ "default": true,
16
+ "description": "Whether this service should use sentry",
17
+ "x-prompt": "Should this service use sentry?"
18
+ },
19
+ "skipFormat": {
20
+ "type": "boolean",
21
+ "default": false
22
+ },
23
+ "swagger": {
24
+ "type": "boolean",
25
+ "default": true,
26
+ "description": "Whether this service should use swagger",
27
+ "x-prompt": "Should this service support open-api config generation?"
28
+ },
29
+ "swaggerLive": {
30
+ "type": "boolean",
31
+ "default": false,
32
+ "description": "Whether this service should start a swagger live server"
33
+ },
34
+ "generateMain": {
35
+ "type": "boolean",
36
+ "description": "Whether the main file should be generated"
37
+ },
38
+ "healthIndicator": {
39
+ "type": "boolean",
40
+ "default": true,
41
+ "description": "Whether this service should use a health indicator",
42
+ "x-prompt": "Should this service have a health indicator endpoint?"
43
+ },
44
+ "healthIndicatorList": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "string"
14
48
  },
15
- "required": [
16
- "feature"
17
- ]
49
+ "description": "A list of health indicators"
50
+ },
51
+ "validator": {
52
+ "type": "boolean",
53
+ "default": true,
54
+ "description": "Whether this service use the ValidationPipe",
55
+ "x-prompt": "Should this service use the ValidationPipe?"
56
+ },
57
+ "platform": {
58
+ "type": "string",
59
+ "enum": [
60
+ "express",
61
+ "fastify"
62
+ ],
63
+ "default": "express",
64
+ "x-prompt": "Whichever platform should be used?"
65
+ },
66
+ "port": {
67
+ "type": "number",
68
+ "description": "The default port where the server is listens"
69
+ },
70
+ "sentryDsn": {
71
+ "type": "string",
72
+ "description": "Default sentry dsn"
73
+ },
74
+ "overwrite": {
75
+ "type": "boolean",
76
+ "default": false,
77
+ "description": "Whether to overwrite existing files"
78
+ },
79
+ "jwt": {
80
+ "type": "boolean",
81
+ "default": false,
82
+ "description": "Whether the application should use jwt",
83
+ "x-prompt": "Should this service use jwt?"
84
+ },
85
+ "openApi": {
86
+ "type": "boolean",
87
+ "default": false,
88
+ "description": "Whether the application should use openApi as client",
89
+ "x-prompt": "Should this service use an open api client?"
90
+ },
91
+ "apiConfigurationFile": {
92
+ "type": "string",
93
+ "description": "The api configuration file to use"
18
94
  },
19
- {
20
- "$ref": "../init-application/schema.json"
95
+ "standalone": {
96
+ "type": "boolean",
97
+ "default": false,
98
+ "description": "Whether the nest service should be standalone"
21
99
  }
100
+ },
101
+ "required": [
102
+ "feature"
22
103
  ]
23
104
  }
@@ -12,7 +12,7 @@ function frontendMicroserviceGenerator(tree, options) {
12
12
  throw new Error('No nx.json found');
13
13
  }
14
14
  const presetOptions = (_b = (_a = nxJson.generators) === null || _a === void 0 ? void 0 : _a['@rxap/plugin-nestjs:microservice']) !== null && _b !== void 0 ? _b : {};
15
- yield (0, generator_1.default)(tree, Object.assign(Object.assign(Object.assign(Object.assign({}, presetOptions), { apiPrefix: ['api', 'app', options.frontend, options.feature].join('/') }), options), { name: options.feature, directory: ['service', 'app', options.frontend].join('/') }));
15
+ yield (0, generator_1.default)(tree, Object.assign(Object.assign(Object.assign(Object.assign({}, presetOptions), { apiPrefix: ['api', 'app', options.frontend, options.feature].join('/') }), options), { name: ['service', 'app', options.frontend, options.feature].join('-'), directory: ['service', 'app', options.frontend, options.feature].join('/') }));
16
16
  });
17
17
  }
18
18
  exports.frontendMicroserviceGenerator = frontendMicroserviceGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/frontend-microservice/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAGoB;AACpB,yDAA8D;AAG9D,SAAsB,6BAA6B,CACjD,IAAU,EACV,OAA4C;;;QAG5C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,aAAa,GAAG,MAAA,MAAA,MAAM,CAAC,UAAU,0CAAG,kCAAkC,CAAC,mCAAI,EAAE,CAAC;QAEpF,MAAM,IAAA,mBAAqB,EAAC,IAAI,8DAC3B,aAAa,KAChB,SAAS,EAAE,CAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KACrE,OAAO,KACV,IAAI,EAAE,OAAO,CAAC,OAAO,EACrB,SAAS,EAAE,CAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAC3D,CAAC;IAEL,CAAC;CAAA;AAnBD,sEAmBC;AAED,kBAAe,6BAA6B,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/frontend-microservice/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAGoB;AACpB,yDAA8D;AAG9D,SAAsB,6BAA6B,CACjD,IAAU,EACV,OAA4C;;;QAG5C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,aAAa,GAAG,MAAA,MAAA,MAAM,CAAC,UAAU,0CAAG,kCAAkC,CAAC,mCAAI,EAAE,CAAC;QAEpF,MAAM,IAAA,mBAAqB,EAAC,IAAI,8DAC3B,aAAa,KAChB,SAAS,EAAE,CAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KACrE,OAAO,KACV,IAAI,EAAE,CAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,SAAS,EAAE,CAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAC5E,CAAC;IAEL,CAAC;CAAA;AAnBD,sEAmBC;AAED,kBAAe,6BAA6B,CAAC"}
@@ -2,28 +2,109 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "$id": "FrontendMicroservice",
4
4
  "title": "",
5
- "allOf": [
6
- {
7
- "type": "object",
8
- "properties": {
9
- "frontend": {
10
- "type": "string",
11
- "description": "The name of frontend project",
12
- "x-prompt": "For which frontend project should the microservice be created?"
13
- },
14
- "feature": {
15
- "type": "string",
16
- "description": "The feature of the frontend project",
17
- "x-prompt": "For which feature of the frontend should the microservice be created?"
18
- }
5
+ "type": "object",
6
+ "properties": {
7
+ "frontend": {
8
+ "type": "string",
9
+ "description": "The name of frontend project",
10
+ "x-prompt": "For which frontend project should the microservice be created?"
11
+ },
12
+ "feature": {
13
+ "type": "string",
14
+ "description": "The feature of the frontend project",
15
+ "x-prompt": "For which feature of the frontend should the microservice be created?"
16
+ },
17
+
18
+ "sentry": {
19
+ "type": "boolean",
20
+ "default": true,
21
+ "description": "Whether this service should use sentry",
22
+ "x-prompt": "Should this service use sentry?"
23
+ },
24
+ "skipFormat": {
25
+ "type": "boolean",
26
+ "default": false
27
+ },
28
+ "swagger": {
29
+ "type": "boolean",
30
+ "default": true,
31
+ "description": "Whether this service should use swagger",
32
+ "x-prompt": "Should this service support open-api config generation?"
33
+ },
34
+ "swaggerLive": {
35
+ "type": "boolean",
36
+ "default": false,
37
+ "description": "Whether this service should start a swagger live server"
38
+ },
39
+ "generateMain": {
40
+ "type": "boolean",
41
+ "description": "Whether the main file should be generated"
42
+ },
43
+ "healthIndicator": {
44
+ "type": "boolean",
45
+ "default": true,
46
+ "description": "Whether this service should use a health indicator",
47
+ "x-prompt": "Should this service have a health indicator endpoint?"
48
+ },
49
+ "healthIndicatorList": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
19
53
  },
20
- "required": [
21
- "frontend",
22
- "feature"
23
- ]
54
+ "description": "A list of health indicators"
55
+ },
56
+ "validator": {
57
+ "type": "boolean",
58
+ "default": true,
59
+ "description": "Whether this service use the ValidationPipe",
60
+ "x-prompt": "Should this service use the ValidationPipe?"
61
+ },
62
+ "platform": {
63
+ "type": "string",
64
+ "enum": [
65
+ "express",
66
+ "fastify"
67
+ ],
68
+ "default": "express",
69
+ "x-prompt": "Whichever platform should be used?"
70
+ },
71
+ "port": {
72
+ "type": "number",
73
+ "description": "The default port where the server is listens"
74
+ },
75
+ "sentryDsn": {
76
+ "type": "string",
77
+ "description": "Default sentry dsn"
78
+ },
79
+ "overwrite": {
80
+ "type": "boolean",
81
+ "default": false,
82
+ "description": "Whether to overwrite existing files"
83
+ },
84
+ "jwt": {
85
+ "type": "boolean",
86
+ "default": false,
87
+ "description": "Whether the application should use jwt",
88
+ "x-prompt": "Should this service use jwt?"
89
+ },
90
+ "openApi": {
91
+ "type": "boolean",
92
+ "default": false,
93
+ "description": "Whether the application should use openApi as client",
94
+ "x-prompt": "Should this service use an open api client?"
95
+ },
96
+ "apiConfigurationFile": {
97
+ "type": "string",
98
+ "description": "The api configuration file to use"
24
99
  },
25
- {
26
- "$ref": "../init-application/schema.json"
100
+ "standalone": {
101
+ "type": "boolean",
102
+ "default": false,
103
+ "description": "Whether the nest service should be standalone"
27
104
  }
105
+ },
106
+ "required": [
107
+ "frontend",
108
+ "feature"
28
109
  ]
29
110
  }
@@ -0,0 +1,3 @@
1
+ import { SourceFile } from 'ts-morph';
2
+ export declare const MAIN_BOOTSTRAP_STATEMENT = "server.bootstrap().catch((e) => console.error('Server bootstrap failed: ' + e.message));";
3
+ export declare function assertMainStatements(sourceFile: SourceFile): void;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertMainStatements = exports.MAIN_BOOTSTRAP_STATEMENT = void 0;
4
+ const ts_morph_1 = require("@rxap/ts-morph");
5
+ const MAIN_BOOTSTRAP_OPTIONS_STATEMENT = 'const bootstrapOptions: Partial<MonolithicBootstrapOptions> = {};';
6
+ const MAIN_SERVER_STATEMENT = 'const server = new Monolithic<NestApplicationOptions, NestExpressApplication>(AppModule, environment, options, bootstrapOptions);';
7
+ exports.MAIN_BOOTSTRAP_STATEMENT = 'server.bootstrap().catch((e) => console.error(\'Server bootstrap failed: \' + e.message));';
8
+ const MAIN_SETUP_HELMET_STATEMENT = 'server.after(SetupHelmet());';
9
+ const MAIN_SETUP_COOKIE_STATEMENT = 'server.after(SetupCookieParser());';
10
+ const MAIN_SETUP_CORS_STATEMENT = 'server.after(SetupCors());';
11
+ const MAIN_NEST_APP_OPTIONS_STATEMENT = 'const options: NestApplicationOptions = {};';
12
+ function assertMainStatements(sourceFile) {
13
+ var _a;
14
+ const statements = [];
15
+ statements.push('const options: NestApplicationOptions = {');
16
+ statements.push('const bootstrapOptions: Partial<MonolithicBootstrapOptions> = {');
17
+ statements.push('const server = new Monolithic<NestApplicationOptions, NestExpressApplication>(AppModule, environment, options, bootstrapOptions);');
18
+ const existingStatements = (_a = sourceFile.getStatements().map(s => s.getText())) !== null && _a !== void 0 ? _a : [];
19
+ for (const statement of statements) {
20
+ if (!existingStatements.includes(statement)) {
21
+ console.error(`Missing statement from nestjs main.ts: ${statement}`);
22
+ sourceFile.set({
23
+ statements: [
24
+ MAIN_NEST_APP_OPTIONS_STATEMENT,
25
+ MAIN_BOOTSTRAP_OPTIONS_STATEMENT,
26
+ MAIN_SERVER_STATEMENT,
27
+ MAIN_SETUP_HELMET_STATEMENT,
28
+ MAIN_SETUP_COOKIE_STATEMENT,
29
+ MAIN_SETUP_CORS_STATEMENT,
30
+ exports.MAIN_BOOTSTRAP_STATEMENT,
31
+ ],
32
+ });
33
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
34
+ {
35
+ moduleSpecifier: '@nestjs/common',
36
+ namedImports: ['NestApplicationOptions'],
37
+ },
38
+ {
39
+ moduleSpecifier: '@nestjs/platform-express',
40
+ namedImports: ['NestExpressApplication'],
41
+ },
42
+ {
43
+ moduleSpecifier: '@rxap/nest-server',
44
+ namedImports: [
45
+ 'MonolithicBootstrapOptions',
46
+ 'Monolithic',
47
+ 'SetupHelmet',
48
+ 'SetupCookieParser',
49
+ 'SetupCors',
50
+ ],
51
+ },
52
+ {
53
+ moduleSpecifier: './app/app.module',
54
+ namedImports: ['AppModule'],
55
+ },
56
+ {
57
+ moduleSpecifier: './environments/environment',
58
+ namedImports: ['environment'],
59
+ },
60
+ ]);
61
+ return;
62
+ }
63
+ }
64
+ }
65
+ exports.assertMainStatements = assertMainStatements;
66
+ //# sourceMappingURL=assert-main-statements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-main-statements.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/assert-main-statements.ts"],"names":[],"mappings":";;;AAAA,6CAA+C;AAG/C,MAAM,gCAAgC,GAAG,mEAAmE,CAAC;AAC7G,MAAM,qBAAqB,GAAG,mIAAmI,CAAC;AACrJ,QAAA,wBAAwB,GAAG,4FAA4F,CAAC;AACrI,MAAM,2BAA2B,GAAG,8BAA8B,CAAC;AACnE,MAAM,2BAA2B,GAAG,oCAAoC,CAAC;AACzE,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAC/D,MAAM,+BAA+B,GAAG,6CAA6C,CAAC;AAEtF,SAAgB,oBAAoB,CAAC,UAAsB;;IACzD,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,UAAU,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IAC7D,UAAU,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IACnF,UAAU,CAAC,IAAI,CACb,mIAAmI,CAAC,CAAC;IAEvI,MAAM,kBAAkB,GAAG,MAAA,UAAU,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,mCAAI,EAAE,CAAC;IAClF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,2CAA4C,SAAU,EAAE,CAAC,CAAC;YACxE,UAAU,CAAC,GAAG,CAAC;gBACb,UAAU,EAAE;oBACV,+BAA+B;oBAC/B,gCAAgC;oBAChC,qBAAqB;oBACrB,2BAA2B;oBAC3B,2BAA2B;oBAC3B,yBAAyB;oBACzB,gCAAwB;iBACzB;aACF,CAAC,CAAC;YACH,IAAA,wBAAa,EAAC,UAAU,EAAE;gBACxB;oBACE,eAAe,EAAE,gBAAgB;oBACjC,YAAY,EAAE,CAAE,wBAAwB,CAAE;iBAC3C;gBACD;oBACE,eAAe,EAAE,0BAA0B;oBAC3C,YAAY,EAAE,CAAE,wBAAwB,CAAE;iBAC3C;gBACD;oBACE,eAAe,EAAE,mBAAmB;oBACpC,YAAY,EAAE;wBACZ,4BAA4B;wBAC5B,YAAY;wBACZ,aAAa;wBACb,mBAAmB;wBACnB,WAAW;qBACZ;iBACF;gBACD;oBACE,eAAe,EAAE,kBAAkB;oBACnC,YAAY,EAAE,CAAE,WAAW,CAAE;iBAC9B;gBACD;oBACE,eAAe,EAAE,4BAA4B;oBAC7C,YAAY,EAAE,CAAE,aAAa,CAAE;iBAChC;aACF,CAAC,CAAC;YACH,OAAO;QACT,CAAC;IACH,CAAC;AAGH,CAAC;AAxDD,oDAwDC"}
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function coerceEnvironmentFiles(tree: Tree, options: {
3
+ project: string;
4
+ sentry: boolean;
5
+ overwrite: boolean;
6
+ }): void;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coerceEnvironmentFiles = void 0;
4
+ const ts_morph_1 = require("@rxap/ts-morph");
5
+ const workspace_ts_morph_1 = require("@rxap/workspace-ts-morph");
6
+ const workspace_utilities_1 = require("@rxap/workspace-utilities");
7
+ const ts_morph_2 = require("ts-morph");
8
+ function coerceEnvironmentFiles(tree, options) {
9
+ (0, workspace_ts_morph_1.TsMorphNestProjectTransform)(tree, {
10
+ project: options.project,
11
+ backend: undefined,
12
+ }, (project, [sourceFile, prodSourceFile]) => {
13
+ (0, ts_morph_1.CoerceImports)(sourceFile, {
14
+ moduleSpecifier: '@rxap/nest-utilities',
15
+ namedImports: ['Environment'],
16
+ });
17
+ (0, ts_morph_1.CoerceImports)(prodSourceFile, {
18
+ moduleSpecifier: '@rxap/nest-utilities',
19
+ namedImports: ['Environment'],
20
+ });
21
+ let appName = options.project;
22
+ if ((0, workspace_utilities_1.IsStandaloneWorkspace)(tree)) {
23
+ appName = (0, workspace_utilities_1.GetWorkspaceName)(tree);
24
+ }
25
+ const baseEnvironment = {
26
+ name: w => w.quote('development'),
27
+ production: 'false',
28
+ app: w => w.quote(appName),
29
+ };
30
+ if (options.sentry) {
31
+ baseEnvironment['sentry'] = ts_morph_2.Writers.object({
32
+ enabled: 'false',
33
+ debug: 'false',
34
+ });
35
+ }
36
+ const normal = (0, ts_morph_1.CoerceVariableDeclaration)(sourceFile, 'environment', {
37
+ type: 'Environment',
38
+ initializer: ts_morph_2.Writers.object(baseEnvironment),
39
+ });
40
+ if (options.overwrite) {
41
+ normal.set({ initializer: ts_morph_2.Writers.object(baseEnvironment) });
42
+ }
43
+ baseEnvironment['name'] = w => w.quote('production');
44
+ baseEnvironment['production'] = 'true';
45
+ if (options.sentry) {
46
+ baseEnvironment['sentry'] = ts_morph_2.Writers.object({
47
+ enabled: 'true',
48
+ debug: 'false',
49
+ });
50
+ }
51
+ const prod = (0, ts_morph_1.CoerceVariableDeclaration)(prodSourceFile, 'environment', {
52
+ type: 'Environment',
53
+ initializer: ts_morph_2.Writers.object(baseEnvironment),
54
+ });
55
+ if (options.overwrite) {
56
+ prod.set({ initializer: ts_morph_2.Writers.object(baseEnvironment) });
57
+ }
58
+ }, [
59
+ '/environments/environment.ts?',
60
+ '/environments/environment.prod.ts?',
61
+ ]);
62
+ }
63
+ exports.coerceEnvironmentFiles = coerceEnvironmentFiles;
64
+ //# sourceMappingURL=coerce-environment-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerce-environment-files.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/coerce-environment-files.ts"],"names":[],"mappings":";;;AACA,6CAGwB;AACxB,iEAAuE;AACvE,mEAGmC;AACnC,uCAGkB;AAElB,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAiE;IAElH,IAAA,gDAA2B,EACzB,IAAI,EACJ;QACE,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,SAAS;KACnB,EACD,CAAC,OAAO,EAAE,CAAE,UAAU,EAAE,cAAc,CAAE,EAAE,EAAE;QAE1C,IAAA,wBAAa,EAAC,UAAU,EAAE;YACxB,eAAe,EAAE,sBAAsB;YACvC,YAAY,EAAE,CAAE,aAAa,CAAE;SAChC,CAAC,CAAC;QACH,IAAA,wBAAa,EAAC,cAAc,EAAE;YAC5B,eAAe,EAAE,sBAAsB;YACvC,YAAY,EAAE,CAAE,aAAa,CAAE;SAChC,CAAC,CAAC;QAEH,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC9B,IAAI,IAAA,2CAAqB,EAAC,IAAI,CAAC,EAAE,CAAC;YAChC,OAAO,GAAG,IAAA,sCAAgB,EAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,eAAe,GAA4C;YAC/D,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;YACjC,UAAU,EAAE,OAAO;YACnB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;SAC3B,CAAC;QAEF,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,eAAe,CAAC,QAAQ,CAAC,GAAG,kBAAO,CAAC,MAAM,CAAC;gBACzC,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,OAAO;aACf,CAAC,CAAC;QACL,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,oCAAyB,EAAC,UAAU,EAAE,aAAa,EAAE;YAClE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,kBAAO,CAAC,MAAM,CAAC,eAAe,CAAC;SAC7C,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,kBAAO,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;QAED,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACrD,eAAe,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;QAEvC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,eAAe,CAAC,QAAQ,CAAC,GAAG,kBAAO,CAAC,MAAM,CAAC;gBACzC,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,OAAO;aACf,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,GAAG,IAAA,oCAAyB,EAAC,cAAc,EAAE,aAAa,EAAE;YACpE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,kBAAO,CAAC,MAAM,CAAC,eAAe,CAAC;SAC7C,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,kBAAO,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;IAEH,CAAC,EACD;QACE,+BAA+B;QAC/B,oCAAoC;KACrC,CACF,CAAC;AAEJ,CAAC;AAxED,wDAwEC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import 'colors';
3
+ export declare function coerceOpenApiClientSdkLibrary(tree: Tree, projectName: string): Promise<void>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coerceOpenApiClientSdkLibrary = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const workspace_utilities_1 = require("@rxap/workspace-utilities");
6
+ const js_1 = require("@nx/js");
7
+ const plugin_open_api_1 = require("@rxap/plugin-open-api");
8
+ require("colors");
9
+ function coerceOpenApiClientSdkLibrary(tree, projectName) {
10
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ const openApiProjectName = `open-api-${projectName}`;
12
+ if (!(0, workspace_utilities_1.HasProject)(tree, openApiProjectName)) {
13
+ console.log(`Generate open api client sdk library: ${openApiProjectName}`.blue);
14
+ yield (0, js_1.libraryGenerator)(tree, {
15
+ name: openApiProjectName,
16
+ directory: `open-api/${projectName}`,
17
+ importPath: openApiProjectName,
18
+ projectNameAndRootFormat: 'as-provided',
19
+ linter: 'none',
20
+ minimal: true,
21
+ unitTestRunner: 'none',
22
+ tags: 'open-api',
23
+ publishable: false,
24
+ bundler: 'none',
25
+ });
26
+ console.log('Initialize open api client sdk library'.blue);
27
+ yield (0, plugin_open_api_1.OpenApiLibraryInitGenerator)(tree, {
28
+ project: openApiProjectName
29
+ });
30
+ }
31
+ });
32
+ }
33
+ exports.coerceOpenApiClientSdkLibrary = coerceOpenApiClientSdkLibrary;
34
+ //# sourceMappingURL=coerce-open-api-client-sdk-library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerce-open-api-client-sdk-library.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/coerce-open-api-client-sdk-library.ts"],"names":[],"mappings":";;;;AACA,mEAAuD;AACvD,+BAA+D;AAC/D,2DAAoE;AACpE,kBAAgB;AAEhB,SAAsB,6BAA6B,CACjD,IAAU,EACV,WAAmB;;QAGnB,MAAM,kBAAkB,GAAG,YAAa,WAAY,EAAE,CAAC;QAEvD,IAAI,CAAC,IAAA,gCAAU,EAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,CAAC;YAE1C,OAAO,CAAC,GAAG,CAAC,yCAA0C,kBAAmB,EAAE,CAAC,IAAI,CAAC,CAAC;YAClF,MAAM,IAAA,qBAAiB,EAAC,IAAI,EAAE;gBAC5B,IAAI,EAAE,kBAAkB;gBACxB,SAAS,EAAE,YAAa,WAAY,EAAE;gBACtC,UAAU,EAAE,kBAAkB;gBAC9B,wBAAwB,EAAE,aAAa;gBACvC,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,IAAI;gBACb,cAAc,EAAE,MAAM;gBACtB,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE,MAAM;aAChB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,IAAI,CAAC,CAAC;YAC3D,MAAM,IAAA,6CAA2B,EAAC,IAAI,EAAE;gBACtC,OAAO,EAAE,kBAAkB;aAC5B,CAAC,CAAC;QAEL,CAAC;IAEH,CAAC;CAAA;AA9BD,sEA8BC"}