@o3r/schematics 10.4.0-prerelease.8 → 10.5.0-prerelease.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/schematics",
3
- "version": "10.4.0-prerelease.8",
3
+ "version": "10.5.0-prerelease.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,7 +30,7 @@
30
30
  "@angular-devkit/core": "~17.3.0",
31
31
  "@angular-devkit/schematics": "~17.3.0",
32
32
  "@angular/cli": "~17.3.0",
33
- "@o3r/telemetry": "^10.4.0-prerelease.8",
33
+ "@o3r/telemetry": "^10.5.0-prerelease.0",
34
34
  "@schematics/angular": "~17.3.0",
35
35
  "eslint": "^8.42.0",
36
36
  "rxjs": "^7.8.1",
@@ -82,9 +82,9 @@
82
82
  "@nx/eslint-plugin": "~18.3.0",
83
83
  "@nx/jest": "~18.3.0",
84
84
  "@nx/js": "~18.3.0",
85
- "@o3r/build-helpers": "^10.4.0-prerelease.8",
86
- "@o3r/eslint-plugin": "^10.4.0-prerelease.8",
87
- "@o3r/telemetry": "^10.4.0-prerelease.8",
85
+ "@o3r/build-helpers": "^10.5.0-prerelease.0",
86
+ "@o3r/eslint-plugin": "^10.5.0-prerelease.0",
87
+ "@o3r/telemetry": "^10.5.0-prerelease.0",
88
88
  "@schematics/angular": "~17.3.0",
89
89
  "@stylistic/eslint-plugin-ts": "^1.5.4",
90
90
  "@types/inquirer": "~8.2.10",
@@ -7,8 +7,16 @@ import type { SchematicOptionObject } from '../../interfaces/index';
7
7
  * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
8
8
  */
9
9
  export declare function registerPackageCollectionSchematics(packageJson: PackageJson, angularJsonFile?: string): Rule;
10
+ /**
11
+ * Setup schematics default params in angular.json and per project
12
+ * @param schematicsDefaultParams default params to setup by schematic
13
+ * @param projectName The name of the project on which to add the schematics
14
+ * @param overrideValue Define if the given value should override the one already defined in the workspace
15
+ */
16
+ export declare function setupSchematicsParamsForProject(schematicsDefaultParams: Record<string, SchematicOptionObject>, projectName?: string, overrideValue?: boolean): Rule;
10
17
  /**
11
18
  * Setup schematics default params in angular.json
19
+ * @deprecated will be removed in v12. Use {@link setupSchematicsParamsForProject}
12
20
  * @param schematicsDefaultParams default params to setup by schematic
13
21
  * @param overrideValue Define if the given value should override the one already defined in the workspace
14
22
  * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
@@ -1 +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"}
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,+BAA+B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,IAAI,CAmCjK;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,aAAa,UAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAgClK"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupSchematicsDefaultParams = exports.registerPackageCollectionSchematics = void 0;
3
+ exports.setupSchematicsDefaultParams = exports.setupSchematicsParamsForProject = exports.registerPackageCollectionSchematics = void 0;
4
4
  const utility_1 = require("../../utility");
5
5
  /**
6
6
  * Register the given package in the Angular CLI schematics
@@ -21,8 +21,51 @@ function registerPackageCollectionSchematics(packageJson, angularJsonFile) {
21
21
  };
22
22
  }
23
23
  exports.registerPackageCollectionSchematics = registerPackageCollectionSchematics;
24
+ /**
25
+ * Setup schematics default params in angular.json and per project
26
+ * @param schematicsDefaultParams default params to setup by schematic
27
+ * @param projectName The name of the project on which to add the schematics
28
+ * @param overrideValue Define if the given value should override the one already defined in the workspace
29
+ */
30
+ function setupSchematicsParamsForProject(schematicsDefaultParams, projectName, overrideValue = false) {
31
+ return (tree, context) => {
32
+ const workspace = (0, utility_1.getWorkspaceConfig)(tree);
33
+ if (!workspace) {
34
+ context.logger.error('No workspace found');
35
+ return tree;
36
+ }
37
+ Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
38
+ workspace.schematics ||= {};
39
+ workspace.schematics[schematicName] = overrideValue ? {
40
+ ...workspace.schematics[schematicName],
41
+ ...defaultParams
42
+ } : {
43
+ ...defaultParams,
44
+ ...workspace.schematics[schematicName]
45
+ };
46
+ });
47
+ if (projectName && workspace.projects[projectName]) {
48
+ const project = workspace.projects[projectName];
49
+ Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
50
+ project.schematics ||= {};
51
+ if (project.schematics[schematicName]) {
52
+ project.schematics[schematicName] = overrideValue ? {
53
+ ...project.schematics[schematicName],
54
+ ...defaultParams
55
+ } : {
56
+ ...defaultParams,
57
+ ...project.schematics[schematicName]
58
+ };
59
+ }
60
+ });
61
+ }
62
+ return (0, utility_1.writeAngularJson)(tree, workspace);
63
+ };
64
+ }
65
+ exports.setupSchematicsParamsForProject = setupSchematicsParamsForProject;
24
66
  /**
25
67
  * Setup schematics default params in angular.json
68
+ * @deprecated will be removed in v12. Use {@link setupSchematicsParamsForProject}
26
69
  * @param schematicsDefaultParams default params to setup by schematic
27
70
  * @param overrideValue Define if the given value should override the one already defined in the workspace
28
71
  * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
@@ -1 +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;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B,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;qBACrC,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,0BAAgB,EAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAhCD,oEAgCC"}
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,+BAA+B,CAAC,uBAA8D,EAAE,WAAoB,EAAE,aAAa,GAAG,KAAK;IACzJ,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,SAAS,GAAG,IAAA,4BAAkB,EAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAC3C,OAAO,IAAI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,aAAa,CAAC;qBACrC,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,0BAAgB,EAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAhCD,oEAgCC"}
@@ -1,4 +1,6 @@
1
1
  export * from './add-dev-dependency';
2
2
  export * from './interfaces';
3
+ export * from './npm-exec';
3
4
  export * from './npm-install';
5
+ export * from './npm-run';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tasks/package-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tasks/package-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
@@ -3,5 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./add-dev-dependency"), exports);
5
5
  tslib_1.__exportStar(require("./interfaces"), exports);
6
+ tslib_1.__exportStar(require("./npm-exec"), exports);
6
7
  tslib_1.__exportStar(require("./npm-install"), exports);
8
+ tslib_1.__exportStar(require("./npm-run"), exports);
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tasks/package-manager/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,uDAA6B;AAC7B,wDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tasks/package-manager/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,uDAA6B;AAC7B,qDAA2B;AAC3B,wDAA8B;AAC9B,oDAA0B"}
@@ -0,0 +1,14 @@
1
+ import { TaskConfiguration, TaskConfigurationGenerator } from '@angular-devkit/schematics';
2
+ import { NodePackageTaskOptions } from '@angular-devkit/schematics/tasks/package-manager/options';
3
+ /**
4
+ * Configuration used to run an Npm binary during schematics execution
5
+ * Note that this only works if the necessary files are created on the disk (doesn't work on tree)
6
+ */
7
+ export declare class NpmExecTask implements TaskConfigurationGenerator<NodePackageTaskOptions> {
8
+ private readonly script;
9
+ private readonly args;
10
+ private readonly workingDirectory?;
11
+ constructor(script: string, args?: string[], workingDirectory?: string | undefined);
12
+ toConfiguration(): TaskConfiguration<NodePackageTaskOptions>;
13
+ }
14
+ //# sourceMappingURL=npm-exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-exec.d.ts","sourceRoot":"","sources":["../../../../src/tasks/package-manager/npm-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAmB,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAGnH;;;GAGG;AACH,qBAAa,WAAY,YAAW,0BAA0B,CAAC,sBAAsB,CAAC;IAExE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAU,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAiB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAAxF,MAAM,EAAE,MAAM,EAAmB,IAAI,GAAE,MAAM,EAAO,EAAmB,gBAAgB,CAAC,oBAAQ;IAEtH,eAAe,IAAI,iBAAiB,CAAC,sBAAsB,CAAC;CAYpE"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NpmExecTask = void 0;
4
+ const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
5
+ const package_manager_runner_1 = require("../../utility/package-manager-runner");
6
+ /**
7
+ * Configuration used to run an Npm binary during schematics execution
8
+ * Note that this only works if the necessary files are created on the disk (doesn't work on tree)
9
+ */
10
+ class NpmExecTask {
11
+ constructor(script, args = [], workingDirectory) {
12
+ this.script = script;
13
+ this.args = args;
14
+ this.workingDirectory = workingDirectory;
15
+ }
16
+ toConfiguration() {
17
+ const packageManager = (0, package_manager_runner_1.getPackageManager)();
18
+ return {
19
+ name: options_1.NodePackageName,
20
+ options: {
21
+ command: 'exec',
22
+ packageName: `exec ${this.script} ${packageManager === 'npm' ? '-- ' : ''}${this.args.map((arg) => `"${arg}"`).join(' ')}`,
23
+ workingDirectory: this.workingDirectory,
24
+ packageManager
25
+ }
26
+ };
27
+ }
28
+ }
29
+ exports.NpmExecTask = NpmExecTask;
30
+ //# sourceMappingURL=npm-exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-exec.js","sourceRoot":"","sources":["../../../../src/tasks/package-manager/npm-exec.ts"],"names":[],"mappings":";;;AACA,sFAAmH;AACnH,iFAAyE;AAEzE;;;GAGG;AACH,MAAa,WAAW;IAEtB,YAA6B,MAAc,EAAmB,OAAiB,EAAE,EAAmB,gBAAyB;QAAhG,WAAM,GAAN,MAAM,CAAQ;QAAmB,SAAI,GAAJ,IAAI,CAAe;QAAmB,qBAAgB,GAAhB,gBAAgB,CAAS;IAAG,CAAC;IAE1H,eAAe;QACpB,MAAM,cAAc,GAAG,IAAA,0CAAiB,GAAE,CAAC;QAC3C,OAAO;YACL,IAAI,EAAE,yBAAe;YACrB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM;gBACf,WAAW,EAAE,QAAQ,IAAI,CAAC,MAAM,IAAI,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC1H,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,cAAc;aACf;SACF,CAAC;IACJ,CAAC;CACF;AAhBD,kCAgBC"}
@@ -0,0 +1,13 @@
1
+ import { TaskConfiguration, TaskConfigurationGenerator } from '@angular-devkit/schematics';
2
+ import { NodePackageTaskOptions } from '@angular-devkit/schematics/tasks/package-manager/options';
3
+ /**
4
+ * Configuration used to run an Npm script during schematics execution
5
+ * Note that this only works if the necessary files are created on the disk (doesn't work on tree)
6
+ */
7
+ export declare class NpmRunTask implements TaskConfigurationGenerator<NodePackageTaskOptions> {
8
+ private readonly script;
9
+ private readonly workingDirectory?;
10
+ constructor(script: string, workingDirectory?: string | undefined);
11
+ toConfiguration(): TaskConfiguration<NodePackageTaskOptions>;
12
+ }
13
+ //# sourceMappingURL=npm-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-run.d.ts","sourceRoot":"","sources":["../../../../src/tasks/package-manager/npm-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAmB,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAGnH;;;GAGG;AACH,qBAAa,UAAW,YAAW,0BAA0B,CAAC,sBAAsB,CAAC;IAEvE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAU,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAAlD,MAAM,EAAE,MAAM,EAAmB,gBAAgB,CAAC,oBAAQ;IAEhF,eAAe,IAAI,iBAAiB,CAAC,sBAAsB,CAAC;CAWpE"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NpmRunTask = void 0;
4
+ const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
5
+ const package_manager_runner_1 = require("../../utility/package-manager-runner");
6
+ /**
7
+ * Configuration used to run an Npm script during schematics execution
8
+ * Note that this only works if the necessary files are created on the disk (doesn't work on tree)
9
+ */
10
+ class NpmRunTask {
11
+ constructor(script, workingDirectory) {
12
+ this.script = script;
13
+ this.workingDirectory = workingDirectory;
14
+ }
15
+ toConfiguration() {
16
+ return {
17
+ name: options_1.NodePackageName,
18
+ options: {
19
+ command: 'run',
20
+ packageName: `run ${this.script}`,
21
+ workingDirectory: this.workingDirectory,
22
+ packageManager: (0, package_manager_runner_1.getPackageManager)()
23
+ }
24
+ };
25
+ }
26
+ }
27
+ exports.NpmRunTask = NpmRunTask;
28
+ //# sourceMappingURL=npm-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-run.js","sourceRoot":"","sources":["../../../../src/tasks/package-manager/npm-run.ts"],"names":[],"mappings":";;;AACA,sFAAmH;AACnH,iFAAyE;AAEzE;;;GAGG;AACH,MAAa,UAAU;IAErB,YAA6B,MAAc,EAAmB,gBAAyB;QAA1D,WAAM,GAAN,MAAM,CAAQ;QAAmB,qBAAgB,GAAhB,gBAAgB,CAAS;IAAG,CAAC;IAEpF,eAAe;QACpB,OAAO;YACL,IAAI,EAAE,yBAAe;YACrB,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE;gBACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,cAAc,EAAE,IAAA,0CAAiB,GAAE;aACpC;SACF,CAAC;IACJ,CAAC;CACF;AAfD,gCAeC"}
@@ -22,4 +22,5 @@ export * from './update-imports';
22
22
  export * from './update-pipes';
23
23
  export * from './builder';
24
24
  export * from './wrapper';
25
+ export * from './migration/migration';
25
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAg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AC"}
@@ -25,4 +25,5 @@ tslib_1.__exportStar(require("./update-imports"), exports);
25
25
  tslib_1.__exportStar(require("./update-pipes"), exports);
26
26
  tslib_1.__exportStar(require("./builder"), exports);
27
27
  tslib_1.__exportStar(require("./wrapper"), exports);
28
+ tslib_1.__exportStar(require("./migration/migration"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,yDAA+B;AAC/B,oDAA0B;AAC1B,oDAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,yDAA+B;AAC/B,oDAA0B;AAC1B,oDAA0B;AAC1B,gEAAsC"}
@@ -0,0 +1,32 @@
1
+ import type { LoggerApi } from '@angular-devkit/core/src/logger';
2
+ import { type Rule } from '@angular-devkit/schematics';
3
+ /** Create the migration */
4
+ interface MigrateRuleRunnerOptions {
5
+ /** The original version from which to execute the rules */
6
+ from: string;
7
+ /**
8
+ * The last version for which to execute the rule.
9
+ * If not specified, all the versions from the "from" parameter will be considered.
10
+ */
11
+ to?: string;
12
+ }
13
+ /** Mapping of rules to apply to its specific range */
14
+ export interface MigrationRulesMap {
15
+ /** Rules to apply to a specific semver range */
16
+ [range: string]: Rule | Rule[];
17
+ }
18
+ /**
19
+ * Option for migration rule runner factory
20
+ */
21
+ interface MigrationRuleRunnerOptions {
22
+ /** Logger */
23
+ logger?: LoggerApi;
24
+ }
25
+ /**
26
+ * Generate the Migration Rule Schematic runner to execute rules according to the range
27
+ * @param rulesMapping Mapping of rules to execute based on its semver range
28
+ * @param options Additional options
29
+ */
30
+ export declare function getMigrationRuleRunner(rulesMapping: MigrationRulesMap, options?: MigrationRuleRunnerOptions): (config: MigrateRuleRunnerOptions) => Rule;
31
+ export {};
32
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../../src/utility/migration/migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAG9D,4BAA4B;AAC5B,UAAU,wBAAwB;IAChC,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,UAAU,0BAA0B;IAClC,aAAa;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,0BAA0B,YAgB1F,wBAAwB,KAAG,IAAI,CAQhD"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMigrationRuleRunner = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const semver_1 = require("semver");
6
+ /**
7
+ * Generate the Migration Rule Schematic runner to execute rules according to the range
8
+ * @param rulesMapping Mapping of rules to execute based on its semver range
9
+ * @param options Additional options
10
+ */
11
+ function getMigrationRuleRunner(rulesMapping, options) {
12
+ const rangeMapping = Object.entries(rulesMapping)
13
+ .reduce((acc, [range, rule]) => {
14
+ const checkedRange = (0, semver_1.validRange)(range);
15
+ if (!checkedRange) {
16
+ options?.logger?.warn(`The range "${range}" is invalid and will be ignored in the Migration rule`);
17
+ }
18
+ else {
19
+ acc.push([checkedRange, Array.isArray(rule) ? rule : [rule]]);
20
+ }
21
+ return acc;
22
+ }, []);
23
+ /**
24
+ * Migration rule runner
25
+ * @param config Provide information regarding the range to match
26
+ */
27
+ return (config) => {
28
+ const fromToRange = new semver_1.Range(config.to ? `>${config.from} <=${config.to}` : `>${config.from}`);
29
+ return (0, schematics_1.chain)(rangeMapping
30
+ .filter(([range]) => (0, semver_1.intersects)(range, fromToRange))
31
+ .map(([_, rules]) => (0, schematics_1.chain)(rules)));
32
+ };
33
+ }
34
+ exports.getMigrationRuleRunner = getMigrationRuleRunner;
35
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"","sources":["../../../../src/utility/migration/migration.ts"],"names":[],"mappings":";;;AACA,2DAA8D;AAC9D,mCAAuD;AA4BvD;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,YAA+B,EAAE,OAAoC;IAC1G,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;SAC9C,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,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