@rxap/plugin-angular 16.2.0-dev.9 → 16.2.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 (55) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/README.md +15 -1
  3. package/generators.json +10 -0
  4. package/package.json +27 -22
  5. package/src/generators/convert-to-buildable-library/generator.d.ts +4 -0
  6. package/src/generators/convert-to-buildable-library/generator.js +89 -0
  7. package/src/generators/convert-to-buildable-library/generator.js.map +1 -0
  8. package/src/generators/convert-to-buildable-library/schema.d.ts +3 -0
  9. package/src/generators/convert-to-buildable-library/schema.json +12 -0
  10. package/src/generators/init/generator.js +4 -0
  11. package/src/generators/init/generator.js.map +1 -1
  12. package/src/generators/init/schema.d.ts +1 -0
  13. package/src/generators/init/schema.json +4 -0
  14. package/src/generators/init-application/coerce-project.d.ts +4 -0
  15. package/src/generators/init-application/coerce-project.js +53 -0
  16. package/src/generators/init-application/coerce-project.js.map +1 -0
  17. package/src/generators/init-application/files/mfe-remote/Dockerfile +29 -0
  18. package/src/generators/init-application/files/mfe-remote/index.html.template +165 -0
  19. package/src/generators/init-application/files/root/favicon.ico +0 -0
  20. package/src/generators/init-application/files/root/styles.scss.template +3 -0
  21. package/src/generators/init-application/files/shared/ngsw-config.json +11 -1
  22. package/src/generators/init-application/files/styles/_fonts.scss +2 -0
  23. package/src/generators/init-application/generate-monolithic.js +2 -7
  24. package/src/generators/init-application/generate-monolithic.js.map +1 -1
  25. package/src/generators/init-application/generator.js +303 -72
  26. package/src/generators/init-application/generator.js.map +1 -1
  27. package/src/generators/init-application/schema.d.ts +11 -0
  28. package/src/generators/init-application/schema.json +49 -26
  29. package/src/generators/init-component/generator.d.ts +4 -0
  30. package/src/generators/init-component/generator.js +71 -0
  31. package/src/generators/init-component/generator.js.map +1 -0
  32. package/src/generators/init-component/index.d.ts +2 -0
  33. package/src/generators/init-component/index.js +7 -0
  34. package/src/generators/init-component/index.js.map +1 -0
  35. package/src/generators/init-component/schema.d.ts +25 -0
  36. package/src/generators/init-component/schema.json +141 -0
  37. package/src/generators/init-feature/generator.js +5 -1
  38. package/src/generators/init-feature/generator.js.map +1 -1
  39. package/src/generators/init-feature/schema.d.ts +2 -1
  40. package/src/generators/init-feature/schema.json +4 -0
  41. package/src/generators/init-feature-library/generator.d.ts +4 -0
  42. package/src/generators/init-feature-library/generator.js +12 -0
  43. package/src/generators/init-feature-library/generator.js.map +1 -0
  44. package/src/generators/init-feature-library/schema.d.ts +10 -0
  45. package/src/generators/init-feature-library/schema.json +222 -0
  46. package/src/generators/init-library/generator.js +67 -54
  47. package/src/generators/init-library/generator.js.map +1 -1
  48. package/src/generators/init-library/schema.d.ts +1 -1
  49. package/src/generators/init-library/schema.json +182 -150
  50. package/src/lib/coerce-test-setup.d.ts +2 -0
  51. package/src/lib/coerce-test-setup.js +40 -0
  52. package/src/lib/coerce-test-setup.js.map +1 -0
  53. package/src/generators/init-application/files/shared/assets/custom.svg +0 -1
  54. /package/src/generators/init-application/files/{monolithic → mfe-remote}/styles.scss.template +0 -0
  55. /package/src/generators/init-application/files/{monolithic → root}/index.html.template +0 -0
@@ -23,6 +23,10 @@
23
23
  "default": false,
24
24
  "description": "Whether to skip executing project specific initialization"
25
25
  },
26
+ "skipFormat": {
27
+ "type": "boolean",
28
+ "default": false
29
+ },
26
30
  "indexExport": {
27
31
  "type": "boolean",
28
32
  "default": true,
@@ -36,156 +40,184 @@
36
40
  "description": "Whether to create the library project if not exist"
37
41
  },
38
42
  {
39
- "directory": {
40
- "type": "string",
41
- "description": "A directory where the library is placed."
42
- },
43
- "projectNameAndRootFormat": {
44
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
45
- "type": "string",
46
- "enum": ["as-provided", "derived"]
47
- },
48
- "publishable": {
49
- "type": "boolean",
50
- "description": "Generate a publishable library."
51
- },
52
- "buildable": {
53
- "type": "boolean",
54
- "description": "Generate a buildable library."
55
- },
56
- "prefix": {
57
- "type": "string",
58
- "format": "html-selector",
59
- "description": "The prefix to apply to generated selectors.",
60
- "alias": "p"
61
- },
62
- "skipFormat": {
63
- "description": "Skip formatting files.",
64
- "type": "boolean"
65
- },
66
- "simpleName": {
67
- "description": "Don't include the directory in the name of the module or standalone component entry of the library.",
68
- "type": "boolean"
69
- },
70
- "addModuleSpec": {
71
- "description": "Add a module spec file.",
72
- "type": "boolean"
73
- },
74
- "skipPackageJson": {
75
- "type": "boolean",
76
- "description": "Do not add dependencies to `package.json`."
77
- },
78
- "skipTsConfig": {
79
- "type": "boolean",
80
- "description": "Do not update `tsconfig.json` for development experience."
81
- },
82
- "routing": {
83
- "type": "boolean",
84
- "description": "Add router configuration. See `lazy` for more information."
85
- },
86
- "lazy": {
87
- "type": "boolean",
88
- "description": "Add `RouterModule.forChild` when set to true, and a simple array of routes when set to false."
89
- },
90
- "parent": {
91
- "type": "string",
92
- "description": "Path to the parent route configuration using `loadChildren` or `children`, depending on what `lazy` is set to."
93
- },
94
- "tags": {
95
- "type": "string",
96
- "description": "Add tags to the library (used for linting)."
97
- },
98
- "unitTestRunner": {
99
- "type": "string",
100
- "enum": ["jest", "none"],
101
- "description": "Test runner to use for unit tests."
102
- },
103
- "importPath": {
104
- "type": "string",
105
- "description": "The library name used to import it, like `@myorg/my-awesome-lib`. Must be a valid npm name."
106
- },
107
- "strict": {
108
- "type": "boolean",
109
- "description": "Create a library with stricter type checking and build optimization options."
110
- },
111
- "linter": {
112
- "description": "The tool to use for running lint checks.",
113
- "type": "string",
114
- "enum": ["eslint", "none"]
115
- },
116
- "standaloneConfig": {
117
- "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
118
- "type": "boolean"
119
- },
120
- "compilationMode": {
121
- "description": "Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.",
122
- "type": "string",
123
- "enum": ["full", "partial"]
124
- },
125
- "setParserOptionsProject": {
126
- "type": "boolean",
127
- "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons."
128
- },
129
- "addTailwind": {
130
- "type": "boolean",
131
- "description": "Whether to configure Tailwind CSS for the application. It can only be used with buildable and publishable libraries. Non-buildable libraries will use the application's Tailwind configuration."
132
- },
133
- "skipModule": {
134
- "type": "boolean",
135
- "description": "Whether to skip the creation of a default module when generating the library."
136
- },
137
- "standalone": {
138
- "type": "boolean",
139
- "description": "Generate a library that uses a standalone component instead of a module as the entry point. _Note: This is only supported in Angular versions >= 14.1.0_"
140
- },
141
- "displayBlock": {
142
- "description": "Specifies if the component generated style will contain `:host { display: block; }`. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
143
- "type": "boolean",
144
- "alias": "b"
145
- },
146
- "inlineStyle": {
147
- "description": "Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
148
- "type": "boolean",
149
- "alias": "s"
150
- },
151
- "inlineTemplate": {
152
- "description": "Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
153
- "type": "boolean",
154
- "alias": "t"
155
- },
156
- "viewEncapsulation": {
157
- "description": "The view encapsulation strategy to use in the new component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
158
- "enum": ["Emulated", "None", "ShadowDom"],
159
- "type": "string",
160
- "alias": "v"
161
- },
162
- "changeDetection": {
163
- "description": "The change detection strategy to use in the new component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
164
- "enum": ["Default", "OnPush"],
165
- "type": "string",
166
- "alias": "c"
167
- },
168
- "style": {
169
- "description": "The file extension or preprocessor to use for style files, or `none` to skip generating the style file. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
170
- "type": "string",
171
- "enum": ["css", "scss", "sass", "less", "none"]
172
- },
173
- "skipTests": {
174
- "type": "boolean",
175
- "description": "Do not create `spec.ts` test files for the new component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
176
- },
177
- "selector": {
178
- "type": "string",
179
- "format": "html-selector",
180
- "description": "The HTML selector to use for this component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
181
- },
182
- "skipSelector": {
183
- "type": "boolean",
184
- "description": "Specifies if the component should have a selector or not. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
185
- },
186
- "flat": {
187
- "type": "boolean",
188
- "description": "Ensure the generated standalone component is not placed in a subdirectory. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
43
+ "type": "object",
44
+ "properties": {
45
+ "directory": {
46
+ "type": "string",
47
+ "description": "A directory where the library is placed."
48
+ },
49
+ "projectNameAndRootFormat": {
50
+ "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
51
+ "type": "string",
52
+ "enum": [
53
+ "as-provided",
54
+ "derived"
55
+ ]
56
+ },
57
+ "publishable": {
58
+ "type": "boolean",
59
+ "description": "Generate a publishable library."
60
+ },
61
+ "buildable": {
62
+ "type": "boolean",
63
+ "description": "Generate a buildable library."
64
+ },
65
+ "prefix": {
66
+ "type": "string",
67
+ "format": "html-selector",
68
+ "description": "The prefix to apply to generated selectors.",
69
+ "alias": "p"
70
+ },
71
+ "skipFormat": {
72
+ "description": "Skip formatting files.",
73
+ "type": "boolean"
74
+ },
75
+ "simpleName": {
76
+ "description": "Don't include the directory in the name of the module or standalone component entry of the library.",
77
+ "type": "boolean"
78
+ },
79
+ "addModuleSpec": {
80
+ "description": "Add a module spec file.",
81
+ "type": "boolean"
82
+ },
83
+ "skipPackageJson": {
84
+ "type": "boolean",
85
+ "description": "Do not add dependencies to `package.json`."
86
+ },
87
+ "skipTsConfig": {
88
+ "type": "boolean",
89
+ "description": "Do not update `tsconfig.json` for development experience."
90
+ },
91
+ "routing": {
92
+ "type": "boolean",
93
+ "description": "Add router configuration. See `lazy` for more information."
94
+ },
95
+ "lazy": {
96
+ "type": "boolean",
97
+ "description": "Add `RouterModule.forChild` when set to true, and a simple array of routes when set to false."
98
+ },
99
+ "parent": {
100
+ "type": "string",
101
+ "description": "Path to the parent route configuration using `loadChildren` or `children`, depending on what `lazy` is set to."
102
+ },
103
+ "tags": {
104
+ "type": "string",
105
+ "description": "Add tags to the library (used for linting)."
106
+ },
107
+ "unitTestRunner": {
108
+ "type": "string",
109
+ "enum": [
110
+ "jest",
111
+ "none"
112
+ ],
113
+ "description": "Test runner to use for unit tests."
114
+ },
115
+ "importPath": {
116
+ "type": "string",
117
+ "description": "The library name used to import it, like `@myorg/my-awesome-lib`. Must be a valid npm name."
118
+ },
119
+ "strict": {
120
+ "type": "boolean",
121
+ "description": "Create a library with stricter type checking and build optimization options."
122
+ },
123
+ "linter": {
124
+ "description": "The tool to use for running lint checks.",
125
+ "type": "string",
126
+ "enum": [
127
+ "eslint",
128
+ "none"
129
+ ]
130
+ },
131
+ "standaloneConfig": {
132
+ "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
133
+ "type": "boolean"
134
+ },
135
+ "compilationMode": {
136
+ "description": "Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.",
137
+ "type": "string",
138
+ "enum": [
139
+ "full",
140
+ "partial"
141
+ ]
142
+ },
143
+ "setParserOptionsProject": {
144
+ "type": "boolean",
145
+ "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons."
146
+ },
147
+ "addTailwind": {
148
+ "type": "boolean",
149
+ "description": "Whether to configure Tailwind CSS for the application. It can only be used with buildable and publishable libraries. Non-buildable libraries will use the application's Tailwind configuration."
150
+ },
151
+ "skipModule": {
152
+ "type": "boolean",
153
+ "description": "Whether to skip the creation of a default module when generating the library."
154
+ },
155
+ "standalone": {
156
+ "type": "boolean",
157
+ "description": "Generate a library that uses a standalone component instead of a module as the entry point. _Note: This is only supported in Angular versions >= 14.1.0_"
158
+ },
159
+ "displayBlock": {
160
+ "description": "Specifies if the component generated style will contain `:host { display: block; }`. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
161
+ "type": "boolean",
162
+ "alias": "b"
163
+ },
164
+ "inlineStyle": {
165
+ "description": "Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
166
+ "type": "boolean",
167
+ "alias": "s"
168
+ },
169
+ "inlineTemplate": {
170
+ "description": "Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
171
+ "type": "boolean",
172
+ "alias": "t"
173
+ },
174
+ "viewEncapsulation": {
175
+ "description": "The view encapsulation strategy to use in the new component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
176
+ "enum": [
177
+ "Emulated",
178
+ "None",
179
+ "ShadowDom"
180
+ ],
181
+ "type": "string",
182
+ "alias": "v"
183
+ },
184
+ "changeDetection": {
185
+ "description": "The change detection strategy to use in the new component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
186
+ "enum": [
187
+ "Default",
188
+ "OnPush"
189
+ ],
190
+ "type": "string",
191
+ "alias": "c"
192
+ },
193
+ "style": {
194
+ "description": "The file extension or preprocessor to use for style files, or `none` to skip generating the style file. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_",
195
+ "type": "string",
196
+ "enum": [
197
+ "css",
198
+ "scss",
199
+ "sass",
200
+ "less",
201
+ "none"
202
+ ]
203
+ },
204
+ "skipTests": {
205
+ "type": "boolean",
206
+ "description": "Do not create `spec.ts` test files for the new component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
207
+ },
208
+ "selector": {
209
+ "type": "string",
210
+ "format": "html-selector",
211
+ "description": "The HTML selector to use for this component. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
212
+ },
213
+ "skipSelector": {
214
+ "type": "boolean",
215
+ "description": "Specifies if the component should have a selector or not. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
216
+ },
217
+ "flat": {
218
+ "type": "boolean",
219
+ "description": "Ensure the generated standalone component is not placed in a subdirectory. Disclaimer: This option is only valid when `--standalone` is set to `true`. _Note: This is only supported in Angular versions >= 14.1.0_"
220
+ }
189
221
  }
190
222
  }
191
223
  ]
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function coerceTestSetup(tree: Tree, projectName: string): void;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coerceTestSetup = void 0;
4
+ const workspace_utilities_1 = require("@rxap/workspace-utilities");
5
+ function coerceTestSetup(tree, projectName) {
6
+ const projectSourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(tree, projectName);
7
+ const testSetupPath = `${projectSourceRoot}/test-setup.ts`;
8
+ if (!tree.exists(testSetupPath)) {
9
+ tree.write(testSetupPath, `// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
10
+ globalThis.ngJest = {
11
+ testEnvironmentOptions: {
12
+ errorOnUnknownElements: true,
13
+ errorOnUnknownProperties: true,
14
+ },
15
+ };
16
+ import 'jest-preset-angular/setup-jest';
17
+ `);
18
+ }
19
+ let content = tree.read(testSetupPath, 'utf-8');
20
+ if (!content.match(/import\s+\{.+}\s+from\s+'util';/)) {
21
+ content += `
22
+ import { TextDecoder, TextEncoder } from 'util';
23
+ global.TextEncoder ??= TextEncoder as any;
24
+ global.TextDecoder ??= TextDecoder as any;
25
+ `;
26
+ }
27
+ if (!content.match(/import\s+'@angular\/localize\/init';/)) {
28
+ content += `
29
+ import '@angular/localize/init';
30
+ jest.spyOn(global as any, '$localize').mockImplementation((...args: any[]) => {
31
+ // This template tag function just returns the first argument with no transformations.
32
+ // Change this to fit your unit test needs.
33
+ return args[0];
34
+ });
35
+ `;
36
+ }
37
+ tree.write(testSetupPath, content);
38
+ }
39
+ exports.coerceTestSetup = coerceTestSetup;
40
+ //# sourceMappingURL=coerce-test-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerce-test-setup.js","sourceRoot":"","sources":["../../../../../../packages/plugin/angular/src/lib/coerce-test-setup.ts"],"names":[],"mappings":";;;AACA,mEAAiE;AAEjE,SAAgB,eAAe,CAAC,IAAU,EAAE,WAAmB;IAC7D,MAAM,iBAAiB,GAAG,IAAA,0CAAoB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAElE,MAAM,aAAa,GAAG,GAAG,iBAAiB,gBAAgB,CAAC;IAC3D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;QAC/B,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;;;;;;;;CAQ7B,CAAC,CAAC;KACA;IAED,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAE,CAAC;IACjD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,EAAE;QACrD,OAAO,IAAI;;;;CAId,CAAC;KACC;IACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,EAAE;QAC1D,OAAO,IAAI;;;;;;;CAOd,CAAC;KACC;IAED,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAErC,CAAC;AArCD,0CAqCC"}