@o3r/workspace 9.4.0-alpha.26

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 (126) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +42 -0
  3. package/builders.json +6 -0
  4. package/collection.json +35 -0
  5. package/migration.json +6 -0
  6. package/package.json +188 -0
  7. package/schematics/application/index.d.ts +8 -0
  8. package/schematics/application/index.d.ts.map +1 -0
  9. package/schematics/application/index.js +68 -0
  10. package/schematics/application/index.js.map +1 -0
  11. package/schematics/application/schema.d.ts +14 -0
  12. package/schematics/application/schema.d.ts.map +1 -0
  13. package/schematics/application/schema.js +3 -0
  14. package/schematics/application/schema.js.map +1 -0
  15. package/schematics/application/schema.json +38 -0
  16. package/schematics/application/templates/package.json.template +29 -0
  17. package/schematics/library/index.d.ts +8 -0
  18. package/schematics/library/index.d.ts.map +1 -0
  19. package/schematics/library/index.js +40 -0
  20. package/schematics/library/index.js.map +1 -0
  21. package/schematics/library/rules/rules.ng.d.ts +12 -0
  22. package/schematics/library/rules/rules.ng.d.ts.map +1 -0
  23. package/schematics/library/rules/rules.ng.js +123 -0
  24. package/schematics/library/rules/rules.ng.js.map +1 -0
  25. package/schematics/library/rules/rules.nx.d.ts +12 -0
  26. package/schematics/library/rules/rules.nx.d.ts.map +1 -0
  27. package/schematics/library/rules/rules.nx.js +127 -0
  28. package/schematics/library/rules/rules.nx.js.map +1 -0
  29. package/schematics/library/rules/shared.d.ts +19 -0
  30. package/schematics/library/rules/shared.d.ts.map +1 -0
  31. package/schematics/library/rules/shared.js +84 -0
  32. package/schematics/library/rules/shared.js.map +1 -0
  33. package/schematics/library/schema.d.ts +18 -0
  34. package/schematics/library/schema.d.ts.map +1 -0
  35. package/schematics/library/schema.js +3 -0
  36. package/schematics/library/schema.js.map +1 -0
  37. package/schematics/library/schema.json +42 -0
  38. package/schematics/library/templates/ng/.eslintrc.js.template +19 -0
  39. package/schematics/library/templates/ng/.gitignore.template +2 -0
  40. package/schematics/library/templates/ng/.npmignore.template +0 -0
  41. package/schematics/library/templates/ng/jest.config.js.template +37 -0
  42. package/schematics/library/templates/ng/testing/setup-jest.ts.template +2 -0
  43. package/schematics/library/templates/ng/tsconfig.builders.json.template +22 -0
  44. package/schematics/library/templates/ng/tsconfig.eslint.json.template +8 -0
  45. package/schematics/library/templates/ng/tsconfig.json.template +12 -0
  46. package/schematics/library/templates/ng/tsconfig.spec.json.template +17 -0
  47. package/schematics/library/templates/nx/.eslintrc.js.template +19 -0
  48. package/schematics/library/templates/nx/.gitignore.template +2 -0
  49. package/schematics/library/templates/nx/.npmignore.template +0 -0
  50. package/schematics/library/templates/nx/jest.config.js.template +37 -0
  51. package/schematics/library/templates/nx/project.json.template +66 -0
  52. package/schematics/library/templates/nx/testing/setup-jest.ts.template +2 -0
  53. package/schematics/library/templates/nx/tsconfig.eslint.json.template +8 -0
  54. package/schematics/ng-add/helpers/gitignore-update.d.ts +6 -0
  55. package/schematics/ng-add/helpers/gitignore-update.d.ts.map +1 -0
  56. package/schematics/ng-add/helpers/gitignore-update.js +29 -0
  57. package/schematics/ng-add/helpers/gitignore-update.js.map +1 -0
  58. package/schematics/ng-add/helpers/index.d.ts +6 -0
  59. package/schematics/ng-add/helpers/index.d.ts.map +1 -0
  60. package/schematics/ng-add/helpers/index.js +9 -0
  61. package/schematics/ng-add/helpers/index.js.map +1 -0
  62. package/schematics/ng-add/helpers/linter.d.ts +8 -0
  63. package/schematics/ng-add/helpers/linter.d.ts.map +1 -0
  64. package/schematics/ng-add/helpers/linter.js +27 -0
  65. package/schematics/ng-add/helpers/linter.js.map +1 -0
  66. package/schematics/ng-add/helpers/npm-workspace.d.ts +16 -0
  67. package/schematics/ng-add/helpers/npm-workspace.d.ts.map +1 -0
  68. package/schematics/ng-add/helpers/npm-workspace.js +65 -0
  69. package/schematics/ng-add/helpers/npm-workspace.js.map +1 -0
  70. package/schematics/ng-add/helpers/renovate/index.d.ts +8 -0
  71. package/schematics/ng-add/helpers/renovate/index.d.ts.map +1 -0
  72. package/schematics/ng-add/helpers/renovate/index.js +27 -0
  73. package/schematics/ng-add/helpers/renovate/index.js.map +1 -0
  74. package/schematics/ng-add/helpers/renovate/templates/__dot__renovaterc.json.template +61 -0
  75. package/schematics/ng-add/index.d.ts +8 -0
  76. package/schematics/ng-add/index.d.ts.map +1 -0
  77. package/schematics/ng-add/index.js +34 -0
  78. package/schematics/ng-add/index.js.map +1 -0
  79. package/schematics/ng-add/project-setup.d.ts +9 -0
  80. package/schematics/ng-add/project-setup.d.ts.map +1 -0
  81. package/schematics/ng-add/project-setup.js +59 -0
  82. package/schematics/ng-add/project-setup.js.map +1 -0
  83. package/schematics/ng-add/schema.d.ts +16 -0
  84. package/schematics/ng-add/schema.d.ts.map +1 -0
  85. package/schematics/ng-add/schema.js +3 -0
  86. package/schematics/ng-add/schema.js.map +1 -0
  87. package/schematics/ng-add/schema.json +53 -0
  88. package/schematics/ng-update/index.d.ts +2 -0
  89. package/schematics/ng-update/index.d.ts.map +1 -0
  90. package/schematics/ng-update/index.js +3 -0
  91. package/schematics/ng-update/index.js.map +1 -0
  92. package/schematics/package.json +3 -0
  93. package/schematics/sdk/index.d.ts +8 -0
  94. package/schematics/sdk/index.d.ts.map +1 -0
  95. package/schematics/sdk/index.js +64 -0
  96. package/schematics/sdk/index.js.map +1 -0
  97. package/schematics/sdk/rules/clean-standalone.rule.d.ts +7 -0
  98. package/schematics/sdk/rules/clean-standalone.rule.d.ts.map +1 -0
  99. package/schematics/sdk/rules/clean-standalone.rule.js +28 -0
  100. package/schematics/sdk/rules/clean-standalone.rule.js.map +1 -0
  101. package/schematics/sdk/rules/rules.ng.d.ts +10 -0
  102. package/schematics/sdk/rules/rules.ng.d.ts.map +1 -0
  103. package/schematics/sdk/rules/rules.ng.js +54 -0
  104. package/schematics/sdk/rules/rules.ng.js.map +1 -0
  105. package/schematics/sdk/rules/rules.nx.d.ts +11 -0
  106. package/schematics/sdk/rules/rules.nx.d.ts.map +1 -0
  107. package/schematics/sdk/rules/rules.nx.js +60 -0
  108. package/schematics/sdk/rules/rules.nx.js.map +1 -0
  109. package/schematics/sdk/rules/update-ts-paths.rule.d.ts +10 -0
  110. package/schematics/sdk/rules/update-ts-paths.rule.d.ts.map +1 -0
  111. package/schematics/sdk/rules/update-ts-paths.rule.js +41 -0
  112. package/schematics/sdk/rules/update-ts-paths.rule.js.map +1 -0
  113. package/schematics/sdk/schema.d.ts +16 -0
  114. package/schematics/sdk/schema.d.ts.map +1 -0
  115. package/schematics/sdk/schema.js +3 -0
  116. package/schematics/sdk/schema.js.map +1 -0
  117. package/schematics/sdk/schema.json +46 -0
  118. package/schematics/sdk/templates/jest.config.js.template +12 -0
  119. package/src/cli/set-version.cjs +59 -0
  120. package/src/cli/set-version.cjs.map +1 -0
  121. package/src/cli/set-version.d.cts +3 -0
  122. package/src/cli/set-version.d.cts.map +1 -0
  123. package/src/public_api.d.ts +2 -0
  124. package/src/public_api.d.ts.map +1 -0
  125. package/src/public_api.js +3 -0
  126. package/src/public_api.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright Amadeus SAS
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ <h1 align="center">Otter Workspace</h1>
2
+ <p align="center">
3
+ <img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
4
+ </p>
5
+
6
+ ## Description
7
+
8
+ This package is an [Otter Framework](https://github.com/AmadeusITGroup/otter) Module providing tools at workspace level.
9
+
10
+ This packages provides several [Schematics](#schematics) and [CLIs](#scripts) used to accelerate the development and support maintenance of workspace's packages.
11
+
12
+ ## Schematics
13
+
14
+ Otter framework provides a set of code generators based on [angular schematics](https://angular.io/guide/schematics).
15
+
16
+ | Schematics | Description | How to use |
17
+ | -------------------------- | ----------------------------------------------------------------------------- | --------------------------------- |
18
+ | add | Include Otter in a project workspace. | `ng add @o3r/workspace` |
19
+ | library | Add a new Library to the current Otter project | `ng g library` |
20
+ | sdk | Add a new SDK to the current Otter project | `ng g sdk` |
21
+ | application | Add a new Application to the current Otter project | `ng g application` |
22
+
23
+ ## Scripts
24
+
25
+ This packages exposes the following Command Line Interfaces:
26
+
27
+ ### Set Version
28
+
29
+ Replaces the value of the `version` field of the `JSON` files matched by the pattern provided to the `--include` options.
30
+
31
+ ```shell
32
+ Usage: set-version [options] <version>
33
+
34
+ Replace the packages version in a monorepos
35
+
36
+ Options:
37
+
38
+ -p, --placeholder <placeholder> Pattern of the version placeholder (default: 0.0.0)
39
+ --include <file> Add files pattern to apply the verison replacement (default: */lerna.json,**/package.json,!**/node_modules/**/{package,lerna}.json)
40
+ -V, --verbose Display debug logs
41
+ -h, --help output usage information
42
+ ```
package/builders.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/architect/src/builders-schema.json",
3
+ "builders": {
4
+
5
+ }
6
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add Otter Library to the project.",
6
+ "factory": "./schematics/ng-add/index#ngAdd",
7
+ "schema": "./schematics/ng-add/schema.json",
8
+ "aliases": ["install", "i"]
9
+ },
10
+ "application": {
11
+ "description": "Generate a new Otter Application",
12
+ "factory": "./schematics/application/index#generateApplication",
13
+ "schema": "./schematics/application/schema.json",
14
+ "aliases": [
15
+ "new-application",
16
+ "app"
17
+ ]
18
+ },
19
+ "library": {
20
+ "description": "Generate a new Otter compatible module",
21
+ "factory": "./schematics/library/index#generateModule",
22
+ "schema": "./schematics/library/schema.json",
23
+ "aliases": [
24
+ "new-module",
25
+ "module",
26
+ "libs"
27
+ ]
28
+ },
29
+ "sdk": {
30
+ "description": "Generate a new SDK package in an Otter project",
31
+ "factory": "./schematics/sdk/index#generateSdk",
32
+ "schema": "./schematics/sdk/schema.json"
33
+ }
34
+ }
35
+ }
package/migration.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+
5
+ }
6
+ }
package/package.json ADDED
@@ -0,0 +1,188 @@
1
+ {
2
+ "name": "@o3r/workspace",
3
+ "version": "9.4.0-alpha.26",
4
+ "description": "Workspace tooling of the Otter Framework",
5
+ "keywords": [
6
+ "workspace",
7
+ "otter"
8
+ ],
9
+ "scripts": {
10
+ "nx": "nx",
11
+ "ng": "yarn nx",
12
+ "build": "yarn nx build workspace",
13
+ "test": "yarn nx test workspace",
14
+ "prepare:build:builders": "yarn cpy 'builders/**/*.json' dist/builders && yarn cpy 'schematics/**/*.json' 'schematics/**/templates/**' dist/schematics && yarn cpy '{builders,collection,migration}.json' dist",
15
+ "prepare:publish": "prepare-publish ./dist",
16
+ "build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest",
17
+ "postbuild": "patch-package-json-main"
18
+ },
19
+ "default": "./src/public_api.js",
20
+ "types": "./src/public_api.d.ts",
21
+ "peerDependencies": {
22
+ "@angular-devkit/architect": "~0.1602.0",
23
+ "@angular-devkit/core": "~16.2.0",
24
+ "@angular-devkit/schematics": "~16.2.0",
25
+ "@angular/cli": "~16.2.0",
26
+ "@angular/common": "~16.2.0",
27
+ "@angular/compiler-cli": "~16.2.0",
28
+ "@angular/core": "~16.2.0",
29
+ "@schematics/angular": "~16.2.0",
30
+ "typescript": "~5.1.6"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "@angular/cli": {
34
+ "optional": true
35
+ }
36
+ },
37
+ "dependencies": {
38
+ "@o3r/schematics": "^9.4.0-alpha.26",
39
+ "commander": "^11.0.0",
40
+ "globby": "^11.1.0",
41
+ "semver": "^7.5.2",
42
+ "tslib": "^2.5.3",
43
+ "uuid": "^9.0.0",
44
+ "winston": "^3.8.2"
45
+ },
46
+ "devDependencies": {
47
+ "@ama-sdk/schematics": "^9.4.0-alpha.26",
48
+ "@angular-devkit/architect": "~0.1602.0",
49
+ "@angular-devkit/build-angular": "~16.2.0",
50
+ "@angular-devkit/core": "~16.2.0",
51
+ "@angular-devkit/schematics": "~16.2.0",
52
+ "@angular-eslint/eslint-plugin": "~16.2.0",
53
+ "@angular/cli": "~16.2.0",
54
+ "@angular/common": "~16.2.0",
55
+ "@angular/compiler": "~16.2.0",
56
+ "@angular/compiler-cli": "~16.2.0",
57
+ "@angular/core": "~16.2.0",
58
+ "@angular/platform-browser": "~16.2.0",
59
+ "@angular/platform-browser-dynamic": "~16.2.0",
60
+ "@angular/router": "~16.2.0",
61
+ "@babel/core": "~7.23.0",
62
+ "@babel/preset-typescript": "~7.23.0",
63
+ "@ngrx/entity": "~16.3.0",
64
+ "@ngrx/store": "~16.3.0",
65
+ "@nx/eslint-plugin": "~16.10.0",
66
+ "@nx/jest": "~16.10.0",
67
+ "@nx/js": "~16.10.0",
68
+ "@nx/linter": "~16.10.0",
69
+ "@o3r/build-helpers": "^9.4.0-alpha.26",
70
+ "@o3r/core": "^9.4.0-alpha.26",
71
+ "@o3r/dev-tools": "^9.4.0-alpha.26",
72
+ "@o3r/eslint-plugin": "^9.4.0-alpha.26",
73
+ "@o3r/schematics": "^9.4.0-alpha.26",
74
+ "@o3r/test-helpers": "^9.4.0-alpha.26",
75
+ "@schematics/angular": "~16.2.0",
76
+ "@types/jest": "~29.5.2",
77
+ "@types/minimist": "^1.2.2",
78
+ "@types/node": "^18.0.0",
79
+ "@types/pid-from-port": "^1.1.0",
80
+ "@types/semver": "^7.3.13",
81
+ "@types/uuid": "^9.0.0",
82
+ "@typescript-eslint/eslint-plugin": "^5.60.1",
83
+ "@typescript-eslint/parser": "^5.60.1",
84
+ "cpy-cli": "^4.2.0",
85
+ "eslint": "^8.42.0",
86
+ "eslint-import-resolver-node": "^0.3.4",
87
+ "eslint-plugin-jest": "~27.4.0",
88
+ "eslint-plugin-jsdoc": "~46.8.0",
89
+ "eslint-plugin-prefer-arrow": "~1.2.3",
90
+ "eslint-plugin-unicorn": "^47.0.0",
91
+ "jest": "~29.7.0",
92
+ "jest-environment-jsdom": "~29.7.0",
93
+ "jest-junit": "~16.0.0",
94
+ "jest-preset-angular": "~13.1.1",
95
+ "minimist": "^1.2.6",
96
+ "ngrx-store-localstorage": "^16.0.0",
97
+ "nx": "~16.10.0",
98
+ "pid-from-port": "^1.1.3",
99
+ "rxjs": "^7.8.1",
100
+ "ts-jest": "~29.1.1",
101
+ "type-fest": "^3.12.0",
102
+ "typescript": "~5.1.6",
103
+ "zone.js": "~0.13.1"
104
+ },
105
+ "generatorDependencies": {
106
+ "@angular/material": "~16.2.0",
107
+ "@ngrx/router-store": "~16.3.0",
108
+ "@ngrx/effects": "~16.3.0",
109
+ "@ngrx/store-devtools": "~16.3.0"
110
+ },
111
+ "engines": {
112
+ "node": ">=16.0.0"
113
+ },
114
+ "schematics": "./collection.json",
115
+ "builders": "./builders.json",
116
+ "ng-update": {
117
+ "migrations": "./migration.json"
118
+ },
119
+ "bin": {
120
+ "o3r-set-version": "src/cli/set-version.cjs"
121
+ },
122
+ "main": "./src/public_api.js",
123
+ "type": "commonjs",
124
+ "contributors": [
125
+ {
126
+ "name": "Yannick Adam",
127
+ "url": "https://github.com/yannickadam",
128
+ "email": "yannickadam@users.noreply.github.com"
129
+ },
130
+ {
131
+ "name": "Kilian Panot",
132
+ "url": "https://github.com/kpanot",
133
+ "email": "kpanot@users.noreply.github.com"
134
+ },
135
+ {
136
+ "name": "Jeremy Bourgeois",
137
+ "url": "https://github.com/jbourgeois-1A",
138
+ "email": "jbourgeois-1A@users.noreply.github.com"
139
+ },
140
+ {
141
+ "name": "Pierre Henri Ginoux",
142
+ "url": "https://github.com/pginoux-1A",
143
+ "email": "pginoux-1A@users.noreply.github.com"
144
+ },
145
+ {
146
+ "name": "Mircea Vasile Rednic",
147
+ "url": "https://github.com/mrednic-1A",
148
+ "email": "mrednic-1A@users.noreply.github.com"
149
+ },
150
+ {
151
+ "name": "Stephane Dalle",
152
+ "email": "sdalle-1A@users.noreply.github.com"
153
+ },
154
+ {
155
+ "name": "Nicolas Hoffmann",
156
+ "url": "https://github.com/nhoffmann-1A",
157
+ "email": "nhoffmann-1A@users.noreply.github.com"
158
+ },
159
+ {
160
+ "name": "Victor Scaiceanu",
161
+ "url": "https://github.com/vscaiceanu-1a",
162
+ "email": "vscaiceanu-1A@users.noreply.github.com"
163
+ },
164
+ {
165
+ "name": "Florian Paul",
166
+ "url": "https://github.com/fpaul-1A",
167
+ "email": "fpaul-1A@users.noreply.github.com"
168
+ },
169
+ {
170
+ "name": "Corinne Paulve",
171
+ "url": "https://github.com/cpaulve-1A",
172
+ "email": "cpaulve-1A@users.noreply.github.com"
173
+ },
174
+ {
175
+ "name": "Matthieu Crouzet",
176
+ "url": "https://github.com/matthieu-crouzet",
177
+ "email": "matthieu-crouzet@users.noreply.github.com"
178
+ },
179
+ {
180
+ "name": "Salome Do",
181
+ "url": "https://github.com/sdo-1A",
182
+ "email": "sdo-1A@users.noreply.github.com"
183
+ }
184
+ ],
185
+ "bugs": "https://github.com/AmadeusITGroup/otter/issues",
186
+ "repository": "https://github.com/AmadeusITGroup/otter",
187
+ "license": "BSD-3-Clause"
188
+ }
@@ -0,0 +1,8 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import type { NgGenerateApplicationSchema } from './schema';
3
+ /**
4
+ * Add an Otter application to a monorepo
5
+ * @param options Schematic options
6
+ */
7
+ export declare function generateApplication(options: NgGenerateApplicationSchema): Rule;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/application/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwF,IAAI,EAAqC,MAAM,4BAA4B,CAAC;AAG3K,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAM5D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAkE9E"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateApplication = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const schematics_2 = require("@o3r/schematics");
6
+ const path = require("node:path");
7
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
8
+ const schema_1 = require("@schematics/angular/application/schema");
9
+ /**
10
+ * Add an Otter application to a monorepo
11
+ * @param options Schematic options
12
+ */
13
+ function generateApplication(options) {
14
+ const packageJsonName = schematics_1.strings.dasherize(options.name);
15
+ const cleanName = packageJsonName.replace(/^@/, '').replaceAll(/\//g, '-');
16
+ const addProjectSpecificFiles = (targetPath, rootDependencies) => {
17
+ return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
18
+ (0, schematics_1.template)({
19
+ ...options,
20
+ name: packageJsonName,
21
+ rootDependencies
22
+ }),
23
+ (0, schematics_1.move)(targetPath),
24
+ (0, schematics_1.renameTemplateFiles)()
25
+ ]), schematics_1.MergeStrategy.Overwrite);
26
+ };
27
+ const ngCliUpdate = (tree, context) => {
28
+ if (options.style && options.style !== 'scss') {
29
+ context.logger.warn('The provided "style" option will be ignored. "SCSS" will be used.');
30
+ }
31
+ const config = (0, schematics_2.getWorkspaceConfig)(tree);
32
+ if (!options.path && !config) {
33
+ throw new Error('The `path` option is not provided and no workspace configuration file found to define it.');
34
+ }
35
+ if ((0, schematics_2.isNxContext)(tree)) {
36
+ throw new Error('NX is not currently supported. Feature tracked via https://github.com/AmadeusITGroup/otter/issues/720');
37
+ }
38
+ const defaultRoot = (0, schematics_2.getPackagesBaseRootFolder)(tree, context, config, 'application');
39
+ /** Project Root used by the Angular application schematic */
40
+ const projectRoot = path.posix.join(options.path || defaultRoot, cleanName);
41
+ /** Path to the folder where to generate the new application */
42
+ const targetPath = path.posix.join('/', projectRoot);
43
+ const extendedOptions = { ...options, targetPath, name: cleanName, projectName: cleanName };
44
+ const rootPackageJson = tree.readJson('/package.json');
45
+ const rootDependencies = { ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies };
46
+ const angularAppSchema = context.engine.createCollection('@schematics/angular').createSchematic('application');
47
+ const getOptions = (schema) => {
48
+ const schemaOptions = schema.description.schemaJson?.properties || {};
49
+ return Object.keys(schemaOptions);
50
+ };
51
+ const angularOptions = getOptions(angularAppSchema);
52
+ return (0, schematics_1.chain)([
53
+ (0, schematics_1.externalSchematic)('@schematics/angular', 'application', {
54
+ ...Object.entries(extendedOptions).reduce((acc, [key, value]) => (angularOptions.includes(key) ? { ...acc, [key]: value } : acc), {}),
55
+ name: extendedOptions.name,
56
+ projectRoot,
57
+ style: schema_1.Style.Scss
58
+ }),
59
+ addProjectSpecificFiles(targetPath, rootDependencies),
60
+ (_, c) => {
61
+ c.addTask(new tasks_1.RunSchematicTask('@o3r/core:ng-add', extendedOptions));
62
+ }
63
+ ])(tree, context);
64
+ };
65
+ return ngCliUpdate;
66
+ }
67
+ exports.generateApplication = generateApplication;
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/application/index.ts"],"names":[],"mappings":";;;AAAA,2DAA2K;AAC3K,gDAA6F;AAC7F,kCAAkC;AAGlC,4DAAoE;AAEpE,mEAA+D;AAE/D;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,OAAoC;IACtE,MAAM,eAAe,GAAG,oBAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE3E,MAAM,uBAAuB,GAAG,CAAC,UAAkB,EAAE,gBAAoD,EAAE,EAAE;QAE3G,OAAO,IAAA,sBAAS,EAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAAE;YACzC,IAAA,qBAAQ,EAAC;gBACP,GAAG,OAAO;gBACV,IAAI,EAAE,eAAe;gBACrB,gBAAgB;aACjB,CAAC;YACF,IAAA,iBAAI,EAAC,UAAU,CAAC;YAChB,IAAA,gCAAmB,GAAE;SACtB,CAAC,EAAE,0BAAa,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,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAE/G,MAAM,UAAU,GAAG,CAAC,MAA2B,EAAE,EAAE;YACjD,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,IAAI,EAAE,CAAC;YACtE,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAEpD,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,8BAAiB,EAA8B,qBAAqB,EAAE,aAAa,EAAE;gBACnF,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACnI,IAAI,EAAE,eAAe,CAAC,IAAI;gBAC1B,WAAW;gBACX,KAAK,EAAE,cAAK,CAAC,IAAI;aAAC,CAAC;YACrB,uBAAuB,CAAC,UAAU,EAAE,gBAAgB,CAAC;YACrD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gBACP,CAAC,CAAC,OAAO,CAAC,IAAI,wBAAgB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC,CAAC;YACvE,CAAC;SACF,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AAErB,CAAC;AAlED,kDAkEC"}
@@ -0,0 +1,14 @@
1
+ import type { SchematicOptionObject } from '@o3r/schematics';
2
+ export interface NgGenerateApplicationSchema extends SchematicOptionObject {
3
+ /** Application name */
4
+ name: string;
5
+ /** Target directory to generate the application */
6
+ path?: string | undefined;
7
+ /** Description of the new application */
8
+ description?: string | undefined;
9
+ /** Skip the linter process */
10
+ skipLinter: boolean;
11
+ /** Do not install dependency packages. */
12
+ skipInstall: boolean;
13
+ }
14
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/application/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IAEb,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,0CAA0C;IAC1C,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/application/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "ngGenerateApplicationSchematicsSchema",
4
+ "title": "Generate a new Otter application",
5
+ "description": "Generate a new Otter application",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "Application name",
10
+ "x-prompt": "Name of the new application?",
11
+ "$default": {
12
+ "$source": "argv",
13
+ "index": 0
14
+ }
15
+ },
16
+ "description": {
17
+ "type": "string",
18
+ "description": "Description of the new application",
19
+ "default": ""
20
+ },
21
+ "path": {
22
+ "type": "string",
23
+ "description": "Target directory to generate the application"
24
+ },
25
+ "skipLinter": {
26
+ "type": "boolean",
27
+ "description": "Skip the linter process",
28
+ "default": true
29
+ },
30
+ "skipInstall": {
31
+ "description": "Do not install dependency packages.",
32
+ "type": "boolean",
33
+ "default": false
34
+ }
35
+ },
36
+ "required": ["name"],
37
+ "additionalProperties": true
38
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "<%= name %>",
3
+ "version": "0.0.0-placeholder",
4
+ "scripts": {
5
+ "ng": "ng",
6
+ "start": "ng serve",
7
+ "build": "ng build",
8
+ "watch": "ng build --watch --configuration development"
9
+ },
10
+ "private": true,
11
+ "dependencies": {
12
+ "@angular/animations": "<%= rootDependencies['@angular/animations'] || rootDependencies['@angular/core'] || 'latest' %>",
13
+ "@angular/common": "<%= rootDependencies['@angular/common'] || rootDependencies['@angular/core'] || 'latest' %>",
14
+ "@angular/compiler": "<%= rootDependencies['@angular/compiler'] || rootDependencies['@angular/core'] || 'latest' %>",
15
+ "@angular/core": "<%= rootDependencies['@angular/core'] || 'latest' %>",
16
+ "@angular/forms": "<%= rootDependencies['@angular/forms'] || rootDependencies['@angular/core'] || 'latest' %>",
17
+ "@angular/platform-browser": "<%= rootDependencies['@angular/platform-browser'] || rootDependencies['@angular/core'] || 'latest' %>",
18
+ "@angular/platform-browser-dynamic": "<%= rootDependencies['@angular/platform-browser-dynamic'] || rootDependencies['@angular/core'] || 'latest' %>",
19
+ "@angular/router": "<%= rootDependencies['@angular/router'] || rootDependencies['@angular/core'] || 'latest' %>",
20
+ "rxjs": "<%= rootDependencies['rxjs'] || 'latest' %>",
21
+ "tslib": "<%= rootDependencies['tslib'] || 'latest' %>",
22
+ "zone.js": "<%= rootDependencies['zone.js'] || 'latest' %>"
23
+ },
24
+ "devDependencies": {
25
+ "@angular/cli": "<%= rootDependencies['@angular/cli'] || 'latest' %>",
26
+ "@angular/compiler-cli": "<%= rootDependencies['@angular/compiler-cli'] || rootDependencies['@angular/cli'] || 'latest' %>",
27
+ "typescript": "<%= rootDependencies['typescript'] || 'latest' %>"
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { NgGenerateModuleSchema } from './schema';
3
+ /**
4
+ * Add an Otter compatible module to a monorepo
5
+ * @param options Schematic options
6
+ */
7
+ export declare function generateModule(options: NgGenerateModuleSchema): Rule;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/library/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAAW,MAAM,4BAA4B,CAAC;AAG3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAKlD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CA4BpE"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateModule = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const path = require("node:path");
6
+ const schematics_2 = require("@o3r/schematics");
7
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
8
+ const rules_nx_1 = require("./rules/rules.nx");
9
+ const rules_ng_1 = require("./rules/rules.ng");
10
+ /**
11
+ * Add an Otter compatible module to a monorepo
12
+ * @param options Schematic options
13
+ */
14
+ function generateModule(options) {
15
+ return (tree, context) => {
16
+ const packageJsonName = schematics_1.strings.dasherize(options.name);
17
+ const cleanName = packageJsonName.replace(/^@/, '').replaceAll(/\//g, '-');
18
+ const isNx = (0, schematics_2.isNxContext)(tree);
19
+ const config = (0, schematics_2.getWorkspaceConfig)(tree);
20
+ if (!config) {
21
+ throw new schematics_2.O3rCliError('No workspace configuration file found');
22
+ }
23
+ const defaultRoot = (0, schematics_2.getPackagesBaseRootFolder)(tree, context, config, 'library');
24
+ /** Path to the folder where generate the new module */
25
+ const targetPath = path.posix.resolve('/', options.path || defaultRoot, cleanName);
26
+ const extendedOptions = { ...options, targetPath, name: cleanName, packageJsonName: packageJsonName };
27
+ return (0, schematics_1.chain)([
28
+ isNx ? (0, rules_nx_1.nxGenerateModule)(extendedOptions) : (0, rules_ng_1.ngGenerateModule)(extendedOptions),
29
+ (t, c) => (0, schematics_1.externalSchematic)('@o3r/core', 'ng-add', { ...options, projectName: extendedOptions.name })(t, c),
30
+ (t, c) => (0, schematics_1.externalSchematic)('@o3r/core', 'ng-add-create', { name: extendedOptions.name, path: targetPath })(t, c),
31
+ options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEsLintFix)(),
32
+ options.skipInstall ? (0, schematics_1.noop)() : (t, c) => {
33
+ c.addTask(new tasks_1.NodePackageInstallTask());
34
+ return t;
35
+ }
36
+ ])(tree, context);
37
+ };
38
+ }
39
+ exports.generateModule = generateModule;
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/library/index.ts"],"names":[],"mappings":";;;AAAA,2DAA2F;AAC3F,kCAAkC;AAClC,gDAA0H;AAE1H,4DAA0E;AAC1E,+CAAoD;AACpD,+CAAoD;AAEpD;;;GAGG;AACH,SAAgB,cAAc,CAAC,OAA+B;IAE5D,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,eAAe,GAAG,oBAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE3E,MAAM,IAAI,GAAG,IAAA,wBAAW,EAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAA,+BAAkB,EAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,wBAAW,CAAC,uCAAuC,CAAC,CAAC;SAChE;QACD,MAAM,WAAW,GAAG,IAAA,sCAAyB,EAAC,IAAI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5BD,wCA4BC"}
@@ -0,0 +1,12 @@
1
+ import type { NgGenerateModuleSchema } from '../schema';
2
+ import { Rule } from '@angular-devkit/schematics';
3
+ /**
4
+ * generate the rules to adapt the library generated by ng cli
5
+ * @param options.targetPath Path where the library has been generated
6
+ * @param options Schematic options
7
+ */
8
+ export declare function ngGenerateModule(options: NgGenerateModuleSchema & {
9
+ targetPath: string;
10
+ packageJsonName: string;
11
+ }): Rule;
12
+ //# sourceMappingURL=rules.ng.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.ng.d.ts","sourceRoot":"","sources":["../../../../schematics/library/rules/rules.ng.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAwF,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAKvJ;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,sBAAsB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqHxH"}