@o3r/schematics 10.0.0-prerelease.98 → 10.0.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. package/README.md +2 -1
  2. package/cli/environment.js.map +1 -0
  3. package/package.json +7 -7
  4. package/schematics/ng-add/index.d.ts.map +1 -1
  5. package/schematics/ng-add/index.js +28 -27
  6. package/schematics/ng-add/index.js.map +1 -0
  7. package/schematics/ng-add/schema.js.map +1 -0
  8. package/schematics/package.json +3 -0
  9. package/src/modules/modules.display.rule.js.map +1 -1
  10. package/src/modules/modules.helpers.js.map +1 -1
  11. package/src/rule-factories/add-imports/index.js.map +1 -1
  12. package/src/rule-factories/check-packages-peers/index.js.map +1 -1
  13. package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
  14. package/src/rule-factories/eslint-fix/index.js.map +1 -1
  15. package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
  16. package/src/rule-factories/ng-add/dependencies.d.ts +78 -0
  17. package/src/rule-factories/ng-add/dependencies.d.ts.map +1 -0
  18. package/src/rule-factories/ng-add/dependencies.js +156 -0
  19. package/src/rule-factories/ng-add/dependencies.js.map +1 -0
  20. package/src/rule-factories/ng-add/index.d.ts +3 -36
  21. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  22. package/src/rule-factories/ng-add/index.js +4 -218
  23. package/src/rule-factories/ng-add/index.js.map +1 -1
  24. package/src/rule-factories/ng-add/ng-add.helpers.d.ts +22 -0
  25. package/src/rule-factories/ng-add/ng-add.helpers.d.ts.map +1 -0
  26. package/src/rule-factories/ng-add/ng-add.helpers.js +162 -0
  27. package/src/rule-factories/ng-add/ng-add.helpers.js.map +1 -0
  28. package/src/rule-factories/ng-add/schematics-register.d.ts +17 -0
  29. package/src/rule-factories/ng-add/schematics-register.d.ts.map +1 -0
  30. package/src/rule-factories/ng-add/schematics-register.js +64 -0
  31. package/src/rule-factories/ng-add/schematics-register.js.map +1 -0
  32. package/src/rule-factories/remove-packages/index.js.map +1 -1
  33. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
  34. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
  35. package/src/rule-factories/vscode-extensions/index.js.map +1 -1
  36. package/src/rules/install.d.ts +8 -4
  37. package/src/rules/install.d.ts.map +1 -1
  38. package/src/rules/install.js +10 -8
  39. package/src/rules/install.js.map +1 -1
  40. package/src/tasks/ng-add/index.d.ts +1 -0
  41. package/src/tasks/ng-add/index.d.ts.map +1 -1
  42. package/src/tasks/ng-add/index.js +1 -0
  43. package/src/tasks/ng-add/index.js.map +1 -1
  44. package/src/tasks/package-manager/add-dev-dependency.d.ts +1 -0
  45. package/src/tasks/package-manager/add-dev-dependency.d.ts.map +1 -1
  46. package/src/tasks/package-manager/add-dev-dependency.js +1 -0
  47. package/src/tasks/package-manager/add-dev-dependency.js.map +1 -1
  48. package/src/utility/ast.js.map +1 -1
  49. package/src/utility/builder.js.map +1 -1
  50. package/src/utility/collection.d.ts.map +1 -1
  51. package/src/utility/collection.js +1 -1
  52. package/src/utility/collection.js.map +1 -1
  53. package/src/utility/component.js.map +1 -1
  54. package/src/utility/dependencies.js +1 -1
  55. package/src/utility/dependencies.js.map +1 -1
  56. package/src/utility/environment.js.map +1 -1
  57. package/src/utility/file-info.js.map +1 -1
  58. package/src/utility/generation.js.map +1 -1
  59. package/src/utility/gitignore.js.map +1 -1
  60. package/src/utility/loaders.d.ts +6 -1
  61. package/src/utility/loaders.d.ts.map +1 -1
  62. package/src/utility/loaders.js +10 -2
  63. package/src/utility/loaders.js.map +1 -1
  64. package/src/utility/matching-peers.d.ts.map +1 -1
  65. package/src/utility/matching-peers.js +1 -1
  66. package/src/utility/matching-peers.js.map +1 -1
  67. package/src/utility/modules.js.map +1 -1
  68. package/src/utility/monorepo.js.map +1 -1
  69. package/src/utility/package-manager-runner.js.map +1 -1
  70. package/src/utility/package-version.js.map +1 -1
  71. package/src/utility/routes.js.map +1 -1
  72. package/src/utility/sub-entry.js.map +1 -1
  73. package/src/utility/template-property.helper.js.map +1 -1
  74. package/src/utility/update-imports.js.map +1 -1
  75. package/src/utility/update-pipes.js.map +1 -1
  76. package/src/utility/wrapper.d.ts.map +1 -1
  77. package/src/utility/wrapper.js +48 -3
  78. package/src/utility/wrapper.js.map +1 -1
@@ -1,221 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupSchematicsDefaultParams = exports.registerPackageCollectionSchematics = exports.ngAddPeerDependencyPackages = exports.ngAddPackages = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const tasks_1 = require("@angular-devkit/schematics/tasks");
6
- const dependencies_1 = require("@schematics/angular/utility/dependencies");
7
- const node_fs_1 = require("node:fs");
8
- const path = require("node:path");
9
- const rxjs_1 = require("rxjs");
10
- const index_1 = require("../../utility/index");
11
- /**
12
- * Install via `ng add` a list of npm packages.
13
- * @param packages List of packages to be installed via `ng add`
14
- * @param options install options
15
- * @param packageJsonPath path of the package json of the project where they will be installed
16
- */
17
- function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
18
- if (!packages.length) {
19
- return schematics_1.noop;
20
- }
21
- const cwd = process.cwd().replace(/[\\/]+/g, '/');
22
- // FileSystem working directory might be different from Tree working directory (when using `yarn workspace` for example)
23
- const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
24
- const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
25
- if (options?.workingDirectory && !packageJsonPath.startsWith(options.workingDirectory)) {
26
- packageJsonPath = path.join(options.workingDirectory, packageJsonPath);
27
- }
28
- const getInstalledVersion = (packageName) => {
29
- let versionFound;
30
- for (const workingDirectory of new Set([fsWorkingDirectory, '.'])) {
31
- try {
32
- const fileSystemPackageJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(workingDirectory, 'package.json'), { encoding: 'utf8' }));
33
- let version;
34
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
35
- version = fileSystemPackageJson.devDependencies[packageName];
36
- }
37
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
38
- version = fileSystemPackageJson.peerDependencies[packageName];
39
- }
40
- else {
41
- version = fileSystemPackageJson.dependencies[packageName];
42
- }
43
- if (versionFound && version !== versionFound) {
44
- // In case of conflict between package.json files, we consider the package as not installed to force its update
45
- return;
46
- }
47
- versionFound = version;
48
- }
49
- catch (e) {
50
- return;
51
- }
52
- }
53
- return versionFound;
54
- };
55
- const getNgAddSchema = (packageName, context) => {
56
- try {
57
- const collection = context.engine.createCollection(packageName);
58
- return collection.createSchematic('ng-add');
59
- }
60
- catch {
61
- context.logger.warn(`No ng-add found for ${packageName}`);
62
- return undefined;
63
- }
64
- };
65
- const getOptions = (schema) => {
66
- const schemaOptions = schema.description.schemaJson?.properties || {};
67
- return Object.entries(options || {}).reduce((accOptions, [key, value]) => {
68
- if (schemaOptions[key]) {
69
- accOptions[key] = value;
70
- }
71
- return accOptions;
72
- }, {});
73
- };
74
- const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
75
- const packageManager = (0, index_1.getPackageManager)();
76
- const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
77
- if (packagesToInstall.length < 1) {
78
- return schematics_1.noop;
79
- }
80
- return (0, schematics_1.chain)([
81
- // Update package.json in tree
82
- (tree) => {
83
- const sortDependencies = (packageJson, depType) => {
84
- packageJson[depType] = packageJson[depType] ?
85
- Object.fromEntries(Object.entries(packageJson[depType]).sort(([key1, _val1], [key2, _val2]) => key1.localeCompare(key2))) :
86
- undefined;
87
- };
88
- for (const filePath of new Set([packageJsonPath, './package.json'])) {
89
- const packageJson = tree.readJson(filePath);
90
- packages.forEach((packageName) => {
91
- const version = versions[packageName] || 'latest';
92
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
93
- packageJson.devDependencies = { ...packageJson.devDependencies, [packageName]: version };
94
- }
95
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
96
- packageJson.peerDependencies = { ...packageJson.peerDependencies, [packageName]: version };
97
- }
98
- else {
99
- packageJson.dependencies = { ...packageJson.dependencies, [packageName]: version };
100
- }
101
- });
102
- ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {
103
- sortDependencies(packageJson, depType);
104
- });
105
- tree.overwrite(filePath, JSON.stringify(packageJson, null, 2));
106
- }
107
- },
108
- // Run ng-adds
109
- async (tree, context) => {
110
- if (options?.skipNgAddSchematicRun) {
111
- context.logger.info(`Package(s) '${packagesToInstall.join(', ')}' was(were) installed.
112
- The run of 'ng-add' schematics for the package(s) is intentionally skipped. You can do the run standalone, later.`);
113
- return schematics_1.noop;
114
- }
115
- new Set([packageJsonPath, './package.json']).forEach((filePath) => {
116
- (0, node_fs_1.mkdirSync)(path.join(process.cwd(), path.dirname(filePath)), { recursive: true });
117
- (0, node_fs_1.writeFileSync)(path.join(process.cwd(), filePath), tree.readText(filePath));
118
- });
119
- context.addTask(new tasks_1.NodePackageInstallTask({
120
- packageManager: packageManager,
121
- hideOutput: false,
122
- quiet: false
123
- }));
124
- await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
125
- const ngAddsToApply = packagesToInstall
126
- .map((packageName) => ({ packageName, ngAddCollection: getNgAddSchema(packageName, context) }))
127
- .filter(({ packageName, ngAddCollection }) => {
128
- if (!ngAddCollection) {
129
- context.logger.info(`No ng-add schematic found for: '${packageName}'. Skipping ng add for: ${packageName}${versions[packageName] ? ' with version: ' + versions[packageName] : ''}`);
130
- }
131
- return !!ngAddCollection;
132
- })
133
- .map(({ packageName, ngAddCollection }) => (0, schematics_1.externalSchematic)(packageName, 'ng-add', getOptions(ngAddCollection)));
134
- return (0, schematics_1.chain)(ngAddsToApply);
135
- }
136
- ]);
137
- }
138
- exports.ngAddPackages = ngAddPackages;
139
- /**
140
- * Look for the peer dependencies and run ng add on the package requested version
141
- * @param packages list of the name of the packages needed
142
- * @param packageJsonPath path to package json that needs the peer to be resolved
143
- * @param type how to install the dependency (dev, peer for a library or default for an application)
144
- * @param options
145
- * @param parentPackageInfo for logging purposes
146
- */
147
- function ngAddPeerDependencyPackages(packages, packageJsonPath, type = dependencies_1.NodeDependencyType.Default, options, parentPackageInfo) {
148
- if (!packages.length) {
149
- return schematics_1.noop;
150
- }
151
- const dependencies = (0, index_1.getNodeDependencyList)((0, index_1.getExternalDependenciesVersionRange)(packages, packageJsonPath), type);
152
- return ngAddPackages(dependencies.map(({ name }) => name), {
153
- ...options,
154
- skipConfirmation: true,
155
- version: dependencies.map(({ version }) => version),
156
- parentPackageInfo,
157
- dependencyType: type,
158
- workingDirectory: options.workingDirectory
159
- });
160
- }
161
- exports.ngAddPeerDependencyPackages = ngAddPeerDependencyPackages;
162
- /**
163
- * Register the given package in the Angular CLI schematics
164
- * @param packageJson PackageJson of the project containing the collection to add to the project
165
- * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
166
- */
167
- function registerPackageCollectionSchematics(packageJson, angularJsonFile) {
168
- return (tree, context) => {
169
- if (!packageJson.name) {
170
- return tree;
171
- }
172
- const workspace = (0, index_1.getWorkspaceConfig)(tree, angularJsonFile);
173
- if (!workspace) {
174
- context.logger.error('No workspace found');
175
- return tree;
176
- }
177
- return (0, index_1.writeAngularJson)(tree, (0, index_1.registerCollectionSchematics)(workspace, packageJson.name), angularJsonFile);
178
- };
179
- }
180
- exports.registerPackageCollectionSchematics = registerPackageCollectionSchematics;
181
- /**
182
- * Setup schematics default params in angular.json
183
- * @param schematicsDefaultParams default params to setup by schematic
184
- * @param overrideValue Define if the given value should override the one already defined in the workspace
185
- * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
186
- */
187
- function setupSchematicsDefaultParams(schematicsDefaultParams, overrideValue = false, angularJsonFile) {
188
- return (tree, context) => {
189
- const workspace = (0, index_1.getWorkspaceConfig)(tree, angularJsonFile);
190
- if (!workspace) {
191
- context.logger.error('No workspace found');
192
- return tree;
193
- }
194
- workspace.schematics ||= {};
195
- Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
196
- workspace.schematics[schematicName] = overrideValue ? {
197
- ...workspace.schematics[schematicName],
198
- ...defaultParams
199
- } : {
200
- ...defaultParams,
201
- ...workspace.schematics[schematicName]
202
- };
203
- });
204
- Object.values(workspace.projects).forEach((project) => {
205
- Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
206
- if (project.schematics?.[schematicName]) {
207
- project.schematics[schematicName] = overrideValue ? {
208
- ...project.schematics[schematicName],
209
- ...defaultParams
210
- } : {
211
- ...defaultParams,
212
- ...project.schematics[schematicName]
213
- };
214
- }
215
- });
216
- });
217
- return (0, index_1.writeAngularJson)(tree, workspace, angularJsonFile);
218
- };
219
- }
220
- exports.setupSchematicsDefaultParams = setupSchematicsDefaultParams;
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./schematics-register"), exports);
5
+ tslib_1.__exportStar(require("./dependencies"), exports);
6
+ tslib_1.__exportStar(require("./ng-add.helpers"), exports);
221
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAA+G;AAC/G,4DAA0E;AAC1E,2EAAmG;AACnG,qCAAiE;AACjE,kCAAkC;AAClC,+BAAqC;AAIrC,+CAAwL;AAExL;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA8F,EAAE,eAAe,GAAG,eAAe;IACjL,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,OAAO,iBAAI,CAAC;KACb;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAClD,wHAAwH;IACxH,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,gBAAgB,IAAI,CAAC,GAAG,CAAC,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,CAAC;qBACrC,CAAC;iBACH;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,wBAAgB,EAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAhCD,oEAgCC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,yDAA+B;AAC/B,2DAAiC"}
@@ -0,0 +1,22 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
3
+ import type { NgAddPackageOptions } from '../../tasks/index';
4
+ /**
5
+ * Install via `ng add` a list of npm packages.
6
+ * @param packages List of packages to be installed via `ng add`
7
+ * @param options install options
8
+ * @param packageJsonPath path of the package json of the project where they will be installed
9
+ */
10
+ export declare function ngAddPackages(packages: string[], options?: Omit<NgAddPackageOptions, 'version'> & {
11
+ version?: string | (string | undefined)[];
12
+ }, packageJsonPath?: string): Rule;
13
+ /**
14
+ * Look for the peer dependencies and run ng add on the package requested version
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 options
19
+ * @param parentPackageInfo for logging purposes
20
+ */
21
+ export declare function ngAddPeerDependencyPackages(packages: string[], packageJsonPath: string, type: NodeDependencyType | undefined, options: NgAddPackageOptions, parentPackageInfo?: string): Rule;
22
+ //# sourceMappingURL=ng-add.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-add.helpers.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAA+B,MAAM,4BAA4B,CAAC;AAG/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAK9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;CAAE,EAAE,eAAe,SAAkB,GAAG,IAAI,CA0HzL;AAED;;;;;;;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,QAgBzD"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAddPeerDependencyPackages = exports.ngAddPackages = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
+ const dependencies_1 = require("@schematics/angular/utility/dependencies");
7
+ const node_fs_1 = require("node:fs");
8
+ const path = require("node:path");
9
+ const rxjs_1 = require("rxjs");
10
+ const index_1 = require("../../utility/index");
11
+ /**
12
+ * Install via `ng add` a list of npm packages.
13
+ * @param packages List of packages to be installed via `ng add`
14
+ * @param options install options
15
+ * @param packageJsonPath path of the package json of the project where they will be installed
16
+ */
17
+ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
18
+ if (!packages.length) {
19
+ return schematics_1.noop;
20
+ }
21
+ const cwd = process.cwd().replace(/[\\/]+/g, '/');
22
+ // FileSystem working directory might be different from Tree working directory (when using `yarn workspace` for example)
23
+ const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
24
+ const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
25
+ if (options?.workingDirectory && !packageJsonPath.startsWith(options.workingDirectory)) {
26
+ packageJsonPath = path.join(options.workingDirectory, packageJsonPath);
27
+ }
28
+ const getInstalledVersion = (packageName) => {
29
+ let versionFound;
30
+ for (const workingDirectory of new Set([fsWorkingDirectory, '.'])) {
31
+ try {
32
+ const fileSystemPackageJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(workingDirectory, 'package.json'), { encoding: 'utf8' }));
33
+ let version;
34
+ if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
35
+ version = fileSystemPackageJson.devDependencies[packageName];
36
+ }
37
+ else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
38
+ version = fileSystemPackageJson.peerDependencies[packageName];
39
+ }
40
+ else {
41
+ version = fileSystemPackageJson.dependencies[packageName];
42
+ }
43
+ if (versionFound && version !== versionFound) {
44
+ // In case of conflict between package.json files, we consider the package as not installed to force its update
45
+ return;
46
+ }
47
+ versionFound = version;
48
+ }
49
+ catch (e) {
50
+ return;
51
+ }
52
+ }
53
+ return versionFound;
54
+ };
55
+ const getNgAddSchema = (packageName, context) => {
56
+ try {
57
+ const collection = context.engine.createCollection(packageName);
58
+ return collection.createSchematic('ng-add');
59
+ }
60
+ catch {
61
+ context.logger.warn(`No ng-add found for ${packageName}`);
62
+ return undefined;
63
+ }
64
+ };
65
+ const getOptions = (schema) => {
66
+ const schemaOptions = schema.description.schemaJson?.properties || {};
67
+ return Object.entries(options || {}).reduce((accOptions, [key, value]) => {
68
+ if (schemaOptions[key]) {
69
+ accOptions[key] = value;
70
+ }
71
+ return accOptions;
72
+ }, {});
73
+ };
74
+ const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
75
+ const packageManager = (0, index_1.getPackageManager)();
76
+ const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
77
+ if (packagesToInstall.length < 1) {
78
+ return schematics_1.noop;
79
+ }
80
+ return (0, schematics_1.chain)([
81
+ // Update package.json in tree
82
+ (tree) => {
83
+ const sortDependencies = (packageJson, depType) => {
84
+ packageJson[depType] = packageJson[depType] ?
85
+ Object.fromEntries(Object.entries(packageJson[depType] || {}).sort(([key1, _val1], [key2, _val2]) => key1.localeCompare(key2))) :
86
+ undefined;
87
+ };
88
+ for (const filePath of new Set([packageJsonPath, './package.json'])) {
89
+ const packageJson = tree.readJson(filePath);
90
+ packages.forEach((packageName) => {
91
+ const version = versions[packageName] || 'latest';
92
+ if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
93
+ packageJson.devDependencies = { ...packageJson.devDependencies, [packageName]: version };
94
+ }
95
+ else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
96
+ packageJson.peerDependencies = { ...packageJson.peerDependencies, [packageName]: version };
97
+ }
98
+ else {
99
+ packageJson.dependencies = { ...packageJson.dependencies, [packageName]: version };
100
+ }
101
+ });
102
+ ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {
103
+ sortDependencies(packageJson, depType);
104
+ });
105
+ tree.overwrite(filePath, JSON.stringify(packageJson, null, 2));
106
+ }
107
+ },
108
+ // Run ng-adds
109
+ async (tree, context) => {
110
+ if (options?.skipNgAddSchematicRun) {
111
+ context.logger.info(`Package(s) '${packagesToInstall.join(', ')}' was(were) installed.
112
+ The run of 'ng-add' schematics for the package(s) is intentionally skipped. You can do the run standalone, later.`);
113
+ return schematics_1.noop;
114
+ }
115
+ new Set([packageJsonPath, './package.json']).forEach((filePath) => {
116
+ (0, node_fs_1.mkdirSync)(path.join(process.cwd(), path.dirname(filePath)), { recursive: true });
117
+ (0, node_fs_1.writeFileSync)(path.join(process.cwd(), filePath), tree.readText(filePath));
118
+ });
119
+ context.addTask(new tasks_1.NodePackageInstallTask({
120
+ packageManager: packageManager,
121
+ hideOutput: false,
122
+ quiet: false
123
+ }));
124
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
125
+ const ngAddsToApply = packagesToInstall
126
+ .map((packageName) => ({ packageName, ngAddCollection: getNgAddSchema(packageName, context) }))
127
+ .filter(({ packageName, ngAddCollection }) => {
128
+ if (!ngAddCollection) {
129
+ context.logger.info(`No ng-add schematic found for: '${packageName}'. Skipping ng add for: ${packageName}${versions[packageName] ? ' with version: ' + versions[packageName] : ''}`);
130
+ }
131
+ return !!ngAddCollection;
132
+ })
133
+ .map(({ packageName, ngAddCollection }) => (0, schematics_1.externalSchematic)(packageName, 'ng-add', getOptions(ngAddCollection)));
134
+ return (0, schematics_1.chain)(ngAddsToApply);
135
+ }
136
+ ]);
137
+ }
138
+ exports.ngAddPackages = ngAddPackages;
139
+ /**
140
+ * Look for the peer dependencies and run ng add on the package requested version
141
+ * @param packages list of the name of the packages needed
142
+ * @param packageJsonPath path to package json that needs the peer to be resolved
143
+ * @param type how to install the dependency (dev, peer for a library or default for an application)
144
+ * @param options
145
+ * @param parentPackageInfo for logging purposes
146
+ */
147
+ function ngAddPeerDependencyPackages(packages, packageJsonPath, type = dependencies_1.NodeDependencyType.Default, options, parentPackageInfo) {
148
+ if (!packages.length) {
149
+ return schematics_1.noop;
150
+ }
151
+ const dependencies = (0, index_1.getNodeDependencyList)((0, index_1.getExternalDependenciesVersionRange)(packages, packageJsonPath), type);
152
+ return ngAddPackages(dependencies.map(({ name }) => name), {
153
+ ...options,
154
+ skipConfirmation: true,
155
+ version: dependencies.map(({ version }) => version),
156
+ parentPackageInfo,
157
+ dependencyType: type,
158
+ workingDirectory: options.workingDirectory
159
+ });
160
+ }
161
+ exports.ngAddPeerDependencyPackages = ngAddPeerDependencyPackages;
162
+ //# sourceMappingURL=ng-add.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-add.helpers.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":";;;AAAA,2DAA+G;AAC/G,4DAA0E;AAE1E,2EAA8E;AAC9E,qCAAiE;AACjE,kCAAkC;AAClC,+BAAqC;AAGrC,+CAAoH;AAEpH;;;;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L,CAAC;AAjBD,kEAiBC"}
@@ -0,0 +1,17 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ import type { PackageJson } from 'type-fest';
3
+ import type { SchematicOptionObject } from '../../interfaces/index';
4
+ /**
5
+ * Register the given package in the Angular CLI schematics
6
+ * @param packageJson PackageJson of the project containing the collection to add to the project
7
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
8
+ */
9
+ export declare function registerPackageCollectionSchematics(packageJson: PackageJson, angularJsonFile?: string): Rule;
10
+ /**
11
+ * Setup schematics default params in angular.json
12
+ * @param schematicsDefaultParams default params to setup by schematic
13
+ * @param overrideValue Define if the given value should override the one already defined in the workspace
14
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
15
+ */
16
+ export declare function setupSchematicsDefaultParams(schematicsDefaultParams: Record<string, SchematicOptionObject>, overrideValue?: boolean, angularJsonFile?: string): Rule;
17
+ //# sourceMappingURL=schematics-register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schematics-register.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/schematics-register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIpE;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAY5G;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,aAAa,UAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAgClK"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupSchematicsDefaultParams = exports.registerPackageCollectionSchematics = void 0;
4
+ const utility_1 = require("../../utility");
5
+ /**
6
+ * Register the given package in the Angular CLI schematics
7
+ * @param packageJson PackageJson of the project containing the collection to add to the project
8
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
9
+ */
10
+ function registerPackageCollectionSchematics(packageJson, angularJsonFile) {
11
+ return (tree, context) => {
12
+ if (!packageJson.name) {
13
+ return tree;
14
+ }
15
+ const workspace = (0, utility_1.getWorkspaceConfig)(tree, angularJsonFile);
16
+ if (!workspace) {
17
+ context.logger.error('No workspace found');
18
+ return tree;
19
+ }
20
+ return (0, utility_1.writeAngularJson)(tree, (0, utility_1.registerCollectionSchematics)(workspace, packageJson.name), angularJsonFile);
21
+ };
22
+ }
23
+ exports.registerPackageCollectionSchematics = registerPackageCollectionSchematics;
24
+ /**
25
+ * Setup schematics default params in angular.json
26
+ * @param schematicsDefaultParams default params to setup by schematic
27
+ * @param overrideValue Define if the given value should override the one already defined in the workspace
28
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
29
+ */
30
+ function setupSchematicsDefaultParams(schematicsDefaultParams, overrideValue = false, angularJsonFile) {
31
+ return (tree, context) => {
32
+ const workspace = (0, utility_1.getWorkspaceConfig)(tree, angularJsonFile);
33
+ if (!workspace) {
34
+ context.logger.error('No workspace found');
35
+ return tree;
36
+ }
37
+ workspace.schematics ||= {};
38
+ Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
39
+ workspace.schematics[schematicName] = overrideValue ? {
40
+ ...workspace.schematics[schematicName],
41
+ ...defaultParams
42
+ } : {
43
+ ...defaultParams,
44
+ ...workspace.schematics[schematicName]
45
+ };
46
+ });
47
+ Object.values(workspace.projects).forEach((project) => {
48
+ Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
49
+ if (project.schematics?.[schematicName]) {
50
+ project.schematics[schematicName] = overrideValue ? {
51
+ ...project.schematics[schematicName],
52
+ ...defaultParams
53
+ } : {
54
+ ...defaultParams,
55
+ ...project.schematics[schematicName]
56
+ };
57
+ }
58
+ });
59
+ });
60
+ return (0, utility_1.writeAngularJson)(tree, workspace, angularJsonFile);
61
+ };
62
+ }
63
+ exports.setupSchematicsDefaultParams = setupSchematicsDefaultParams;
64
+ //# sourceMappingURL=schematics-register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schematics-register.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/schematics-register.ts"],"names":[],"mappings":";;;AAGA,2CAAmG;AAGnG;;;;GAIG;AACH,SAAgB,mCAAmC,CAAC,WAAwB,EAAE,eAAwB;IACpG,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,SAAS,GAAG,IAAA,4BAAkB,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAA,0BAAgB,EAAC,IAAI,EAAE,IAAA,sCAA4B,EAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CAAC;IAC5G,CAAC,CAAC;AACJ,CAAC;AAZD,kFAYC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,uBAA8D,EAAE,aAAa,GAAG,KAAK,EAAE,eAAwB;IAC1J,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,SAAS,GAAG,IAAA,4BAAkB,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAA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ories/remove-packages/index.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,SAAgB,cAAc,CAAC,gBAA0B,EAAE,eAAe,GAAG,eAAe;IAC1F,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,MAAM,UAAU,GAAG,CAAC,MAA0C,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,CAA+B,EAAE,EAAE;YACnH,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBACrC,GAAG,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;aACvB;YACD,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;YAChC,MAAM,WAAW,GAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEpF,WAAW,CAAC,YAAY,KAAK,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAC7F,WAAW,CAAC,eAAe,KAAK,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACnG,WAAW,CAAC,gBAAgB,KAAK,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAErG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;SACvE;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAtBD,wCAsBC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/remove-packages/index.ts"],"names":[],"m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AAC;gBACH,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAnBD,8CAmBC"}
1
+ {"version":3,"file":"update-imports-with-scope.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-imports-with-scope.ts"],"names":[],"mappings":";;;AACA,+CAAyG;AACzG,iDAAiF;AAEjF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,6CAA6C,EAAE,IAAI,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,cAAc,GAAG,cAAc,EAAE,kBAA8C,oCAAqB,EAAE,QAAQ,GAAG,KAAK;IACrK,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,qCAA6B,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAA,2CAAmC,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzH,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,EAAE,CAAC;YAC1C,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC3D,OAAO,GAAG,SAAS,cAAc,QAAQ,KAAK,MAAM,qBAAqB,EAAE,CAAC;gBAC5E,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,wBAAwB,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,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AAa,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACzE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,aAAa,0BAA0B,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAkC,CAAC;YACjF,UAAU,CAAC,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,eAAe,IAAI,EAAE,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YAC9G,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,aAAa,0BAA0B,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,wBAAwB,4BAenC"}
@@ -1,8 +1,12 @@
1
- import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ import { type SupportedPackageManagers } from '../utility/package-manager-runner';
2
3
  /**
3
4
  * Install the Otter packages
4
- * @param tree
5
- * @param context
5
+ * @deprecated use {@link setupDependencies} instead, will be removed in V11
6
+ * @param options
7
+ * @param options.packageManager
6
8
  */
7
- export declare function install(tree: Tree, context: SchematicContext): Promise<Rule>;
9
+ export declare function install(options?: {
10
+ packageManager?: SupportedPackageManagers;
11
+ }): Rule;
8
12
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/rules/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAK/E;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlF"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/rules/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EAAqB,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAErG;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE;IAAC,cAAc,CAAC,EAAE,wBAAwB,CAAA;CAAC,GAAG,IAAI,CAOnF"}
@@ -6,15 +6,17 @@ const rxjs_1 = require("rxjs");
6
6
  const package_manager_runner_1 = require("../utility/package-manager-runner");
7
7
  /**
8
8
  * Install the Otter packages
9
- * @param tree
10
- * @param context
9
+ * @deprecated use {@link setupDependencies} instead, will be removed in V11
10
+ * @param options
11
+ * @param options.packageManager
11
12
  */
12
- async function install(tree, context) {
13
- const packageManager = (0, package_manager_runner_1.getPackageManager)();
14
- context.logger.info('Running application install');
15
- context.addTask(new tasks_1.NodePackageInstallTask({ packageManager }));
16
- await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
17
- return () => tree;
13
+ function install(options) {
14
+ return async (_, context) => {
15
+ const packageManager = options?.packageManager || (0, package_manager_runner_1.getPackageManager)();
16
+ context.logger.info('Running application install');
17
+ context.addTask(new tasks_1.NodePackageInstallTask({ packageManager }));
18
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
19
+ };
18
20
  }
19
21
  exports.install = install;
20
22
  //# sourceMappingURL=install.js.map