@o3r/schematics 9.3.0-alpha.8 → 9.4.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/package.json +23 -18
  2. package/src/cli/environment.d.ts +2 -0
  3. package/src/cli/environment.d.ts.map +1 -0
  4. package/src/cli/environment.js +5 -0
  5. package/src/cli/environment.js.map +1 -0
  6. package/src/interfaces/angular-workspace.d.ts +16 -14
  7. package/src/interfaces/angular-workspace.d.ts.map +1 -1
  8. package/src/modules/modules.constants.d.ts +6 -2
  9. package/src/modules/modules.constants.d.ts.map +1 -1
  10. package/src/modules/modules.constants.js +5 -3
  11. package/src/modules/modules.constants.js.map +1 -1
  12. package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
  13. package/src/rule-factories/check-packages-peers/index.js +4 -4
  14. package/src/rule-factories/check-packages-peers/index.js.map +1 -1
  15. package/src/rule-factories/dev-tools/devtools-registration.d.ts +20 -0
  16. package/src/rule-factories/dev-tools/devtools-registration.d.ts.map +1 -0
  17. package/src/rule-factories/dev-tools/devtools-registration.js +50 -0
  18. package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -0
  19. package/src/rule-factories/dev-tools/index.d.ts +2 -0
  20. package/src/rule-factories/dev-tools/index.d.ts.map +1 -0
  21. package/src/rule-factories/dev-tools/index.js +5 -0
  22. package/src/rule-factories/dev-tools/index.js.map +1 -0
  23. package/src/rule-factories/index.d.ts +1 -0
  24. package/src/rule-factories/index.d.ts.map +1 -1
  25. package/src/rule-factories/index.js +1 -0
  26. package/src/rule-factories/index.js.map +1 -1
  27. package/src/rule-factories/ng-add/index.d.ts +3 -6
  28. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  29. package/src/rule-factories/ng-add/index.js +107 -83
  30. package/src/rule-factories/ng-add/index.js.map +1 -1
  31. package/src/utility/collection.d.ts +2 -5
  32. package/src/utility/collection.d.ts.map +1 -1
  33. package/src/utility/collection.js +11 -9
  34. package/src/utility/collection.js.map +1 -1
  35. package/src/utility/component.d.ts.map +1 -1
  36. package/src/utility/component.js +4 -3
  37. package/src/utility/component.js.map +1 -1
  38. package/src/utility/environment.d.ts +27 -0
  39. package/src/utility/environment.d.ts.map +1 -0
  40. package/src/utility/environment.js +51 -0
  41. package/src/utility/environment.js.map +1 -0
  42. package/src/utility/error.d.ts +7 -0
  43. package/src/utility/error.d.ts.map +1 -0
  44. package/src/utility/error.js +17 -0
  45. package/src/utility/error.js.map +1 -0
  46. package/src/utility/generation.d.ts +0 -1
  47. package/src/utility/generation.d.ts.map +1 -1
  48. package/src/utility/generation.js +7 -11
  49. package/src/utility/generation.js.map +1 -1
  50. package/src/utility/index.d.ts +9 -7
  51. package/src/utility/index.d.ts.map +1 -1
  52. package/src/utility/index.js +9 -7
  53. package/src/utility/index.js.map +1 -1
  54. package/src/utility/loaders.d.ts +19 -17
  55. package/src/utility/loaders.d.ts.map +1 -1
  56. package/src/utility/loaders.js +38 -18
  57. package/src/utility/loaders.js.map +1 -1
  58. package/src/utility/modules.d.ts +2 -7
  59. package/src/utility/modules.d.ts.map +1 -1
  60. package/src/utility/modules.js +5 -10
  61. package/src/utility/modules.js.map +1 -1
  62. package/src/utility/monorepo.d.ts +6 -0
  63. package/src/utility/monorepo.d.ts.map +1 -1
  64. package/src/utility/monorepo.js +12 -1
  65. package/src/utility/monorepo.js.map +1 -1
  66. package/src/utility/package-manager-runner.d.ts +16 -1
  67. package/src/utility/package-manager-runner.d.ts.map +1 -1
  68. package/src/utility/package-manager-runner.js +39 -1
  69. package/src/utility/package-manager-runner.js.map +1 -1
@@ -4,13 +4,12 @@ exports.setupSchematicsDefaultParams = exports.registerPackageCollectionSchemati
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const dependencies_1 = require("@schematics/angular/utility/dependencies");
7
- const rxjs_1 = require("rxjs");
8
- const index_1 = require("../../utility/index");
9
7
  const node_fs_1 = require("node:fs");
10
8
  const path = require("node:path");
9
+ const rxjs_1 = require("rxjs");
10
+ const index_1 = require("../../utility/index");
11
11
  /**
12
12
  * Install via `ng add` a list of npm packages.
13
- *
14
13
  * @param packages List of packages to be installed via `ng add`
15
14
  * @param options install options
16
15
  * @param packageJsonPath path of the package json of the project where they will be installed
@@ -20,28 +19,38 @@ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
20
19
  return schematics_1.noop;
21
20
  }
22
21
  const cwd = process.cwd().replace(/[\\/]+/g, '/');
23
- // FileSystem working directory might be different than Tree working directory (when using `yarn workspace` for example)
22
+ // FileSystem working directory might be different from Tree working directory (when using `yarn workspace` for example)
24
23
  const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
25
24
  const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
26
25
  if (options?.workingDirectory && !packageJsonPath.startsWith(options.workingDirectory)) {
27
26
  packageJsonPath = path.join(options.workingDirectory, packageJsonPath);
28
27
  }
29
28
  const getInstalledVersion = (packageName) => {
30
- try {
31
- const fileSystemPackageJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(fsWorkingDirectory, 'package.json'), { encoding: 'utf8' }));
32
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
33
- return fileSystemPackageJson.devDependencies[packageName];
34
- }
35
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
36
- return fileSystemPackageJson.peerDependencies[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;
37
48
  }
38
- else {
39
- return fileSystemPackageJson.dependencies[packageName];
49
+ catch (e) {
50
+ return;
40
51
  }
41
52
  }
42
- catch (e) {
43
- return;
44
- }
53
+ return versionFound;
45
54
  };
46
55
  const getNgAddSchema = (packageName, context) => {
47
56
  try {
@@ -62,71 +71,73 @@ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
62
71
  return accOptions;
63
72
  }, {});
64
73
  };
65
- return async (tree, context) => {
66
- const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
67
- const packageManager = (0, index_1.getPackageManager)();
68
- let installOptions = '';
69
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev && packageManager === 'yarn') {
70
- installOptions = ' --prefer-dev';
71
- }
72
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
73
- installOptions = ' -D';
74
- }
75
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
76
- installOptions = ' -P';
77
- }
78
- const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
79
- if (packagesToInstall.length < 1) {
80
- return schematics_1.noop;
81
- }
82
- const packagesInput = packagesToInstall
83
- .map((packageName) => `${packageName}${versions[packageName] ? `@${versions[packageName]}` : ''}`)
84
- .join(' ');
85
- const workingDirectory = options?.workingDirectory || path.dirname(packageJsonPath);
86
- context.addTask(new tasks_1.NodePackageInstallTask({
87
- packageManager: packageManager,
88
- packageName: `${packagesInput}${installOptions}`,
89
- workingDirectory,
90
- hideOutput: false,
91
- quiet: false
92
- }));
93
- await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
94
- // We need to update manually the package json in the tree as the tree will overwrite the project at the end of the ng add @o3r/core
95
- const latestInstalledVersions = packagesToInstall.map((packageName) => [packageName, getInstalledVersion(packageName)]);
96
- const packageJson = tree.readJson(packageJsonPath);
97
- latestInstalledVersions.forEach(([packageName, latestInstalledVersion]) => {
98
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
99
- packageJson.devDependencies = { ...packageJson.devDependencies, [packageName]: latestInstalledVersion };
100
- }
101
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
102
- packageJson.peerDependencies = { ...packageJson.peerDependencies, [packageName]: latestInstalledVersion };
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));
103
106
  }
104
- else {
105
- packageJson.dependencies = { ...packageJson.dependencies, [packageName]: latestInstalledVersion };
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;
106
114
  }
107
- });
108
- tree.overwrite(packageJsonPath, JSON.stringify(packageJson, null, 2));
109
- if (options?.skipNgAddSchematicRun) {
110
- context.logger.info(`Package(s) '${packagesToInstall.join(', ')}' was(were) installed.
111
- The run of 'ng-add' schematics for the package(s) is intentionally skipped. You can do the run standalone, later.`);
112
- return schematics_1.noop;
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);
113
135
  }
114
- const ngAddsToApply = packagesToInstall
115
- .map((packageName) => ({ packageName, ngAddCollection: getNgAddSchema(packageName, context) }))
116
- .filter(({ packageName, ngAddCollection }) => {
117
- if (!ngAddCollection) {
118
- context.logger.info(`No ng-add schematic found for: '${packageName}'. Skipping ng add for: ${packageName}${versions[packageName] ? ' with version: ' + versions[packageName] : ''}`);
119
- }
120
- return !!ngAddCollection;
121
- })
122
- .map(({ packageName, ngAddCollection }) => (0, schematics_1.externalSchematic)(packageName, 'ng-add', getOptions(ngAddCollection)));
123
- return (0, schematics_1.chain)(ngAddsToApply);
124
- };
136
+ ]);
125
137
  }
126
138
  exports.ngAddPackages = ngAddPackages;
127
139
  /**
128
140
  * Look for the peer dependencies and run ng add on the package requested version
129
- *
130
141
  * @param packages list of the name of the packages needed
131
142
  * @param packageJsonPath path to package json that needs the peer to be resolved
132
143
  * @param type how to install the dependency (dev, peer for a library or default for an application)
@@ -150,42 +161,55 @@ function ngAddPeerDependencyPackages(packages, packageJsonPath, type = dependenc
150
161
  exports.ngAddPeerDependencyPackages = ngAddPeerDependencyPackages;
151
162
  /**
152
163
  * Register the given package in the Angular CLI schematics
153
- *
154
164
  * @param packageJson PackageJson of the project containing the collection to add to the project
155
165
  * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
156
166
  */
157
167
  function registerPackageCollectionSchematics(packageJson, angularJsonFile) {
158
- return (tree) => {
168
+ return (tree, context) => {
159
169
  if (!packageJson.name) {
160
170
  return tree;
161
171
  }
162
- const workspace = (0, index_1.readAngularJson)(tree, angularJsonFile);
172
+ const workspace = (0, index_1.getWorkspaceConfig)(tree, angularJsonFile);
173
+ if (!workspace) {
174
+ context.logger.error('No workspace found');
175
+ return tree;
176
+ }
163
177
  return (0, index_1.writeAngularJson)(tree, (0, index_1.registerCollectionSchematics)(workspace, packageJson.name), angularJsonFile);
164
178
  };
165
179
  }
166
180
  exports.registerPackageCollectionSchematics = registerPackageCollectionSchematics;
167
181
  /**
168
182
  * Setup schematics default params in angular.json
169
- *
170
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
171
185
  * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
172
186
  */
173
- function setupSchematicsDefaultParams(schematicsDefaultParams, angularJsonFile) {
174
- return (tree) => {
175
- const workspace = (0, index_1.readAngularJson)(tree, angularJsonFile);
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
+ }
176
194
  workspace.schematics ||= {};
177
195
  Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
178
- workspace.schematics[schematicName] = {
196
+ workspace.schematics[schematicName] = overrideValue ? {
179
197
  ...workspace.schematics[schematicName],
180
198
  ...defaultParams
199
+ } : {
200
+ ...defaultParams,
201
+ ...workspace.schematics[schematicName]
181
202
  };
182
203
  });
183
204
  Object.values(workspace.projects).forEach((project) => {
184
205
  Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
185
206
  if (project.schematics?.[schematicName]) {
186
- project.schematics[schematicName] = {
207
+ project.schematics[schematicName] = overrideValue ? {
187
208
  ...project.schematics[schematicName],
188
209
  ...defaultParams
210
+ } : {
211
+ ...defaultParams,
212
+ ...project.schematics[schematicName]
189
213
  };
190
214
  }
191
215
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqH;AACrH,4DAA0E;AAE1E,2EAA8E;AAC9E,+BAAqC;AAIrC,+CAAqL;AACrL,qCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA8E,EAAE,eAAe,GAAG,eAAe;IACjK,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,OAAO,iBAAI,CAAC;KACb;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAA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AAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,EAAE;YACjF,SAAS,CAAC,UAAW,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;gBACrD,GAAG,SAAS,CAAC,UAAW,CAAC,aAAa,CAAC;gBACvC,GAAG,aAAa;aACjB,CAAC,CAAC,CAAC;gBACF,GAAG,aAAa;gBAChB,GAAG,SAAS,CAAC,UAAW,CAAC,aAAa,CAAC;aACxC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,EAAE;gBACjF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,EAAE;oBACvC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;wBAClD,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;wBACpC,GAAG,aAAa;qBACjB,CAAC,CAAC,CAAC;wBACF,GAAG,aAAa;wBAChB,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,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"}
@@ -2,7 +2,6 @@ import { SchematicContext } from '@angular-devkit/schematics';
2
2
  import type { WorkspaceSchema, WorkspaceSchematics } from '../interfaces';
3
3
  /**
4
4
  * Register the collection schematic to the workspace
5
- *
6
5
  * @param workspace Workspace to add the collection to
7
6
  * @param collection Collection to add to the workspace schematic collection
8
7
  * @returns the updated workspace
@@ -11,20 +10,18 @@ export declare function registerCollectionSchematics(workspace: WorkspaceSchema,
11
10
  /**
12
11
  * Get default options for a schematic
13
12
  * This will look inside angular.json file for schematics with keys containing wildcards like `*:ng-add` or `@o3r/core:*`
14
- *
15
13
  * @param workspace
16
14
  * @param collection
17
15
  * @param schematicName
18
16
  * @param options
19
17
  * @param options.projectName
20
18
  */
21
- export declare function getDefaultOptionsForSchematic(workspace: WorkspaceSchema | null, collection: string, schematicName: string, options: {
19
+ export declare function getDefaultOptionsForSchematic<T extends WorkspaceSchematics['*:*'] = WorkspaceSchematics['*:*']>(workspace: WorkspaceSchema | null, collection: string, schematicName: string, options?: {
22
20
  projectName?: string | undefined;
23
- }): Record<string, string>;
21
+ }): T;
24
22
  /**
25
23
  * Retrieves the schematics options of a given schematics name
26
24
  * If the schematics name is not found, then the generic options (*:*) will be returned. If the latter is not present the function returns undefined
27
- *
28
25
  * @param config
29
26
  * @param context
30
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/utility/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAO5G;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,0BAcxK;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAUxK"}
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/utility/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE1E;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAO5G;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC1C,CAAC,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,CAAC,CAmBrM;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAUxK"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSchematicOptions = exports.getDefaultOptionsForSchematic = exports.registerCollectionSchematics = void 0;
4
4
  /**
5
5
  * Register the collection schematic to the workspace
6
- *
7
6
  * @param workspace Workspace to add the collection to
8
7
  * @param collection Collection to add to the workspace schematic collection
9
8
  * @returns the updated workspace
@@ -20,7 +19,6 @@ exports.registerCollectionSchematics = registerCollectionSchematics;
20
19
  /**
21
20
  * Get default options for a schematic
22
21
  * This will look inside angular.json file for schematics with keys containing wildcards like `*:ng-add` or `@o3r/core:*`
23
- *
24
22
  * @param workspace
25
23
  * @param collection
26
24
  * @param schematicName
@@ -33,19 +31,23 @@ function getDefaultOptionsForSchematic(workspace, collection, schematicName, opt
33
31
  }
34
32
  const schematicsDefaultParams = [
35
33
  workspace.schematics,
36
- ...options.projectName ? [workspace.projects[options.projectName]?.schematics] : []
34
+ ...options?.projectName ? [workspace.projects[options.projectName]?.schematics] : []
37
35
  ];
38
- return schematicsDefaultParams.flatMap((schematics) => schematics ?
39
- Object.entries(schematics)
40
- .filter(([key, _]) => key === `*:${schematicName}` || key === `${collection}:*`)
41
- .map(([_, value]) => value) :
42
- []).reduce((out, defaultParams) => ({ ...out, ...defaultParams }), {});
36
+ return schematicsDefaultParams.reduce((acc, schematics) => {
37
+ if (!schematics) {
38
+ return acc;
39
+ }
40
+ return Object.entries(schematics)
41
+ .filter(([key, _]) => key === `*:${schematicName}` || key === `${collection}:*` || key === `${collection}:${schematicName}`)
42
+ .sort(([a], [b]) => (a.match(/\*/g)?.length || 0) - (b.match(/\*/g)?.length || 0))
43
+ .map(([_, value]) => value)
44
+ .reduce((config, value) => ({ ...config, ...value }), acc);
45
+ }, {});
43
46
  }
44
47
  exports.getDefaultOptionsForSchematic = getDefaultOptionsForSchematic;
45
48
  /**
46
49
  * Retrieves the schematics options of a given schematics name
47
50
  * If the schematics name is not found, then the generic options (*:*) will be returned. If the latter is not present the function returns undefined
48
- *
49
51
  * @param config
50
52
  * @param context
51
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/utility/collection.ts"],"names":[],"mappings":";;;AAGA;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,SAA0B,EAAE,UAAkB;IACzF,SAAS,CAAC,GAAG,KAAK,EAAE,CAAC;IACrB,SAAS,CAAC,GAAG,CAAC,oBAAoB,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC/D,IAAI,CAAC,SAAS,CAAC,G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C,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;AACvF,CAAC;AAVD,kDAUC"}
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAA6D,MAAM,OAAO,CAAC;AAEpG;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SAAU,OAAO,6BAEsB,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,SAAU,OAAO,6BAEwB,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,qBAAsB,GAAG,gBAAgB,YAAwE,CAAC;AAEjJ;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,qBAAsB,GAAG,gBAAgB,YAEA,CAAC;AAE1E,eAAO,MAAM,iCAAiC,wBAA0G,CAAC;AAEzJ,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,aAAa,EAAE,MAAM;CAOlC;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,SAAU,IAAI,iBAAiB,MAAM;;;;;CA4DrF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kDAAkD,YACpD,MAAM,EAAE,KAChB,GAAG,kBAAkB,CAAC,OAAO,CA4B/B,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAA6D,MAAM,OAAO,CAAC;AAGpG;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SAAU,OAAO,6BAEsB,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,SAAU,OAAO,6BAEwB,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,qBAAsB,GAAG,gBAAgB,YAAwE,CAAC;AAEjJ;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,qBAAsB,GAAG,gBAAgB,YAEA,CAAC;AAE1E,eAAO,MAAM,iCAAiC,wBAA0G,CAAC;AAEzJ,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,aAAa,EAAE,MAAM;CAOlC;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,SAAU,IAAI,iBAAiB,MAAM;;;;;CA4DrF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kDAAkD,YACpD,MAAM,EAAE,KAChB,GAAG,kBAAkB,CAAC,OAAO,CA4B/B,CAAC"}
@@ -4,6 +4,7 @@ exports.addImportsIntoComponentDecoratorTransformerFactory = exports.getO3rCompo
4
4
  const prompt_1 = require("@angular/cli/src/utilities/prompt");
5
5
  const ts = require("typescript");
6
6
  const ast_1 = require("./ast");
7
+ const error_1 = require("./error");
7
8
  /**
8
9
  * Returns true if `node` is the decorator of an Angular component
9
10
  *
@@ -57,21 +58,21 @@ const getO3rComponentInfoOrThrowIfNotFound = (tree, componentPath) => {
57
58
  const sourceFile = ts.createSourceFile(componentPath, tree.readText(componentPath), ts.ScriptTarget.ES2020, true);
58
59
  const ngComponentDeclaration = sourceFile.statements.find((s) => ts.isClassDeclaration(s) && (0, exports.isNgClassComponent)(s));
59
60
  if (!ngComponentDeclaration) {
60
- throw new Error(`No Angular component found in ${componentPath}.`);
61
+ throw new error_1.O3rCliError(`No Angular component found in ${componentPath}.`);
61
62
  }
62
63
  if (!(0, exports.isO3rClassComponent)(ngComponentDeclaration)) {
63
64
  throw new NoOtterComponent(componentPath);
64
65
  }
65
66
  const name = ngComponentDeclaration.name?.escapedText.toString().replace(/Component$/, '');
66
67
  if (!name) {
67
- throw new Error(`The class' name is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
68
+ throw new error_1.O3rCliError(`The class' name is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
68
69
  }
69
70
  const selectorExpression = (0, ast_1.getPropertyFromDecoratorFirstArgument)(ts.getDecorators(ngComponentDeclaration)?.find(exports.isNgClassDecorator), 'selector');
70
71
  const selector = selectorExpression && ts.isStringLiteral(selectorExpression)
71
72
  ? selectorExpression.text
72
73
  : selectorExpression?.getText();
73
74
  if (!selector) {
74
- throw new Error(`The component's selector is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
75
+ throw new error_1.O3rCliError(`The component's selector is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
75
76
  }
76
77
  const standaloneExpression = (0, ast_1.getPropertyFromDecoratorFirstArgument)(ts.getDecorators(ngComponentDeclaration)?.find(exports.isNgClassDecorator), 'standalone');
77
78
  const standalone = standaloneExpression?.kind === ts.SyntaxKind.TrueKeyword;
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":";;;AACA,8DAAoE;AACpE,iCAAiC;AACjC,+BAAoG;AAEpG;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAA4B,EAAE,CAC5E,IAAA,wBAAkB,EAAC,IAAI,CAAC;OACrB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,WAAW,CAAC;AAF1D,QAAA,kBAAkB,sBAEwC;AAEvE;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAa,EAA4B,EAAE,CAC7E,IAAA,wBAAkB,EAAC,IAAI,CAAC;OACrB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,cAAc,CAAC;AAF7D,QAAA,mBAAmB,uBAE0C;AAE1E;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,gBAAqC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,g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+ * Could be useful for debugging issue
4
+ */
5
+ export declare const getEnvironmentInfo: () => {
6
+ os: {
7
+ architecture: string;
8
+ platform: NodeJS.Platform;
9
+ version: string;
10
+ };
11
+ node: {
12
+ version: string | null;
13
+ };
14
+ packageManager: {
15
+ name: import("./package-manager-runner").SupportedPackageManagers;
16
+ version: string | undefined;
17
+ };
18
+ otter: {
19
+ version: string | undefined;
20
+ };
21
+ };
22
+ /**
23
+ * Stringify the result of `getEnvironmentInfo`
24
+ * @see getEnvironmentInfo
25
+ */
26
+ export declare const getEnvironmentInfoStringify: () => string;
27
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/utility/environment.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAmB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,cAWvC,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEnvironmentInfoStringify = exports.getEnvironmentInfo = void 0;
4
+ const fs = require("node:fs");
5
+ const os = require("node:os");
6
+ const semver = require("semver");
7
+ const package_manager_runner_1 = require("./package-manager-runner");
8
+ /**
9
+ * Get all environment information
10
+ * Could be useful for debugging issue
11
+ */
12
+ const getEnvironmentInfo = () => {
13
+ const nodeVersion = semver.parse(process.version);
14
+ const osInfo = {
15
+ architecture: os.arch(),
16
+ platform: os.platform(),
17
+ version: os.release()
18
+ };
19
+ const nodeInfo = {
20
+ version: nodeVersion && `${nodeVersion.major}.${nodeVersion.minor}.${nodeVersion.patch}`
21
+ };
22
+ const packageManagerInfo = (0, package_manager_runner_1.getPackageManagerInfo)();
23
+ let otterCorePackageJsonPath;
24
+ try {
25
+ otterCorePackageJsonPath = require.resolve('@o3r/core/package.json');
26
+ }
27
+ catch { }
28
+ const otterInfo = {
29
+ version: otterCorePackageJsonPath ? JSON.parse(fs.readFileSync(otterCorePackageJsonPath, { encoding: 'utf-8' })).version : undefined
30
+ };
31
+ return { os: osInfo, node: nodeInfo, packageManager: packageManagerInfo, otter: otterInfo };
32
+ };
33
+ exports.getEnvironmentInfo = getEnvironmentInfo;
34
+ /**
35
+ * Stringify the result of `getEnvironmentInfo`
36
+ * @see getEnvironmentInfo
37
+ */
38
+ const getEnvironmentInfoStringify = () => {
39
+ const { os: osInfo, node: nodeInfo, packageManager: packageManagerInfo, otter: otterInfo } = (0, exports.getEnvironmentInfo)();
40
+ return `
41
+ - User Agent Architecture: ${osInfo.architecture}
42
+ - User Agent Platform: ${osInfo.platform}
43
+ - User Agent Version: ${osInfo.version}
44
+ - Node Version: ${nodeInfo.version || 'undefined'}
45
+ - Package Manager Name: ${packageManagerInfo.name}
46
+ - Package Manager Version: ${packageManagerInfo.version || 'undefined'}
47
+ - Otter Version: ${otterInfo.version || 'undefined'}
48
+ `;
49
+ };
50
+ exports.getEnvironmentInfoStringify = getEnvironmentInfoStringify;
51
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/utility/environment.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,8BAA8B;AAC9B,iCAAiC;AACjC,qEAAiE;AAEjE;;;GAGG;AACI,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG;QACb,YAAY,EAAE,EAAE,CAAC,IAAI,EAAE;QACvB,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;QACvB,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE;KACtB,CAAC;IACF,MAAM,QAAQ,GAAG;QACf,OAAO,EAAE,WAAW,IAAI,GAAG,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE;KACzF,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,8CAAqB,GAAE,CAAC;IACnD,IAAI,wBAA4C,CAAC;IACjD,IAAI;QACF,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;KACtE;IAAC,MAAM,GAAE;IACV,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAiB,CAAC,CAAC,CAAC,SAAS;KAC/I,CAAC;IACF,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9F,CAAC,CAAC;AAnBW,QAAA,kBAAkB,sBAmB7B;AAEF;;;GAGG;AACI,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAA,0BAAkB,GAAE,CAAC;IAClH,OAAO;6BACoB,MAAM,CAAC,YAAY;yBACvB,MAAM,CAAC,QAAQ;wBAChB,MAAM,CAAC,OAAO;kBACpB,QAAQ,CAAC,OAAO,IAAI,WAAW;0BACvB,kBAAkB,CAAC,IAAI;6BACpB,kBAAkB,CAAC,OAAO,IAAI,WAAW;mBACnD,SAAS,CAAC,OAAO,IAAI,WAAW;CAClD,CAAC;AACF,CAAC,CAAC;AAXW,QAAA,2BAA2B,+BAWtC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Error to be throw when otter script failed
3
+ */
4
+ export declare class O3rCliError extends Error {
5
+ constructor(error: any);
6
+ }
7
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/utility/error.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;gBACxB,KAAK,EAAE,GAAG;CAQvB"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.O3rCliError = void 0;
4
+ const environment_1 = require("./environment");
5
+ /**
6
+ * Error to be throw when otter script failed
7
+ */
8
+ class O3rCliError extends Error {
9
+ constructor(error) {
10
+ super(error.toString()
11
+ + '\n\nYou can file new issues by selecting from our issue templates (https://github.com/AmadeusITGroup/otter/issues/new/choose) and filling out the issue template.'
12
+ + '\n\nTo facilitate the reproduction of the issue, do not forget to provide us your environment information:\n'
13
+ + (0, environment_1.getEnvironmentInfoStringify)());
14
+ }
15
+ }
16
+ exports.O3rCliError = O3rCliError;
17
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/utility/error.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAE5D;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,KAAU;QACpB,KAAK,CACH,KAAK,CAAC,QAAQ,EAAY;cACxB,mKAAmK;cACnK,8GAA8G;cAC9G,IAAA,yCAA2B,GAAE,CAChC,CAAC;IACJ,CAAC;CACF;AATD,kCASC"}
@@ -12,7 +12,6 @@ export declare const TYPES_DEFAULT_FOLDER: {
12
12
  };
13
13
  /**
14
14
  * Get destination path for a generated item
15
- *
16
15
  * @param typeOfItem
17
16
  * @param directory
18
17
  * @param tree
@@ -1 +1 @@
1
- {"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../../src/utility/generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAIlD,6BAA6B;AAC7B,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GACr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