@rxap/plugin-angular 20.0.1-dev.1 → 20.0.1-dev.11
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/.eslintignore +6 -0
- package/.eslintrc.json +44 -0
- package/CHANGELOG.md +43 -0
- package/LICENSE +621 -0
- package/README.md.handlebars +115 -0
- package/jest.config.ts +11 -0
- package/package.json +11 -24
- package/project.json +68 -0
- package/schematics.yaml +6 -0
- package/src/application.ts +124 -0
- package/src/executors/check-ng-package/executor.ts +33 -0
- package/src/executors/config/executor.ts +74 -0
- package/src/executors/i18n/executor.ts +198 -0
- package/src/executors/tailwind/executor.ts +34 -0
- package/src/generators/convert-to-buildable-library/generator.ts +110 -0
- package/src/generators/fix-schematic/generator.ts +103 -0
- package/src/generators/fix-schematic/index.ts +5 -0
- package/src/generators/init/coerce-nx-json.ts +72 -0
- package/src/generators/init/generator.ts +28 -0
- package/src/generators/init/index.ts +5 -0
- package/src/generators/init/init-workspace.ts +84 -0
- package/src/generators/init-application/assert-main-statements.ts +74 -0
- package/src/generators/init-application/cleanup.ts +127 -0
- package/src/generators/init-application/coerce-app-config.ts +147 -0
- package/src/generators/init-application/coerce-environment-files.ts +105 -0
- package/src/generators/init-application/coerce-localazy-config-file.ts +26 -0
- package/src/generators/init-application/coerce-project.ts +128 -0
- package/src/generators/init-application/generate-authentication.ts +122 -0
- package/src/generators/init-application/generate-monolithic.spec.ts +45 -0
- package/src/generators/init-application/generate-monolithic.ts +57 -0
- package/src/generators/init-application/generator.ts +356 -0
- package/src/generators/init-application/index.ts +5 -0
- package/src/generators/init-application/link-mfe-remote-with-host.ts +60 -0
- package/src/generators/init-application/project-i18n-configuration.ts +4 -0
- package/src/generators/init-application/update-git-ignore.ts +22 -0
- package/src/generators/init-application/update-main-file.ts +118 -0
- package/src/generators/init-application/update-project-targets.ts +229 -0
- package/src/generators/init-application/update-tags.ts +30 -0
- package/src/generators/init-application/update-target-defaults.ts +43 -0
- package/src/generators/init-application/update-ts-config.ts +31 -0
- package/src/generators/init-component/generator.ts +147 -0
- package/src/generators/init-component/index.ts +5 -0
- package/src/generators/init-feature/generator.ts +77 -0
- package/src/generators/init-feature/index.ts +5 -0
- package/src/generators/init-feature-library/generator.ts +82 -0
- package/src/generators/init-feature-library/index.ts +5 -0
- package/src/generators/init-feature-library/init-project.ts +53 -0
- package/src/generators/init-feature-library/init-workspace.ts +10 -0
- package/src/generators/init-library/check-if-secondary-entrypoint-include-in-the-ts-config.ts +46 -0
- package/src/generators/init-library/cleanup.ts +22 -0
- package/src/generators/init-library/coerce-projects.ts +118 -0
- package/src/generators/init-library/coerce-tailwind-theme-scss.ts +27 -0
- package/src/generators/init-library/extend-angular-specific-eslint.ts +37 -0
- package/src/generators/init-library/generator.ts +87 -0
- package/src/generators/init-library/has-index-scss.ts +14 -0
- package/src/generators/init-library/has-tailwind-config.ts +9 -0
- package/src/generators/init-library/index.ts +5 -0
- package/src/generators/init-library/init-project.ts +46 -0
- package/src/generators/init-library/init-workspace.ts +26 -0
- package/src/generators/init-library/is-ng-packagr-project.ts +9 -0
- package/src/generators/init-library/ng-package-json.ts +23 -0
- package/src/generators/init-library/set-general-target-defaults.ts +36 -0
- package/src/generators/init-library/update-package-json.ts +26 -0
- package/src/generators/init-library/update-project-ng-package-configuration.ts +51 -0
- package/src/generators/init-library/update-ts-config.ts +24 -0
- package/src/generators/schematic/generator.ts +179 -0
- package/src/generators/schematic/index.ts +5 -0
- package/src/i18n.ts +130 -0
- package/src/lib/angular-version.ts +1 -0
- package/src/lib/coerce-cypress-component-testing.ts +113 -0
- package/src/lib/coerce-test-setup.ts +60 -0
- package/src/library.ts +153 -0
- package/src/migrations/update-19-0-0/add-m2-prefix-to-material-scss-functions.ts +32 -0
- package/src/migrations/update-19-0-0/migration.ts +283 -0
- package/src/test-setup.ts +24 -0
- package/tsconfig.json +20 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +15 -0
- package/tsconfig.typedoc.json +5 -0
- package/src/application.d.ts +0 -6
- package/src/application.js +0 -77
- package/src/application.js.map +0 -1
- package/src/executors/check-ng-package/executor.d.ts +0 -5
- package/src/executors/check-ng-package/executor.js +0 -30
- package/src/executors/check-ng-package/executor.js.map +0 -1
- package/src/executors/config/executor.d.ts +0 -10
- package/src/executors/config/executor.js +0 -65
- package/src/executors/config/executor.js.map +0 -1
- package/src/executors/i18n/executor.d.ts +0 -9
- package/src/executors/i18n/executor.js +0 -158
- package/src/executors/i18n/executor.js.map +0 -1
- package/src/executors/tailwind/executor.d.ts +0 -5
- package/src/executors/tailwind/executor.js +0 -31
- package/src/executors/tailwind/executor.js.map +0 -1
- package/src/generators/convert-to-buildable-library/generator.d.ts +0 -4
- package/src/generators/convert-to-buildable-library/generator.js +0 -88
- package/src/generators/convert-to-buildable-library/generator.js.map +0 -1
- package/src/generators/fix-schematic/generator.d.ts +0 -4
- package/src/generators/fix-schematic/generator.js +0 -72
- package/src/generators/fix-schematic/generator.js.map +0 -1
- package/src/generators/fix-schematic/index.d.ts +0 -2
- package/src/generators/fix-schematic/index.js +0 -7
- package/src/generators/fix-schematic/index.js.map +0 -1
- package/src/generators/init/coerce-nx-json.d.ts +0 -3
- package/src/generators/init/coerce-nx-json.js +0 -74
- package/src/generators/init/coerce-nx-json.js.map +0 -1
- package/src/generators/init/generator.d.ts +0 -4
- package/src/generators/init/generator.js +0 -19
- package/src/generators/init/generator.js.map +0 -1
- package/src/generators/init/index.d.ts +0 -2
- package/src/generators/init/index.js +0 -7
- package/src/generators/init/index.js.map +0 -1
- package/src/generators/init/init-workspace.d.ts +0 -3
- package/src/generators/init/init-workspace.js +0 -73
- package/src/generators/init/init-workspace.js.map +0 -1
- package/src/generators/init-application/assert-main-statements.d.ts +0 -4
- package/src/generators/init-application/assert-main-statements.js +0 -76
- package/src/generators/init-application/assert-main-statements.js.map +0 -1
- package/src/generators/init-application/cleanup.d.ts +0 -3
- package/src/generators/init-application/cleanup.js +0 -108
- package/src/generators/init-application/cleanup.js.map +0 -1
- package/src/generators/init-application/coerce-app-config.d.ts +0 -3
- package/src/generators/init-application/coerce-app-config.js +0 -143
- package/src/generators/init-application/coerce-app-config.js.map +0 -1
- package/src/generators/init-application/coerce-environment-files.d.ts +0 -5
- package/src/generators/init-application/coerce-environment-files.js +0 -75
- package/src/generators/init-application/coerce-environment-files.js.map +0 -1
- package/src/generators/init-application/coerce-localazy-config-file.d.ts +0 -2
- package/src/generators/init-application/coerce-localazy-config-file.js +0 -25
- package/src/generators/init-application/coerce-localazy-config-file.js.map +0 -1
- package/src/generators/init-application/coerce-project.d.ts +0 -4
- package/src/generators/init-application/coerce-project.js +0 -56
- package/src/generators/init-application/coerce-project.js.map +0 -1
- package/src/generators/init-application/generate-authentication.d.ts +0 -3
- package/src/generators/init-application/generate-authentication.js +0 -97
- package/src/generators/init-application/generate-authentication.js.map +0 -1
- package/src/generators/init-application/generate-monolithic.d.ts +0 -3
- package/src/generators/init-application/generate-monolithic.js +0 -45
- package/src/generators/init-application/generate-monolithic.js.map +0 -1
- package/src/generators/init-application/generator.d.ts +0 -4
- package/src/generators/init-application/generator.js +0 -257
- package/src/generators/init-application/generator.js.map +0 -1
- package/src/generators/init-application/index.d.ts +0 -2
- package/src/generators/init-application/index.js +0 -7
- package/src/generators/init-application/index.js.map +0 -1
- package/src/generators/init-application/link-mfe-remote-with-host.d.ts +0 -3
- package/src/generators/init-application/link-mfe-remote-with-host.js +0 -54
- package/src/generators/init-application/link-mfe-remote-with-host.js.map +0 -1
- package/src/generators/init-application/project-i18n-configuration.d.ts +0 -7
- package/src/generators/init-application/project-i18n-configuration.js +0 -3
- package/src/generators/init-application/project-i18n-configuration.js.map +0 -1
- package/src/generators/init-application/update-git-ignore.d.ts +0 -3
- package/src/generators/init-application/update-git-ignore.js +0 -17
- package/src/generators/init-application/update-git-ignore.js.map +0 -1
- package/src/generators/init-application/update-main-file.d.ts +0 -3
- package/src/generators/init-application/update-main-file.js +0 -106
- package/src/generators/init-application/update-main-file.js.map +0 -1
- package/src/generators/init-application/update-project-targets.d.ts +0 -6
- package/src/generators/init-application/update-project-targets.js +0 -210
- package/src/generators/init-application/update-project-targets.js.map +0 -1
- package/src/generators/init-application/update-tags.d.ts +0 -3
- package/src/generators/init-application/update-tags.js +0 -25
- package/src/generators/init-application/update-tags.js.map +0 -1
- package/src/generators/init-application/update-target-defaults.d.ts +0 -3
- package/src/generators/init-application/update-target-defaults.js +0 -30
- package/src/generators/init-application/update-target-defaults.js.map +0 -1
- package/src/generators/init-application/update-ts-config.d.ts +0 -2
- package/src/generators/init-application/update-ts-config.js +0 -30
- package/src/generators/init-application/update-ts-config.js.map +0 -1
- package/src/generators/init-component/generator.d.ts +0 -5
- package/src/generators/init-component/generator.js +0 -106
- package/src/generators/init-component/generator.js.map +0 -1
- package/src/generators/init-component/index.d.ts +0 -2
- package/src/generators/init-component/index.js +0 -7
- package/src/generators/init-component/index.js.map +0 -1
- package/src/generators/init-feature/generator.d.ts +0 -4
- package/src/generators/init-feature/generator.js +0 -53
- package/src/generators/init-feature/generator.js.map +0 -1
- package/src/generators/init-feature/index.d.ts +0 -2
- package/src/generators/init-feature/index.js +0 -7
- package/src/generators/init-feature/index.js.map +0 -1
- package/src/generators/init-feature-library/generator.d.ts +0 -4
- package/src/generators/init-feature-library/generator.js +0 -51
- package/src/generators/init-feature-library/generator.js.map +0 -1
- package/src/generators/init-feature-library/index.d.ts +0 -2
- package/src/generators/init-feature-library/index.js +0 -7
- package/src/generators/init-feature-library/index.js.map +0 -1
- package/src/generators/init-feature-library/init-project.d.ts +0 -3
- package/src/generators/init-feature-library/init-project.js +0 -41
- package/src/generators/init-feature-library/init-project.js.map +0 -1
- package/src/generators/init-feature-library/init-workspace.d.ts +0 -3
- package/src/generators/init-feature-library/init-workspace.js +0 -12
- package/src/generators/init-feature-library/init-workspace.js.map +0 -1
- package/src/generators/init-library/check-if-secondary-entrypoint-include-in-the-ts-config.d.ts +0 -2
- package/src/generators/init-library/check-if-secondary-entrypoint-include-in-the-ts-config.js +0 -39
- package/src/generators/init-library/check-if-secondary-entrypoint-include-in-the-ts-config.js.map +0 -1
- package/src/generators/init-library/cleanup.d.ts +0 -2
- package/src/generators/init-library/cleanup.js +0 -16
- package/src/generators/init-library/cleanup.js.map +0 -1
- package/src/generators/init-library/coerce-projects.d.ts +0 -3
- package/src/generators/init-library/coerce-projects.js +0 -92
- package/src/generators/init-library/coerce-projects.js.map +0 -1
- package/src/generators/init-library/coerce-tailwind-theme-scss.d.ts +0 -2
- package/src/generators/init-library/coerce-tailwind-theme-scss.js +0 -22
- package/src/generators/init-library/coerce-tailwind-theme-scss.js.map +0 -1
- package/src/generators/init-library/extend-angular-specific-eslint.d.ts +0 -2
- package/src/generators/init-library/extend-angular-specific-eslint.js +0 -25
- package/src/generators/init-library/extend-angular-specific-eslint.js.map +0 -1
- package/src/generators/init-library/generator.d.ts +0 -4
- package/src/generators/init-library/generator.js +0 -56
- package/src/generators/init-library/generator.js.map +0 -1
- package/src/generators/init-library/has-index-scss.d.ts +0 -2
- package/src/generators/init-library/has-index-scss.js +0 -11
- package/src/generators/init-library/has-index-scss.js.map +0 -1
- package/src/generators/init-library/has-tailwind-config.d.ts +0 -2
- package/src/generators/init-library/has-tailwind-config.js +0 -8
- package/src/generators/init-library/has-tailwind-config.js.map +0 -1
- package/src/generators/init-library/index.d.ts +0 -2
- package/src/generators/init-library/index.js +0 -7
- package/src/generators/init-library/index.js.map +0 -1
- package/src/generators/init-library/init-project.d.ts +0 -3
- package/src/generators/init-library/init-project.js +0 -37
- package/src/generators/init-library/init-project.js.map +0 -1
- package/src/generators/init-library/init-workspace.d.ts +0 -3
- package/src/generators/init-library/init-workspace.js +0 -21
- package/src/generators/init-library/init-workspace.js.map +0 -1
- package/src/generators/init-library/is-ng-packagr-project.d.ts +0 -2
- package/src/generators/init-library/is-ng-packagr-project.js +0 -8
- package/src/generators/init-library/is-ng-packagr-project.js.map +0 -1
- package/src/generators/init-library/ng-package-json.d.ts +0 -8
- package/src/generators/init-library/ng-package-json.js +0 -16
- package/src/generators/init-library/ng-package-json.js.map +0 -1
- package/src/generators/init-library/set-general-target-defaults.d.ts +0 -2
- package/src/generators/init-library/set-general-target-defaults.js +0 -27
- package/src/generators/init-library/set-general-target-defaults.js.map +0 -1
- package/src/generators/init-library/update-package-json.d.ts +0 -2
- package/src/generators/init-library/update-package-json.js +0 -17
- package/src/generators/init-library/update-package-json.js.map +0 -1
- package/src/generators/init-library/update-project-ng-package-configuration.d.ts +0 -2
- package/src/generators/init-library/update-project-ng-package-configuration.js +0 -37
- package/src/generators/init-library/update-project-ng-package-configuration.js.map +0 -1
- package/src/generators/init-library/update-ts-config.d.ts +0 -2
- package/src/generators/init-library/update-ts-config.js +0 -22
- package/src/generators/init-library/update-ts-config.js.map +0 -1
- package/src/generators/schematic/generator.d.ts +0 -6
- package/src/generators/schematic/generator.js +0 -127
- package/src/generators/schematic/generator.js.map +0 -1
- package/src/generators/schematic/index.d.ts +0 -2
- package/src/generators/schematic/index.js +0 -7
- package/src/generators/schematic/index.js.map +0 -1
- package/src/i18n.d.ts +0 -6
- package/src/i18n.js +0 -83
- package/src/i18n.js.map +0 -1
- package/src/index.js +0 -10
- package/src/index.js.map +0 -1
- package/src/lib/angular-version.d.ts +0 -1
- package/src/lib/angular-version.js +0 -5
- package/src/lib/angular-version.js.map +0 -1
- package/src/lib/coerce-cypress-component-testing.d.ts +0 -2
- package/src/lib/coerce-cypress-component-testing.js +0 -78
- package/src/lib/coerce-cypress-component-testing.js.map +0 -1
- package/src/lib/coerce-test-setup.d.ts +0 -2
- package/src/lib/coerce-test-setup.js +0 -47
- package/src/lib/coerce-test-setup.js.map +0 -1
- package/src/library.d.ts +0 -6
- package/src/library.js +0 -100
- package/src/library.js.map +0 -1
- package/src/migrations/update-19-0-0/add-m2-prefix-to-material-scss-functions.d.ts +0 -2
- package/src/migrations/update-19-0-0/add-m2-prefix-to-material-scss-functions.js +0 -29
- package/src/migrations/update-19-0-0/add-m2-prefix-to-material-scss-functions.js.map +0 -1
- package/src/migrations/update-19-0-0/migration.d.ts +0 -9
- package/src/migrations/update-19-0-0/migration.js +0 -220
- package/src/migrations/update-19-0-0/migration.js.map +0 -1
- /package/src/{index.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# {{packageJson.name}}
|
|
2
|
+
{{#if packageJson.description ~}}
|
|
3
|
+
> {{packageJson.description}}
|
|
4
|
+
{{/if}}
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/{{packageJson.name}})
|
|
7
|
+
[](https://commitizen.github.io/cz-cli/)
|
|
8
|
+
[](https://github.com/prettier/prettier)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
- [Installation](#installation)
|
|
14
|
+
{{#if getStartedContent ~}}
|
|
15
|
+
- [Get started](#get-started)
|
|
16
|
+
{{/if}}
|
|
17
|
+
{{#if guidesContent ~}}
|
|
18
|
+
- [Guides](#guides)
|
|
19
|
+
{{/if}}
|
|
20
|
+
{{#if hasGenerators ~}}
|
|
21
|
+
- [Generators](#generators)
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#if hasExecutors ~}}
|
|
24
|
+
- [Executors](#executors)
|
|
25
|
+
{{/if}}
|
|
26
|
+
|
|
27
|
+
# Installation
|
|
28
|
+
|
|
29
|
+
**Add the package to your workspace:**
|
|
30
|
+
```bash
|
|
31
|
+
yarn add {{packageJson.name}}
|
|
32
|
+
```
|
|
33
|
+
{{#if hasPeerDependencies ~}}
|
|
34
|
+
|
|
35
|
+
**Install peer dependencies:**
|
|
36
|
+
```bash
|
|
37
|
+
yarn add {{#each peerDependencyList}}{{this.name}}@{{this.version}} {{/each}}
|
|
38
|
+
```
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#if hasInitGenerator ~}}
|
|
41
|
+
|
|
42
|
+
**Execute the init generator:**
|
|
43
|
+
```bash
|
|
44
|
+
yarn nx g {{packageJson.name}}:init
|
|
45
|
+
```
|
|
46
|
+
{{/if}}
|
|
47
|
+
{{#if hasConfigGenerator ~}}
|
|
48
|
+
|
|
49
|
+
**Execute the config generator to use the package with a project:**
|
|
50
|
+
```bash
|
|
51
|
+
yarn nx g {{packageJson.name}}:config [project]
|
|
52
|
+
```
|
|
53
|
+
{{/if}}
|
|
54
|
+
{{#if getStartedContent ~}}
|
|
55
|
+
|
|
56
|
+
# Get started
|
|
57
|
+
|
|
58
|
+
{{{getStartedContent}}}
|
|
59
|
+
{{/if}}
|
|
60
|
+
{{#if guidesContent ~}}
|
|
61
|
+
|
|
62
|
+
# Guides
|
|
63
|
+
|
|
64
|
+
{{{guidesContent}}}
|
|
65
|
+
{{/if}}
|
|
66
|
+
{{#if hasGenerators ~}}
|
|
67
|
+
|
|
68
|
+
# Generators
|
|
69
|
+
{{#each generatorList}}
|
|
70
|
+
|
|
71
|
+
## {{this.name}}
|
|
72
|
+
> {{this.description}}
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
yarn nx g {{@root.packageJson.name}}:{{this.name}}
|
|
76
|
+
```
|
|
77
|
+
{{#hasProperties this.schema.properties}}
|
|
78
|
+
|
|
79
|
+
Option | Type | Default | Description
|
|
80
|
+
--- | --- | --- | ---
|
|
81
|
+
{{#each this.schema.properties}}
|
|
82
|
+
{{@key}} | {{this.type}} | {{this.default}} | {{this.description}}
|
|
83
|
+
{{/each}}
|
|
84
|
+
{{/hasProperties}}
|
|
85
|
+
{{/each}}
|
|
86
|
+
{{/if}}
|
|
87
|
+
{{#if hasExecutors ~}}
|
|
88
|
+
|
|
89
|
+
# Executors
|
|
90
|
+
{{#each executorsList}}
|
|
91
|
+
|
|
92
|
+
## {{this.name}}
|
|
93
|
+
> {{this.description}}
|
|
94
|
+
|
|
95
|
+
**project.json**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"targets": {
|
|
99
|
+
"{{this.name}}": {
|
|
100
|
+
"executor": "{{@root.packageJson.name}}:{{this.name}}"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
{{#hasProperties this.schema.properties}}
|
|
106
|
+
|
|
107
|
+
Option | Type | Default | Description
|
|
108
|
+
--- | --- | --- | ---
|
|
109
|
+
{{#each this.schema.properties}}
|
|
110
|
+
{{@key}} | {{this.type}} | {{this.default}} | {{this.description}}
|
|
111
|
+
{{/each}}
|
|
112
|
+
{{/hasProperties}}
|
|
113
|
+
{{/each}}
|
|
114
|
+
|
|
115
|
+
{{/if}}
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
displayName: 'plugin-angular',
|
|
4
|
+
preset: '../../../jest.preset.js',
|
|
5
|
+
setupFilesAfterEnv: [ '<rootDir>/src/test-setup.ts' ],
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.[tj]s$': [ 'ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' } ],
|
|
8
|
+
},
|
|
9
|
+
moduleFileExtensions: [ 'ts', 'js', 'html' ],
|
|
10
|
+
coverageDirectory: '../../../coverage/packages/plugin/angular',
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "20.0.1-dev.
|
|
2
|
+
"version": "20.0.1-dev.11",
|
|
3
3
|
"name": "@rxap/plugin-angular",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@nx/angular": "20.
|
|
7
|
-
"@nx/devkit": "20.
|
|
8
|
-
"@rxap/plugin-application": "^20.0.1-dev.
|
|
9
|
-
"@rxap/plugin-library": "^20.0
|
|
10
|
-
"@rxap/plugin-utilities": "^20.0.1-dev.
|
|
11
|
-
"@rxap/ts-morph": "^1.5.3-dev.
|
|
12
|
-
"@rxap/utilities": "^16.4.2-dev.
|
|
13
|
-
"@rxap/workspace-ts-morph": "^19.1.9-dev.
|
|
14
|
-
"@rxap/workspace-utilities": "^19.6.1-dev.
|
|
6
|
+
"@nx/angular": "20.4.0",
|
|
7
|
+
"@nx/devkit": "20.4.0",
|
|
8
|
+
"@rxap/plugin-application": "^20.0.1-dev.6",
|
|
9
|
+
"@rxap/plugin-library": "^20.1.0-dev.5",
|
|
10
|
+
"@rxap/plugin-utilities": "^20.0.1-dev.5",
|
|
11
|
+
"@rxap/ts-morph": "^1.5.3-dev.3",
|
|
12
|
+
"@rxap/utilities": "^16.4.2-dev.2",
|
|
13
|
+
"@rxap/workspace-ts-morph": "^19.1.9-dev.6",
|
|
14
|
+
"@rxap/workspace-utilities": "^19.6.1-dev.5",
|
|
15
15
|
"colors": "1.4.0",
|
|
16
16
|
"handlebars": "4.7.8",
|
|
17
17
|
"semver": "7.5.3",
|
|
@@ -54,18 +54,5 @@
|
|
|
54
54
|
"directory": "packages/plugin/angular"
|
|
55
55
|
},
|
|
56
56
|
"schematics": "./generators.json",
|
|
57
|
-
"type": "commonjs"
|
|
58
|
-
"gitHead": "af3f3615668e796c28bf20b9bc94b929e7a1e9b5",
|
|
59
|
-
"exports": {
|
|
60
|
-
"./package.json": "./package.json",
|
|
61
|
-
".": {
|
|
62
|
-
"types": "./src/index.d.ts",
|
|
63
|
-
"default": "./src/index.js"
|
|
64
|
-
},
|
|
65
|
-
"./library": "./src/library.js",
|
|
66
|
-
"./application": "./src/application.js",
|
|
67
|
-
"./i18n": "./src/i18n.js"
|
|
68
|
-
},
|
|
69
|
-
"types": "./src/index.d.ts",
|
|
70
|
-
"main": "./src/index.js"
|
|
57
|
+
"type": "commonjs"
|
|
71
58
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plugin-angular",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/plugin/angular/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": ["plugin", "nx", "nx-plugin", "packages"],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/js:tsc",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"options": {
|
|
12
|
+
"outputPath": "dist/packages/plugin/angular",
|
|
13
|
+
"main": "packages/plugin/angular/src/index.ts",
|
|
14
|
+
"tsConfig": "packages/plugin/angular/tsconfig.lib.json",
|
|
15
|
+
"generateExportsField": true,
|
|
16
|
+
"additionalEntryPoints": [
|
|
17
|
+
"packages/plugin/angular/src/library.ts",
|
|
18
|
+
"packages/plugin/angular/src/application.ts",
|
|
19
|
+
"packages/plugin/angular/src/i18n.ts"
|
|
20
|
+
],
|
|
21
|
+
"assets": [
|
|
22
|
+
"packages/plugin/angular/*.md",
|
|
23
|
+
{
|
|
24
|
+
"input": "./packages/plugin/angular/src",
|
|
25
|
+
"glob": "**/!(*.ts)",
|
|
26
|
+
"output": "./src"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"input": "./packages/plugin/angular/src",
|
|
30
|
+
"glob": "**/*.d.ts",
|
|
31
|
+
"output": "./src"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"input": "./packages/plugin/angular",
|
|
35
|
+
"glob": "generators.json",
|
|
36
|
+
"output": "."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"input": "./packages/plugin/angular",
|
|
40
|
+
"glob": "executors.json",
|
|
41
|
+
"output": "."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"input": "./packages/plugin/angular",
|
|
45
|
+
"glob": "migrations.json",
|
|
46
|
+
"output": "."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"input": "./packages/plugin/angular/src/migrations",
|
|
50
|
+
"glob": "**/!(*.ts|*.js|*.json)",
|
|
51
|
+
"output": "./src/migrations"
|
|
52
|
+
},
|
|
53
|
+
"packages/plugin/angular/docs"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"lint": {
|
|
58
|
+
"options": {
|
|
59
|
+
"lintFilePatterns": [
|
|
60
|
+
"packages/plugin/angular/**/*.ts",
|
|
61
|
+
"packages/plugin/angular/package.json",
|
|
62
|
+
"packages/plugin/angular/generators.json",
|
|
63
|
+
"packages/plugin/angular/executors.json"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
package/schematics.yaml
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateNodesContextV2,
|
|
3
|
+
CreateNodesV2,
|
|
4
|
+
ProjectConfiguration,
|
|
5
|
+
TargetConfiguration,
|
|
6
|
+
} from '@nx/devkit';
|
|
7
|
+
import {
|
|
8
|
+
FindProjectByPath,
|
|
9
|
+
FsTree,
|
|
10
|
+
} from '@rxap/workspace-utilities';
|
|
11
|
+
import { Optional } from 'nx/src/project-graph/plugins';
|
|
12
|
+
import { combineGlobPatterns } from 'nx/src/utils/globs';
|
|
13
|
+
import { dirname } from 'path';
|
|
14
|
+
import 'colors';
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
17
|
+
export interface PluginOptions {}
|
|
18
|
+
|
|
19
|
+
export function normalizeOptions(
|
|
20
|
+
options: PluginOptions | undefined,
|
|
21
|
+
): PluginOptions {
|
|
22
|
+
return options ?? {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const createNodesV2: CreateNodesV2<PluginOptions> = [
|
|
26
|
+
combineGlobPatterns([
|
|
27
|
+
'**/tsconfig.app.json',
|
|
28
|
+
'**/src/main.ts',
|
|
29
|
+
'**/src/app/app.module.ts',
|
|
30
|
+
'**/src/app/app.component.ts',
|
|
31
|
+
'**/src/index.html',
|
|
32
|
+
]),
|
|
33
|
+
async (configFilePaths, options, context) => {
|
|
34
|
+
const normalizedOptions = normalizeOptions(options);
|
|
35
|
+
|
|
36
|
+
const includedConfigFilePaths = await Promise.all(
|
|
37
|
+
configFilePaths.map(async (configFilePath) => {
|
|
38
|
+
if (
|
|
39
|
+
await shouldHaveProjectConfiguration(
|
|
40
|
+
configFilePath,
|
|
41
|
+
normalizedOptions,
|
|
42
|
+
context,
|
|
43
|
+
)
|
|
44
|
+
) {
|
|
45
|
+
return configFilePath;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}),
|
|
49
|
+
).then((configFilePathOrUndefinedList) =>
|
|
50
|
+
configFilePathOrUndefinedList.filter((value) => value !== undefined),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const results = await Promise.all(
|
|
54
|
+
includedConfigFilePaths.map(async (configFilePath) => {
|
|
55
|
+
const [ projectPath, projectConfiguration ] =
|
|
56
|
+
await createProjectConfiguration(
|
|
57
|
+
configFilePath,
|
|
58
|
+
normalizedOptions,
|
|
59
|
+
context,
|
|
60
|
+
);
|
|
61
|
+
return [ configFilePath, projectPath, projectConfiguration ] as [
|
|
62
|
+
string,
|
|
63
|
+
string,
|
|
64
|
+
Optional<ProjectConfiguration, 'root'>
|
|
65
|
+
];
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
return results.map(
|
|
70
|
+
([ configFilePath, projectPath, projectConfiguration ]) => [
|
|
71
|
+
configFilePath,
|
|
72
|
+
{
|
|
73
|
+
projects: {
|
|
74
|
+
[projectPath]: projectConfiguration,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
async function shouldHaveProjectConfiguration(
|
|
83
|
+
configFilePath: string,
|
|
84
|
+
options: PluginOptions,
|
|
85
|
+
context: CreateNodesContextV2,
|
|
86
|
+
): Promise<boolean> {
|
|
87
|
+
const projectPath = dirname(configFilePath);
|
|
88
|
+
const tree = new FsTree(context.workspaceRoot);
|
|
89
|
+
if (!FindProjectByPath(tree, projectPath)) {
|
|
90
|
+
// console.log(`The folder of the file '${ configFilePath }' is not the root of a project. Skipping`.yellow);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function createProjectConfiguration(
|
|
97
|
+
configFilePath: string,
|
|
98
|
+
options: PluginOptions,
|
|
99
|
+
context: CreateNodesContextV2,
|
|
100
|
+
): Promise<[ string, Optional<ProjectConfiguration, 'root'> ]> {
|
|
101
|
+
const projectPath = dirname(configFilePath);
|
|
102
|
+
const targets: Record<string, TargetConfiguration> = {};
|
|
103
|
+
const tree = new FsTree(context.workspaceRoot);
|
|
104
|
+
const projectConfiguration = FindProjectByPath(tree, projectPath);
|
|
105
|
+
|
|
106
|
+
if (!projectConfiguration) {
|
|
107
|
+
throw new Error(`Could not find project in '${ projectPath }'`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
targets['config'] = createConfigTarget();
|
|
111
|
+
|
|
112
|
+
return [
|
|
113
|
+
projectPath, {
|
|
114
|
+
targets,
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function createConfigTarget(): TargetConfiguration {
|
|
120
|
+
return {
|
|
121
|
+
executor: '@rxap/plugin-angular:config',
|
|
122
|
+
dependsOn: ['build'],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { readFileFromProjectRoot } from '@rxap/plugin-utilities';
|
|
3
|
+
import { CheckNgPackageExecutorSchema } from './schema';
|
|
4
|
+
|
|
5
|
+
export default async function runExecutor(
|
|
6
|
+
options: CheckNgPackageExecutorSchema,
|
|
7
|
+
context: ExecutorContext,
|
|
8
|
+
) {
|
|
9
|
+
console.log('Executor ran for CheckNgPackage', options);
|
|
10
|
+
|
|
11
|
+
const ngPackage = JSON.parse(readFileFromProjectRoot(context, 'ng-package.json', true));
|
|
12
|
+
const { dependencies } = JSON.parse(readFileFromProjectRoot(context, 'package.json', true));
|
|
13
|
+
|
|
14
|
+
if (ngPackage.allowedNonPeerDependencies) {
|
|
15
|
+
const wrongPackages: string[] = [];
|
|
16
|
+
for (const packageName of ngPackage.allowedNonPeerDependencies) {
|
|
17
|
+
if (!dependencies[packageName]) {
|
|
18
|
+
wrongPackages.push(packageName);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (wrongPackages.length) {
|
|
22
|
+
console.log(`\x1b[31mSome packages in the allowed non peer dependencies list are not in the package.json dependencies list:\x1b[0m\n - ${ wrongPackages.join(
|
|
23
|
+
'\n - ') }`);
|
|
24
|
+
return {
|
|
25
|
+
success: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
success: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { GuessOutputPathFromContext } from '@rxap/plugin-utilities';
|
|
3
|
+
import {
|
|
4
|
+
deepMerge,
|
|
5
|
+
SetToObject,
|
|
6
|
+
} from '@rxap/utilities';
|
|
7
|
+
import {
|
|
8
|
+
existsSync,
|
|
9
|
+
readFileSync,
|
|
10
|
+
writeFileSync,
|
|
11
|
+
} from 'fs';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
import { ConfigExecutorSchema } from './schema';
|
|
14
|
+
import 'colors';
|
|
15
|
+
|
|
16
|
+
function getContent(key: string) {
|
|
17
|
+
const value = process.env[key];
|
|
18
|
+
if (value) {
|
|
19
|
+
let content: string;
|
|
20
|
+
if (value.match(/^(\/[^/\s]*)+\/?$/)) {
|
|
21
|
+
content = readFileSync(value).toString('utf-8');
|
|
22
|
+
} else {
|
|
23
|
+
content = value;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(content);
|
|
27
|
+
} catch (e: any) {
|
|
28
|
+
throw new Error(`Can not parse config from '${ key }': ${ content }`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export default async function runExecutor(
|
|
35
|
+
options: ConfigExecutorSchema,
|
|
36
|
+
context: ExecutorContext,
|
|
37
|
+
) {
|
|
38
|
+
console.log('Executor ran for Config', options);
|
|
39
|
+
|
|
40
|
+
const outputPath = GuessOutputPathFromContext(context);
|
|
41
|
+
|
|
42
|
+
let config: any = {};
|
|
43
|
+
const configPath = join(outputPath, 'config.json');
|
|
44
|
+
if (existsSync(configPath)) {
|
|
45
|
+
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const key of Object.keys(process.env).filter(key => !!key && key.startsWith('RXAP_CONFIG')).sort((a, b) => a.length - b.length)) {
|
|
49
|
+
try {
|
|
50
|
+
const content = getContent(key);
|
|
51
|
+
const match = key.match(/^RXAP_CONFIG_(.*)/);
|
|
52
|
+
if (match) {
|
|
53
|
+
const key = match[1].toLowerCase().replace(/_/g, '.');
|
|
54
|
+
console.log(`Set config '${ key }'`.grey);
|
|
55
|
+
SetToObject(config, key, content);
|
|
56
|
+
} else {
|
|
57
|
+
console.log('Merge config'.grey);
|
|
58
|
+
deepMerge(config, content);
|
|
59
|
+
}
|
|
60
|
+
} catch (e: any) {
|
|
61
|
+
console.error(e.message);
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
error: e.message,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
success: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import {
|
|
3
|
+
GetProjectSourceRoot,
|
|
4
|
+
GetProjectTargetOptions,
|
|
5
|
+
GuessOutputPathFromTargetString,
|
|
6
|
+
} from '@rxap/plugin-utilities';
|
|
7
|
+
import {
|
|
8
|
+
existsSync,
|
|
9
|
+
readFileSync,
|
|
10
|
+
writeFileSync,
|
|
11
|
+
} from 'fs';
|
|
12
|
+
import { copy } from 'fs-extra';
|
|
13
|
+
import { glob } from 'glob';
|
|
14
|
+
import { compile } from 'handlebars';
|
|
15
|
+
import {
|
|
16
|
+
basename,
|
|
17
|
+
join,
|
|
18
|
+
relative,
|
|
19
|
+
} from 'path';
|
|
20
|
+
import { I18nExecutorSchema } from './schema';
|
|
21
|
+
|
|
22
|
+
function getIndexHtmlTemplateFilePath(indexHtmlTemplate: string, context: ExecutorContext) {
|
|
23
|
+
if (existsSync(join(context.root, indexHtmlTemplate))) {
|
|
24
|
+
return join(context.root, indexHtmlTemplate);
|
|
25
|
+
}
|
|
26
|
+
if (existsSync(join(context.root, 'shared', indexHtmlTemplate))) {
|
|
27
|
+
return join(context.root, 'shared', indexHtmlTemplate);
|
|
28
|
+
}
|
|
29
|
+
if (existsSync(join(context.root, 'shared', 'angular', indexHtmlTemplate))) {
|
|
30
|
+
return join(context.root, 'shared', 'angular', indexHtmlTemplate);
|
|
31
|
+
}
|
|
32
|
+
const projectSourceRoot = GetProjectSourceRoot(context);
|
|
33
|
+
if (existsSync(join(projectSourceRoot, indexHtmlTemplate))) {
|
|
34
|
+
return join(projectSourceRoot, indexHtmlTemplate);
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Could not find the i18n index html template with path '${ indexHtmlTemplate }'`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function createIndexHtml(
|
|
40
|
+
options: I18nExecutorSchema,
|
|
41
|
+
context: ExecutorContext,
|
|
42
|
+
outputPath: string,
|
|
43
|
+
) {
|
|
44
|
+
const indexHtmlTemplateFilePath = options.indexHtmlTemplate ?? 'i18n.index.html.hbs';
|
|
45
|
+
|
|
46
|
+
if (!indexHtmlTemplateFilePath) {
|
|
47
|
+
throw new Error('The i18n index html template path is not defined');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const indexHtmlTemplateAbsoluteFilePath = getIndexHtmlTemplateFilePath(indexHtmlTemplateFilePath, context);
|
|
51
|
+
|
|
52
|
+
const indexHtmlTemplateFile = readFileSync(indexHtmlTemplateAbsoluteFilePath).toString('utf-8');
|
|
53
|
+
|
|
54
|
+
const indexHtmlTemplate = compile(indexHtmlTemplateFile);
|
|
55
|
+
|
|
56
|
+
const indexHtml = indexHtmlTemplate(options);
|
|
57
|
+
|
|
58
|
+
const indexHtmlFilePath = join(context.root, outputPath, 'index.html');
|
|
59
|
+
|
|
60
|
+
if (existsSync(indexHtmlFilePath)) {
|
|
61
|
+
console.warn(`The index.html file already exists in the location: '${ indexHtmlFilePath }'`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
writeFileSync(indexHtmlFilePath, indexHtml);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function copyFiles(
|
|
68
|
+
outputPath: string,
|
|
69
|
+
pathList: Array<string | { glob: string, input: string, output: string }>,
|
|
70
|
+
) {
|
|
71
|
+
await Promise.all(pathList.map(async assetPath => {
|
|
72
|
+
if (typeof assetPath === 'string') {
|
|
73
|
+
if (!outputPath) {
|
|
74
|
+
throw new Error('The i18n output path is not defined');
|
|
75
|
+
}
|
|
76
|
+
const assetOutputPath = join(outputPath, basename(assetPath));
|
|
77
|
+
try {
|
|
78
|
+
await copy(assetPath, assetOutputPath);
|
|
79
|
+
} catch (e: any) {
|
|
80
|
+
throw new Error(`Could not copy assets '${ assetPath }' to '${ outputPath }': ${ e.message }`);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
if (!outputPath) {
|
|
84
|
+
throw new Error('The i18n output path is not defined');
|
|
85
|
+
}
|
|
86
|
+
const assetOutputPath = join(outputPath, assetPath.output);
|
|
87
|
+
try {
|
|
88
|
+
const files = await glob(assetPath.input + assetPath.glob);
|
|
89
|
+
await Promise.all(files.map(file => copy(file, join(assetOutputPath, relative(assetPath.input, file)))));
|
|
90
|
+
} catch (e: any) {
|
|
91
|
+
throw new Error(`Could not copy assets '${ JSON.stringify(assetPath) }' to '${ outputPath }': ${ e.message }`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function copyAssets(
|
|
98
|
+
outputPath: string,
|
|
99
|
+
options: I18nExecutorSchema,
|
|
100
|
+
context: ExecutorContext,
|
|
101
|
+
) {
|
|
102
|
+
|
|
103
|
+
if (Array.isArray(options.assets) && options.assets.length) {
|
|
104
|
+
await copyFiles(outputPath, options.assets);
|
|
105
|
+
} else if (typeof options.assets === 'boolean' && options.assets) {
|
|
106
|
+
|
|
107
|
+
if (!context.target) {
|
|
108
|
+
throw new Error('The current builder target is not defined in the context');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!context.projectName) {
|
|
112
|
+
throw new Error('The current project name is not defined in the context');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const buildOptions = GetProjectTargetOptions(context, context.projectName, 'build');
|
|
116
|
+
|
|
117
|
+
if (Array.isArray(buildOptions.assets) && buildOptions.assets.length) {
|
|
118
|
+
await copyFiles(outputPath, buildOptions.assets);
|
|
119
|
+
} else {
|
|
120
|
+
console.info('Skip assets copy. The build target of this project has no assets specified.');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
} else {
|
|
124
|
+
console.info('Skip assets copy. No assets specified.');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function coerceDefaultLanguage(options: I18nExecutorSchema) {
|
|
130
|
+
options.defaultLanguage ??= options.availableLanguages?.[0];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function coerceAvailableLanguages(options: I18nExecutorSchema, context: ExecutorContext) {
|
|
134
|
+
|
|
135
|
+
if (!options.availableLanguages) {
|
|
136
|
+
const buildTarget = options.buildTarget ?? context.projectName + ':build';
|
|
137
|
+
const targetName = buildTarget.split(':')[1];
|
|
138
|
+
const buildOptions = GetProjectTargetOptions(
|
|
139
|
+
context,
|
|
140
|
+
context.projectName,
|
|
141
|
+
targetName,
|
|
142
|
+
context.configurationName ?? 'production'
|
|
143
|
+
);
|
|
144
|
+
const localize = buildOptions.localize;
|
|
145
|
+
if (localize && Array.isArray(localize) && localize.length) {
|
|
146
|
+
options.availableLanguages = localize;
|
|
147
|
+
} else if (options.defaultLanguage) {
|
|
148
|
+
options.availableLanguages = [ options.defaultLanguage ];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default async function runExecutor(
|
|
156
|
+
options: I18nExecutorSchema,
|
|
157
|
+
context: ExecutorContext,
|
|
158
|
+
) {
|
|
159
|
+
console.log('Executor ran for I18n', options);
|
|
160
|
+
|
|
161
|
+
coerceAvailableLanguages(options, context);
|
|
162
|
+
|
|
163
|
+
if (!options.availableLanguages?.length) {
|
|
164
|
+
throw new Error('The available languages are not defined');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
coerceDefaultLanguage(options);
|
|
168
|
+
|
|
169
|
+
if (!options.defaultLanguage) {
|
|
170
|
+
throw new Error('The default language is not defined');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const outputPath = GuessOutputPathFromTargetString(context, options.buildTarget);
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
await createIndexHtml(options, context, outputPath);
|
|
177
|
+
} catch (e: any) {
|
|
178
|
+
console.error(`Create index html failed: ${e.message}`);
|
|
179
|
+
return {
|
|
180
|
+
success: false,
|
|
181
|
+
error: e.message,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
await copyAssets(outputPath, options, context);
|
|
187
|
+
} catch (e: any) {
|
|
188
|
+
console.error(`Copy assets failed: ${ e.message }`);
|
|
189
|
+
return {
|
|
190
|
+
success: false,
|
|
191
|
+
error: e.message,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
success: true,
|
|
197
|
+
};
|
|
198
|
+
}
|