@o3r/schematics 10.4.0-prerelease.17 → 10.4.0-prerelease.19

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.17",
3
+ "version": "10.4.0-prerelease.19",
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.17",
33
+ "@o3r/telemetry": "^10.4.0-prerelease.19",
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.17",
86
- "@o3r/eslint-plugin": "^10.4.0-prerelease.17",
87
- "@o3r/telemetry": "^10.4.0-prerelease.17",
85
+ "@o3r/build-helpers": "^10.4.0-prerelease.19",
86
+ "@o3r/eslint-plugin": "^10.4.0-prerelease.19",
87
+ "@o3r/telemetry": "^10.4.0-prerelease.19",
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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