@o3r/schematics 8.2.0-alpha.9 → 8.2.0-alpha.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/LICENSE +26 -26
  2. package/README.md +9 -197
  3. package/package.json +7 -4
  4. package/schematics/ng-add/index.d.ts +0 -2
  5. package/schematics/ng-add/index.d.ts.map +1 -1
  6. package/schematics/ng-add/index.js +47 -4
  7. package/src/rule-factories/check-packages-peers/index.d.ts +1 -1
  8. package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
  9. package/src/rule-factories/check-packages-peers/index.js +91 -3
  10. package/src/rule-factories/check-packages-peers/index.js.map +1 -1
  11. package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
  12. package/src/rule-factories/eslint-fix/index.js +18 -10
  13. package/src/rule-factories/eslint-fix/index.js.map +1 -1
  14. package/src/rule-factories/index.d.ts +2 -0
  15. package/src/rule-factories/index.d.ts.map +1 -1
  16. package/src/rule-factories/index.js +2 -0
  17. package/src/rule-factories/index.js.map +1 -1
  18. package/src/rule-factories/ng-add/index.d.ts +13 -2
  19. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  20. package/src/rule-factories/ng-add/index.js +105 -13
  21. package/src/rule-factories/ng-add/index.js.map +1 -1
  22. package/src/rule-factories/update-imports/index.d.ts +5 -0
  23. package/src/rule-factories/update-imports/index.d.ts.map +1 -0
  24. package/src/rule-factories/update-imports/index.js +8 -0
  25. package/src/rule-factories/update-imports/index.js.map +1 -0
  26. package/src/rule-factories/update-imports/list-of-vars.d.ts +15 -0
  27. package/src/rule-factories/update-imports/list-of-vars.d.ts.map +1 -0
  28. package/src/rule-factories/update-imports/list-of-vars.js +44 -0
  29. package/src/rule-factories/update-imports/list-of-vars.js.map +1 -0
  30. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts +12 -0
  31. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts.map +1 -0
  32. package/src/rule-factories/update-imports/update-imports-with-scope.js +34 -0
  33. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -0
  34. package/src/rule-factories/update-imports/update-ts-imports.d.ts +11 -0
  35. package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -0
  36. package/src/rule-factories/update-imports/update-ts-imports.js +32 -0
  37. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -0
  38. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts +8 -0
  39. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts.map +1 -0
  40. package/src/rule-factories/update-imports/v7-to-v8-map-object.js +2049 -0
  41. package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +1 -0
  42. package/src/rule-factories/vscode-extensions/index.d.ts +8 -0
  43. package/src/rule-factories/vscode-extensions/index.d.ts.map +1 -0
  44. package/src/rule-factories/vscode-extensions/index.js +26 -0
  45. package/src/rule-factories/vscode-extensions/index.js.map +1 -0
  46. package/src/rules/install.d.ts +2 -2
  47. package/src/rules/install.d.ts.map +1 -1
  48. package/src/rules/install.js +8 -4
  49. package/src/rules/install.js.map +1 -1
  50. package/src/tasks/eslint/index.d.ts.map +1 -1
  51. package/src/tasks/eslint/index.js +2 -1
  52. package/src/tasks/eslint/index.js.map +1 -1
  53. package/src/tasks/link/index.d.ts.map +1 -1
  54. package/src/tasks/link/index.js +3 -2
  55. package/src/tasks/link/index.js.map +1 -1
  56. package/src/tasks/ng-add/index.d.ts +5 -0
  57. package/src/tasks/ng-add/index.d.ts.map +1 -1
  58. package/src/tasks/ng-add/index.js +3 -2
  59. package/src/tasks/ng-add/index.js.map +1 -1
  60. package/src/utility/gitignore.js +1 -1
  61. package/src/utility/gitignore.js.map +1 -1
  62. package/src/utility/index.d.ts +2 -0
  63. package/src/utility/index.d.ts.map +1 -1
  64. package/src/utility/index.js +2 -0
  65. package/src/utility/index.js.map +1 -1
  66. package/src/utility/loaders.d.ts +17 -3
  67. package/src/utility/loaders.d.ts.map +1 -1
  68. package/src/utility/loaders.js +30 -5
  69. package/src/utility/loaders.js.map +1 -1
  70. package/src/utility/modules.d.ts +51 -1
  71. package/src/utility/modules.d.ts.map +1 -1
  72. package/src/utility/modules.js +101 -1
  73. package/src/utility/modules.js.map +1 -1
  74. package/src/utility/package-manager-runner.d.ts +14 -0
  75. package/src/utility/package-manager-runner.d.ts.map +1 -0
  76. package/src/utility/package-manager-runner.js +31 -0
  77. package/src/utility/package-manager-runner.js.map +1 -0
  78. package/src/utility/routes.d.ts +2 -1
  79. package/src/utility/routes.d.ts.map +1 -1
  80. package/src/utility/routes.js +3 -2
  81. package/src/utility/routes.js.map +1 -1
  82. package/src/utility/template-property.helper.js +1 -1
  83. package/src/utility/template-property.helper.js.map +1 -1
  84. package/src/utility/update-imports.d.ts +25 -0
  85. package/src/utility/update-imports.d.ts.map +1 -0
  86. package/src/utility/update-imports.js +86 -0
  87. package/src/utility/update-imports.js.map +1 -0
package/LICENSE CHANGED
@@ -1,26 +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.
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 CHANGED
@@ -1,212 +1,24 @@
1
- <h1 align="center">Otter Framework</h1>
1
+ <h1 align="center">Otter schematics</h1>
2
2
  <p align="center">
3
- <img src="./.attachments/logo.png" alt="Super cute Otter!"/>
3
+ <img src="../../../.attachments/otter.png" alt="Super cute Otter!" width="40%"/>
4
4
  </p>
5
5
 
6
+ This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md).
6
7
  <br />
7
8
  <br />
8
9
 
9
10
  ## Description
10
- The **Otter** project is a highly modular framework whose goal is to provide a common platform to accelerate and facilitate the development on Angular web applications.
11
- It is split into several units to cover different aspects of these applications (localization, testing, customization, etc.).
12
- Also, to customize an application, metadata can be extracted from the application source code and injected into a CMS to manage dynamic configuration.
13
11
 
14
- > **Note**: The full documentation is available [here](./docs/README.md).
12
+ This module provides basic utilities and generic rules (install, lint) reused in other package schematics.
15
13
 
16
- ## Built With
17
-
18
- * [Angular](https://angular.io/)
19
- * [Typescript](https://www.typescriptlang.org/)
20
- * [RxJs](http://reactivex.io/rxjs/)
21
- * [Redux](http://redux.js.org/)
22
- * [Sass](http://sass-lang.com/)
23
- * [Nx](https://nx.dev/)
24
-
25
- ## Get Started
26
-
27
- A new application can be set up with these simple commands:
28
-
29
- ```shell
30
- # Starting a new angular application
31
- npm install -g @angular/cli
32
- ng new my-app
33
-
34
- # Add Otter framework
35
- ng add @o3r/core
36
- ```
37
-
38
- > **Note**: Please refer to [Otter Get Started](./docs/core/START_NEW_APPLICATION.md) and [Angular Get Started](https://angular.io/guide/setup-local#install-the-angular-cli) for complete documentation.
39
-
40
- ## Contributing
41
-
42
- Please read the [Contributing](./CONTRIBUTING.md) file for details on our code of conduct and the process to submit pull requests.
43
-
44
- ## Versioning
45
-
46
- Please refer to [Security file](./SECURITY.md).
47
-
48
- ## License
49
-
50
- Please refer to the [License file](./LICENSE).
51
-
52
- ## Acknowledgments
53
-
54
- The Otter Team, @AmadeusITGroup/otter_admins, is responsible for the review of the code of this repository.
55
- Any bug of feature request can be addressed via [issue](https://github.com/AmadeusITGroup/otter/issues/new) report.
56
-
57
- ## Developer
58
-
59
- ### Building and Testing library
60
-
61
- These documents describe how to set up your development environment to build and test the framework.
62
- It also explains the basic mechanics of using `git`, `node`, and `npm`.
63
-
64
- - [Description](#description)
65
- - [Built With](#built-with)
66
- - [Get Started](#get-started)
67
- - [Contributing](#contributing)
68
- - [Versioning](#versioning)
69
- - [License](#license)
70
- - [Acknowledgments](#acknowledgments)
71
- - [Developer](#developer)
72
- - [Building and Testing library](#building-and-testing-library)
73
- - [Prerequisite Software](#prerequisite-software)
74
- - [Getting the Sources](#getting-the-sources)
75
- - [Installing NPM Modules](#installing-npm-modules)
76
- - [Build command](#build-command)
77
- - [Running tests locally](#running-tests-locally)
78
- - [Manage task cache](#manage-task-cache)
79
- - [Debugging with Visual Studio Code](#debugging-with-visual-studio-code)
80
- - [Link local packages](#link-local-packages)
81
-
82
- Refer to the [contribution guidelines](./CONTRIBUTING.md)
83
- if you'd like to contribute to the framework.
84
-
85
- #### Prerequisite Software
86
-
87
- Before you can build and test Otter modules, you must install and configure the
88
- following products on your development machine:
89
-
90
- * [Git](http://git-scm.com) and/or the **GitHub app** (for [Mac](http://mac.github.com) or
91
- [Windows](http://windows.github.com))
92
- * [GitHub's Guide to Installing
93
- Git](https://help.github.com/articles/set-up-git) is a good source of information.
94
-
95
- * [Node.js](http://nodejs.org), (version `>=10.0.0`)
96
- * This is used to run tests and generate distributable files. We also use Node's Package Manager, `npm`
97
- (version `>3.8.x`), which comes with Node. Depending on your system, you can install Node either from
98
- source or as a pre-packaged bundle.
99
-
100
- * [Yarn](https://yarnpkg.com/lang/en/docs/install/), a Node's Package Manager
101
- * You can install yarn using NPM manager (coming with Node.js).
102
- The version of Yarn currently used is embedded in the repository. In case you need to link this library with your project, you can check the section "Link local packages".
103
-
104
- * [Chrome](https://www.google.com/chrome/browser/desktop/index.html)
105
- * We use Chrome to run our tests.
106
-
107
- #### Getting the sources
108
-
109
- Clone the Otter repository using the button `Code` or using the following git command:
110
-
111
- ```shell
112
- git clone https://github.com/AmadeusITGroup/otter.git
113
- ```
114
-
115
- #### Installing NPM modules
116
-
117
- Next, install the JavaScript modules needed to build:
118
-
119
- ```shell
120
- # Install library project dependencies (package.json)
121
- yarn install
122
- ```
123
-
124
- #### Build command
125
-
126
- To build the modules, run:
127
-
128
- ```shell
129
- yarn run build
130
- ```
131
-
132
- Each module can be built independently thanks to [Nx](https://nx.dev/packages/nx/documents/run) commands:
14
+ ## How to install
133
15
 
134
16
  ```shell
135
- # ex: Build Core package only
136
- yarn nx build core
17
+ ng add @o3r/schematics
137
18
  ```
138
19
 
139
- > **Note**: Results are put in the `dist` of each module (`packages/@<scope>/<module>/dist`).
140
-
141
- #### Running tests locally
142
-
143
- Check the formatting:
144
-
145
- ```shell
146
- yarn run lint
147
- ```
148
-
149
- Check Unit Tests:
150
-
151
- ```shell
152
- yarn run test
153
- ```
154
-
155
- Each module can be test independently thanks to [Nx](https://nx.dev/packages/nx/documents/run) commands:
156
-
157
- ```shell
158
- # ex: Test Core package only
159
- yarn nx test core
160
-
161
- # ex: Lint Core package only
162
- yarn nx lint core
163
- ```
20
+ > **Warning**: this module requires [@o3r/core](https://www.npmjs.com/package/@o3r/core) to be installed.
164
21
 
165
- #### Manage task cache
166
-
167
- When running the Build, Lint, or Test commands, **Nx** can use its [cache mechanism](https://nx.dev/concepts/how-caching-works).
168
- In some cases, it may be useful to clear the cache to investigate an issue. This can be done with the following command:
169
-
170
- ```shell
171
- yarn nx reset
172
- ```
173
-
174
- #### Debugging with Visual Studio Code
175
-
176
- The repository contains the mandatory configuration and the recommended VSCode plugins to ensure optimal comfort and productivity while developing on the Otter Framework.
177
-
178
- The default configuration of the repository provides a way to run Unit Tests one by one and to define, within VSCode, break points using the `vscode-jest-tests` debugger task.
179
-
180
- #### Link local packages
181
-
182
- For Yarn v1, add the `resolutions` property in the main package.json. It should be filled with the relative path to the `dist` of the local packages you want to link. The protocol `link:` can be used.
183
-
184
- NOTE: It will not import the transitive dependencies of the linked packages.
185
-
186
- Example:
187
-
188
- ```json
189
- {
190
- "resolutions": {
191
- "@o3r/localization": "./relative/path/to/otter/packages/@o3r/localization/dist",
192
- "@o3r/core": "link:./relative/path/to/otter/packages/@o3r/core/dist",
193
- }
194
- }
195
- ```
196
-
197
- For Yarn v2+, the protocol `portal:` can also be used.
198
-
199
- NOTE: The portal protocol will also import all the transitive dependencies of the linked packages.
200
- Please keep in mind that mismatched versions of these dependencies may cause some issues.
201
-
202
- Example:
22
+ ## Description
203
23
 
204
- ```json
205
- {
206
- "resolutions": {
207
- "@o3r/localization": "./relative/path/to/otter/library/@o3r/localization/dist",
208
- "@o3r/core": "link:./relative/path/to/otter/library/@o3r/core/dist",
209
- "@o3r/rules-engine": "portal:./relative/path/to/otter/library/@o3r/rules-engine/dist",
210
- }
211
- }
212
- ```
24
+ This is a technical package to be used as dependency by [Otter modules](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md) providing helpers to used in [Schematics](https://angular.io/guide/schematics) development.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/schematics",
3
- "version": "8.2.0-alpha.9",
3
+ "version": "8.2.0-alpha.90",
4
4
  "description": "Schematics module of the Otter framework",
5
5
  "main": "./src/index.js",
6
6
  "keywords": [
@@ -28,7 +28,6 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@o3r/dev-tools": "^8.2.0-alpha.9",
32
31
  "comment-json": "^4.1.0",
33
32
  "globby": "^11.1.0",
34
33
  "minimatch": "^6.1.6",
@@ -47,12 +46,16 @@
47
46
  "@angular/core": "~15.2.0",
48
47
  "@angular/platform-browser": "~15.2.0",
49
48
  "@angular/platform-browser-dynamic": "~15.2.0",
49
+ "@babel/core": "~7.21.0",
50
+ "@babel/preset-typescript": "~7.21.0",
51
+ "@compodoc/compodoc": "^1.1.19",
50
52
  "@nrwl/cli": "~15.9.0",
51
53
  "@nrwl/jest": "~15.9.0",
52
54
  "@nrwl/js": "~15.9.0",
53
55
  "@nrwl/linter": "~15.9.0",
54
- "@o3r/build-helpers": "^8.2.0-alpha.9",
55
- "@o3r/eslint-plugin": "^8.2.0-alpha.9",
56
+ "@o3r/build-helpers": "^8.2.0-alpha.90",
57
+ "@o3r/dev-tools": "^8.2.0-alpha.90",
58
+ "@o3r/eslint-plugin": "^8.2.0-alpha.90",
56
59
  "@schematics/angular": "~15.2.0",
57
60
  "@types/jest": "~28.1.2",
58
61
  "@types/node": "^17.0.45",
@@ -1,8 +1,6 @@
1
1
  import type { Rule } from '@angular-devkit/schematics';
2
2
  /**
3
3
  * Add Otter schematics to an Angular Project
4
- *
5
- * @param options
6
4
  */
7
5
  export declare function ngAdd(): Rule;
8
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAG5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AA+B/E;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAuB5B"}
@@ -1,14 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = void 0;
4
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+ const rxjs_1 = require("rxjs");
8
+ const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
4
9
  /**
5
- * Add Otter schematics to an Angular Project
10
+ * Install dev dependency on your application
6
11
  *
7
- * @param options
12
+ * Note: it should not be moved to other packages as it should run before the installation
13
+ * of peer dependencies
14
+ */
15
+ class DevInstall extends tasks_1.NodePackageInstallTask {
16
+ /** @inheritDoc */
17
+ toConfiguration() {
18
+ const installOptions = process.env && process.env.npm_execpath && process.env.npm_execpath.indexOf('yarn') === -1 ? 'npm' : 'yarn';
19
+ return {
20
+ name: options_1.NodePackageName,
21
+ options: {
22
+ command: 'install',
23
+ quiet: this.quiet,
24
+ workingDirectory: this.workingDirectory,
25
+ packageName: `${this.packageName} ${installOptions === 'yarn' ? '--prefer-dev' : '-D'}`,
26
+ packageManager: installOptions
27
+ }
28
+ };
29
+ }
30
+ }
31
+ /**
32
+ * Add Otter schematics to an Angular Project
8
33
  */
9
34
  function ngAdd() {
10
- /* ng add rules */
11
- return () => { };
35
+ const schematicsDependencies = ['@angular-devkit/architect', '@angular-devkit/schematics', '@angular-devkit/core', '@schematics/angular', 'comment-json', 'eslint', 'globby'];
36
+ return async (tree, context) => {
37
+ const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
38
+ const treePackageJson = tree.readJson('./package.json');
39
+ const packageJsonContent = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
40
+ const getDependencyVersion = (dependency) => packageJsonContent?.dependencies?.[dependency] || packageJsonContent?.peerDependencies?.[dependency];
41
+ schematicsDependencies.forEach((dependency) => {
42
+ const version = getDependencyVersion(dependency);
43
+ context.logger.info(`Installing ${dependency}${version || ''}`);
44
+ treePackageJson.devDependencies = { ...packageJsonContent.devDependencies, [dependency]: version };
45
+ context.addTask(new DevInstall({
46
+ packageName: `${dependency}${version ? '@' + version : ''}`,
47
+ hideOutput: false,
48
+ quiet: false
49
+ }));
50
+ });
51
+ tree.overwrite('./package.json', JSON.stringify(treePackageJson));
52
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
53
+ return () => tree;
54
+ };
12
55
  }
13
56
  exports.ngAdd = ngAdd;
14
57
  //# sourceMappingURL=index.js.map
@@ -4,5 +4,5 @@ import { SchematicContext, Tree } from '@angular-devkit/schematics';
4
4
  *
5
5
  * @param packageName The package to check peer deps for
6
6
  */
7
- export declare function checkPackagesRule(packageName: string): (tree: Tree, _context: SchematicContext) => import("@angular-devkit/schematics/src/tree/interface").Tree;
7
+ export declare function checkPackagesRule(packageName: string): (tree: Tree, context: SchematicContext) => import("@angular-devkit/schematics/src/tree/interface").Tree;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGpE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,UACrC,IAAI,8FAKnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAgHpE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,UACrC,IAAI,6FAKnB"}
@@ -1,16 +1,104 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkPackagesRule = void 0;
4
- const dev_tools_1 = require("@o3r/dev-tools");
4
+ const path = require("node:path");
5
+ const commentJson = require("comment-json");
6
+ const semver_1 = require("semver");
7
+ /**
8
+ * Get package manager used in runs
9
+ * Defaults to the package manager setup in process.env if no package manager set in angular.json
10
+ *
11
+ * @param angularJsonString Content of angular.json file
12
+ */
13
+ function getPackageManager(angularJsonString) {
14
+ let packageManager = process.env && process.env.npm_execpath && process.env.npm_execpath.indexOf('yarn') === -1 ? 'npm' : 'yarn';
15
+ if (angularJsonString) {
16
+ const angularJsonObj = commentJson.parse(angularJsonString);
17
+ if (angularJsonObj?.cli?.packageManager) {
18
+ packageManager = angularJsonObj.cli.packageManager;
19
+ }
20
+ }
21
+ return packageManager;
22
+ }
23
+ /**
24
+ * Check if the first level of peer deps of a given package are installed.
25
+ * List all not installed packages or packages with version mismatch
26
+ *
27
+ * @param packageName
28
+ */
29
+ function getPackagesToInstallOrUpdate(packageName) {
30
+ let installedPackage;
31
+ try {
32
+ installedPackage = require(`${packageName}${path.posix.sep}package.json`);
33
+ }
34
+ catch (err) {
35
+ throw new Error(`The provided package is not installed: ${packageName}`);
36
+ }
37
+ const packagesToInstall = [];
38
+ const packagesWrongVersion = [];
39
+ const optionalPackages = Object.entries(installedPackage.peerDependenciesMeta || {})
40
+ .filter(([, dep]) => dep?.optional)
41
+ .map(([depName]) => depName);
42
+ const peerDependenciesMap = Object.entries(installedPackage.peerDependencies || {})
43
+ .reduce((acc, [name, val]) => {
44
+ if (!optionalPackages.includes(name)) {
45
+ acc[name] = val;
46
+ }
47
+ return acc;
48
+ }, {});
49
+ Object.entries(peerDependenciesMap).forEach(([pName, pVersion]) => {
50
+ let installedPackageVersion;
51
+ try {
52
+ installedPackageVersion = require(`${pName}${path.posix.sep}package.json`).version;
53
+ }
54
+ catch (err) {
55
+ packagesToInstall.push({ packageName: pName, version: pVersion });
56
+ }
57
+ if (installedPackageVersion && !(0, semver_1.satisfies)(installedPackageVersion, pVersion)) {
58
+ packagesWrongVersion.push({ packageName: pName, foundVersion: installedPackageVersion, version: pVersion });
59
+ }
60
+ });
61
+ return { packagesToInstall, packagesWrongVersion };
62
+ }
63
+ /**
64
+ * Log an instruction with the packages to install or update to match a package peer dependencies
65
+ *
66
+ * @param packageName
67
+ * @param angularJsonString
68
+ * @param logger
69
+ */
70
+ function checkPackagesToInstallOrUpdate(packageName, logger, angularJsonString) {
71
+ const packageManager = getPackageManager(angularJsonString);
72
+ const { packagesToInstall, packagesWrongVersion } = getPackagesToInstallOrUpdate(packageName);
73
+ if (packagesWrongVersion.length) {
74
+ logger.warn('');
75
+ logger.warn(`The following packages have a mismatch version installed to satisfy "${packageName}" needed versions:`);
76
+ packagesWrongVersion.forEach(dep => {
77
+ logger.warn(`${dep.packageName} found version is ${dep.foundVersion}. "${packageName}" needs ${dep.version}`);
78
+ });
79
+ logger.warn('');
80
+ logger.warn('You might consider reinstalling the packages with the good versions:');
81
+ packagesWrongVersion.forEach((dep) => logger.warn(`${packageManager} run ng update ${dep.packageName}@${dep.version}`));
82
+ }
83
+ if (packagesToInstall.length) {
84
+ logger.error('');
85
+ logger.error(`The following packages need to be installed to have "${packageName}" working. Run the commands one by one:`);
86
+ packagesToInstall.forEach((dep) => logger.error(`${packageManager} run ng add ${dep.packageName}@${dep.version}`));
87
+ throw new Error('Missing peer dependencies');
88
+ }
89
+ if (!packagesToInstall.length && !packagesWrongVersion.length) {
90
+ logger.info(`The package ${packageName} has all peer deps installed.\n`);
91
+ }
92
+ }
5
93
  /**
6
94
  * List peer deps packages of the given package, display a warning if version mismatch, error if peer dep is missing
7
95
  *
8
96
  * @param packageName The package to check peer deps for
9
97
  */
10
98
  function checkPackagesRule(packageName) {
11
- return (tree, _context) => {
99
+ return (tree, context) => {
12
100
  const angularJson = tree.read('/angular.json');
13
- (0, dev_tools_1.checkPackagesToInstallOrUpdate)(packageName, angularJson?.toString());
101
+ checkPackagesToInstallOrUpdate(packageName, context.logger, angularJson?.toString());
14
102
  return tree;
15
103
  };
16
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/check-packages-peers/index.ts"],"names":[],"mappings":";;;AACA,8CAAgE;AAEhE;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAA,0CAA8B,EAAC,WAAW,EAAE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MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE;QAC7D,MAAM,CAAC,IAAI,CAAC,eAAe,WAAW,iCAAiC,CAAC,CAAC;KAC1E;AAEH,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/C,8BAA8B,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAND,8CAMC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAA+C,MAAM,4BAA4B,CAAC;AAIzG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IAEH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CA8D5G"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAA+C,MAAM,4BAA4B,CAAC;AAKzG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IAEH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAoE5G"}
@@ -4,6 +4,7 @@ exports.applyEsLintFix = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const node_child_process_1 = require("node:child_process");
6
6
  const node_path_1 = require("node:path");
7
+ const package_manager_runner_1 = require("../../utility/package-manager-runner");
7
8
  /**
8
9
  * Apply EsLint fix
9
10
  *
@@ -48,16 +49,23 @@ function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
48
49
  }
49
50
  return acc;
50
51
  }, new Set());
51
- (0, node_child_process_1.exec)('yarn eslint ' +
52
- Array.from(files).map((file) => `"${file}"`).join(' ') +
53
- ' --fix --color' +
54
- (linterOptions.hideWarnings ? ' --quiet' : '') +
55
- (eslintFile ? ` --config ${eslintFile} --parser-options=tsconfigRootDir:${(0, node_path_1.resolve)(process.cwd(), (0, node_path_1.dirname)(eslintFile))}` : ''), (_error, stdout, stderr) => {
56
- context.logger.info(stdout);
57
- if (!linterOptions.force) {
58
- context.logger.error(stderr);
59
- }
60
- });
52
+ try {
53
+ const packageManager = (0, package_manager_runner_1.getPackageManager)();
54
+ (0, node_child_process_1.exec)(`${packageManager} ${(0, package_manager_runner_1.getPackageManagerRunner)()} eslint ` +
55
+ Array.from(files).map((file) => `"${file}"`).join(' ') +
56
+ ' --fix --color' +
57
+ (linterOptions.hideWarnings ? ' --quiet' : '') +
58
+ (eslintFile ? ` --config ${eslintFile} --parser-options=tsconfigRootDir:${(0, node_path_1.resolve)(process.cwd(), (0, node_path_1.dirname)(eslintFile))}` : ''), (_error, stdout, stderr) => {
59
+ context.logger.info(stdout);
60
+ if (!linterOptions.force) {
61
+ context.logger.error(stderr);
62
+ }
63
+ });
64
+ }
65
+ catch {
66
+ context.logger.error('Could not run eslint');
67
+ }
68
+ return tree;
61
69
  };
62
70
  }
63
71
  exports.applyEsLintFix = applyEsLintFix;
@@ -1 +1 @@
1
- {"version":3,"file":"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AAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBACtD,gBAAgB;gBAChB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9C,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,UAAU,qCAAqC,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAA,mBAAO,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7H,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBACzB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC5B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;oBACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBAC9B;YACH,CAAC,CACF,CAAC;SACH;QAAC,MAAM;YACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;SAC9C;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AApED,wCAoEC"}
@@ -3,4 +3,6 @@ export * from './interfaces';
3
3
  export * from './check-packages-peers/index';
4
4
  export * from './ng-add/index';
5
5
  export * from './remove-packages/index';
6
+ export * from './update-imports/index';
7
+ export * from './vscode-extensions/index';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -6,4 +6,6 @@ tslib_1.__exportStar(require("./interfaces"), exports);
6
6
  tslib_1.__exportStar(require("./check-packages-peers/index"), exports);
7
7
  tslib_1.__exportStar(require("./ng-add/index"), exports);
8
8
  tslib_1.__exportStar(require("./remove-packages/index"), exports);
9
+ tslib_1.__exportStar(require("./update-imports/index"), exports);
10
+ tslib_1.__exportStar(require("./vscode-extensions/index"), exports);
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC;AACxC,iEAAuC;AACvC,oEAA0C"}
@@ -1,10 +1,21 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- import { NgAddPackageOptions } from '../../tasks/index';
2
+ import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
3
+ import type { NgAddPackageOptions } from '../../tasks/index';
3
4
  /**
4
5
  * Install via `ng add` a list of npm packages.
5
6
  *
6
7
  * @param packages List of packages to be installed via `ng add`
7
8
  * @param options install options
9
+ * @param packageJsonPath path of the package json of the project where they will be installed
8
10
  */
9
- export declare function ngAddPackages(packages: string[], options?: NgAddPackageOptions): Rule;
11
+ export declare function ngAddPackages(packages: string[], options?: NgAddPackageOptions, packageJsonPath?: string): Rule;
12
+ /**
13
+ * Look for the peer dependencies and run ng add on the package requested version
14
+ *
15
+ * @param packages list of the name of the packages needed
16
+ * @param packageJsonPath path to package json that needs the peer to be resolved
17
+ * @param type how to install the dependency (dev, peer for a library or default for an application)
18
+ * @param parentPackageInfo for logging purposes
19
+ */
20
+ export declare function ngAddPeerDependencyPackages(packages: string[], packageJsonPath: string, type: NodeDependencyType | undefined, options: NgAddPackageOptions, parentPackageInfo?: string): Rule;
10
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,mBAAmB,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAqBrF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,IAAI,EAAkD,MAAM,4BAA4B,CAAC;AAG5H,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAG9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,mBAAmB,EAAE,eAAe,SAAkB,GAAG,IAAI,CAsFxH;AAGD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,gCAAiD,EAC5I,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,MAAM,QAezD"}