@o3r/components 11.1.0-prerelease.20 → 11.1.0-prerelease.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ import type { ComponentConfigOutput } from '@o3r/components';
2
+ import type { MetadataComparator } from '@o3r/extractors';
3
+ /**
4
+ * Interface describing a config migration element
5
+ */
6
+ export interface MigrationConfigData {
7
+ /** Library name */
8
+ libraryName: string;
9
+ /**
10
+ * Configuration name
11
+ */
12
+ configName?: string;
13
+ /**
14
+ * Configuration property name
15
+ */
16
+ propertyName?: string;
17
+ }
18
+ /**
19
+ * Comparator used to compare one version of config metadata with another
20
+ */
21
+ export declare const configMetadataComparator: MetadataComparator<ComponentConfigOutput, MigrationConfigData, ComponentConfigOutput[]>;
22
+ //# sourceMappingURL=config-metadata-comparison.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-metadata-comparison.helper.d.ts","sourceRoot":"","sources":["../../../../builders/metadata-check/helpers/config-metadata-comparison.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA4BD;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAI5H,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configMetadataComparator = void 0;
4
+ /**
5
+ * Returns an array of config metadata from a metadata file.
6
+ * To be easily parseable, the properties will be split in separate items of the array.
7
+ * @param content Content of a migration metadata files
8
+ * @example Array conversion
9
+ * ```javascript
10
+ * [{ library: '@o3r/demo', properties: [{name : 'property1', type: 'string'}, {name : 'property2', type: 'number'}] }]
11
+ * ```
12
+ * will become :
13
+ * ```javascript
14
+ * [{ library: '@o3r/demo', properties: [{name : 'property1', type: 'string'}] }, { library: '@o3r/demo', properties: [{name : 'property2', type: 'number'}] }]
15
+ * ```
16
+ */
17
+ const getConfigurationArray = (content) => content.flatMap((config) => config.properties.length > 1
18
+ ? config.properties.map((prop) => ({ ...config, properties: [prop] }))
19
+ : [config]);
20
+ const getConfigurationPropertyName = (config) => `${config.library}#${config.name}` + (config.properties.length ? ` ${config.properties[0].name}` : '');
21
+ const isMigrationConfigurationDataMatch = (config, migrationData) => migrationData.libraryName === config.library
22
+ && (!migrationData.configName || migrationData.configName === config.name)
23
+ && (!migrationData.propertyName || config.properties[0]?.name === migrationData.propertyName);
24
+ /**
25
+ * Comparator used to compare one version of config metadata with another
26
+ */
27
+ exports.configMetadataComparator = {
28
+ getArray: getConfigurationArray,
29
+ getIdentifier: getConfigurationPropertyName,
30
+ isMigrationDataMatch: isMigrationConfigurationDataMatch
31
+ };
32
+ //# sourceMappingURL=config-metadata-comparison.helper.js.map
@@ -0,0 +1,2 @@
1
+ export * from './config-metadata-comparison.helper';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../builders/metadata-check/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./config-metadata-comparison.helper"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ import type { ConfigMigrationMetadataCheckBuilderSchema } from './schema';
2
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<ConfigMigrationMetadataCheckBuilderSchema & import("@angular-devkit/core").JsonObject>;
3
+ export default _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/metadata-check/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,UAAU,CAAC;;AAE1E,wBAEI"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const architect_1 = require("@angular-devkit/architect");
4
+ const extractors_1 = require("@o3r/extractors");
5
+ const config_metadata_comparison_helper_1 = require("./helpers/config-metadata-comparison.helper");
6
+ exports.default = (0, architect_1.createBuilder)((0, extractors_1.createBuilderWithMetricsIfInstalled)((options, context) => {
7
+ return (0, extractors_1.checkMetadataBuilder)(options, context, config_metadata_comparison_helper_1.configMetadataComparator);
8
+ }));
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
1
+ import type { MigrationMetadataCheckBuilderOptions } from '@o3r/extractors';
2
+ /** Migration metadata check builder schema */
3
+ export interface ConfigMigrationMetadataCheckBuilderSchema extends MigrationMetadataCheckBuilderOptions {
4
+ }
5
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../builders/metadata-check/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AAE5E,8CAA8C;AAC9C,MAAM,WAAW,yCAA0C,SAAQ,oCAAoC;CACtG"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "type": "object",
4
+ "$id": "ConfigMigrationMetadataCheckBuilderSchema",
5
+ "title": "Check config migration metadata builder",
6
+ "description": "Check config migration metadata builder",
7
+ "properties": {
8
+ "migrationDataPath": {
9
+ "type": ["string", "array"],
10
+ "items": {
11
+ "type": "string"
12
+ },
13
+ "description": "Glob of the migration files to use."
14
+ },
15
+ "granularity": {
16
+ "type": "string",
17
+ "description": "Granularity of the migration check.",
18
+ "default": "minor",
19
+ "enum": [
20
+ "major",
21
+ "minor"
22
+ ]
23
+ },
24
+ "allowBreakingChanges": {
25
+ "type": "boolean",
26
+ "description": "Are breaking changes allowed.",
27
+ "default": false
28
+ },
29
+ "packageManager": {
30
+ "type": "string",
31
+ "description": "Override of the package manager, otherwise it will be computed from the project setup."
32
+ },
33
+ "metadataPath": {
34
+ "type": "string",
35
+ "description": "Path of the config metadata file.",
36
+ "default": "./component.config.metadata.json"
37
+ }
38
+ },
39
+ "additionalProperties": false,
40
+ "required": ["migrationDataPath"]
41
+ }
package/builders.json CHANGED
@@ -5,6 +5,11 @@
5
5
  "implementation": "./builders/component-extractor/",
6
6
  "schema": "./builders/component-extractor/schema.json",
7
7
  "description": "Extract the component metadata (configuration and class) from an Otter project"
8
+ },
9
+ "check-config-migration-metadata": {
10
+ "implementation": "./builders/metadata-check/",
11
+ "schema": "./builders/metadata-check/schema.json",
12
+ "description": "Check for component metadata breaking changes"
8
13
  }
9
14
  }
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/components",
3
- "version": "11.1.0-prerelease.20",
3
+ "version": "11.1.0-prerelease.22",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -44,21 +44,27 @@
44
44
  "@ngrx/effects": "~18.0.0",
45
45
  "@ngrx/entity": "~18.0.0",
46
46
  "@ngrx/store": "~18.0.0",
47
- "@o3r/analytics": "^11.1.0-prerelease.20",
48
- "@o3r/configuration": "^11.1.0-prerelease.20",
49
- "@o3r/core": "^11.1.0-prerelease.20",
50
- "@o3r/dynamic-content": "^11.1.0-prerelease.20",
51
- "@o3r/extractors": "^11.1.0-prerelease.20",
52
- "@o3r/localization": "^11.1.0-prerelease.20",
53
- "@o3r/logger": "^11.1.0-prerelease.20",
54
- "@o3r/rules-engine": "^11.1.0-prerelease.20",
55
- "@o3r/schematics": "^11.1.0-prerelease.20",
56
- "@o3r/testing": "^11.1.0-prerelease.20",
47
+ "@o3r/analytics": "^11.1.0-prerelease.22",
48
+ "@o3r/configuration": "^11.1.0-prerelease.22",
49
+ "@o3r/core": "^11.1.0-prerelease.22",
50
+ "@o3r/dynamic-content": "^11.1.0-prerelease.22",
51
+ "@o3r/extractors": "^11.1.0-prerelease.22",
52
+ "@o3r/localization": "^11.1.0-prerelease.22",
53
+ "@o3r/logger": "^11.1.0-prerelease.22",
54
+ "@o3r/rules-engine": "^11.1.0-prerelease.22",
55
+ "@o3r/schematics": "^11.1.0-prerelease.22",
56
+ "@o3r/testing": "^11.1.0-prerelease.22",
57
57
  "@schematics/angular": "~18.0.0",
58
+ "@yarnpkg/cli": "^4.0.0",
59
+ "@yarnpkg/core": "^4.1.1",
60
+ "@yarnpkg/fslib": "^3.1.0",
61
+ "@yarnpkg/plugin-npm": "^3.0.1",
62
+ "@yarnpkg/plugin-pack": "^4.0.0",
58
63
  "chokidar": "^3.5.2",
59
64
  "globby": "^11.1.0",
60
65
  "jsonpath-plus": "^9.0.0",
61
66
  "rxjs": "^7.8.1",
67
+ "semver": "^7.5.2",
62
68
  "typescript": "~5.4.2"
63
69
  },
64
70
  "peerDependenciesMeta": {
@@ -92,6 +98,21 @@
92
98
  "@schematics/angular": {
93
99
  "optional": true
94
100
  },
101
+ "@yarnpkg/cli": {
102
+ "optional": true
103
+ },
104
+ "@yarnpkg/core": {
105
+ "optional": true
106
+ },
107
+ "@yarnpkg/fslib": {
108
+ "optional": true
109
+ },
110
+ "@yarnpkg/plugin-npm": {
111
+ "optional": true
112
+ },
113
+ "@yarnpkg/plugin-pack": {
114
+ "optional": true
115
+ },
95
116
  "chokidar": {
96
117
  "optional": true
97
118
  },
@@ -101,6 +122,9 @@
101
122
  "jsonpath-plus": {
102
123
  "optional": true
103
124
  },
125
+ "semver": {
126
+ "optional": true
127
+ },
104
128
  "typescript": {
105
129
  "optional": true
106
130
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/cms-adapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAgFvF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;kBA5EwB,MAAM,GAAG,SAAS;UA4EkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/cms-adapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAuFvF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;kBAnFwB,MAAM,GAAG,SAAS;UAmFkB,CAAC"}
@@ -37,6 +37,12 @@ function updateCmsAdapterFn(options) {
37
37
  libraries: []
38
38
  }
39
39
  };
40
+ workspaceProject.architect['check-config-migration-metadata'] ||= {
41
+ builder: '@o3r/components:check-config-migration-metadata',
42
+ options: {
43
+ migrationDataPath: 'MIGRATION-*.json'
44
+ }
45
+ };
40
46
  workspace.projects[options.projectName] = workspaceProject;
41
47
  tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
42
48
  return tree;