Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new builders for metadata migration check #1732

Conversation

cpourcel
Copy link
Contributor

Proposed change

Add 3 new builders in @o3r/component, @o3r/styling and @o3r/localization, check-config-migration-metadata, check-localization-styling -metadata and check-localization-migration-metadata
The goal of these builders is to retrieve a previous version of the app (provided as an option or computed from the folder of migration metadata) and compare the current metadata with the previous one. It will raise some errors if breaking changes are detected and they are not allowed, or if these changes are not documented in the provided migration metadata.

Related issues

  • 🐛 Fixes #(issue)
  • 🚀 Feature #(issue)

@cpourcel cpourcel requested a review from a team as a code owner April 29, 2024 14:52
@cpourcel cpourcel force-pushed the feature/metadata-migration-check branch from 815ce00 to 3a39949 Compare April 29, 2024 15:01
@cpourcel cpourcel changed the title feat: add new builders for metadata migration check [WIP] feat: add new builders for metadata migration check Apr 29, 2024
@cpourcel cpourcel force-pushed the feature/metadata-migration-check branch from 3a39949 to 7b5fd7d Compare April 29, 2024 15:09
@kpanot kpanot marked this pull request as draft April 30, 2024 01:38
* @param context Builder context (from another builder)
* @param comparator Comparator implementation, depends on the type of metadata to check
*/
export async function checkMetadataBuilder<T>(options: MigrationMetadataCheckBuilderOptions, context: BuilderContext, comparator: MetadataComparator<T>): Promise<BuilderOutput> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing constraint on T

* Read and parses a JSON file
* @param metadataPath Path of the file
*/
export function getLocalMetadataFile<T>(metadataPath: string): T {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add constraint on T (like JsonObject from type-fest for example)

@kpanot
Copy link
Contributor

kpanot commented Apr 30, 2024

The following items are missing to the feature:

  • Documentation in docs/ folders and in the list of the schematics in readme.md files
  • An ngAdd option to register the builder in the workspace file

@cpourcel cpourcel force-pushed the feature/metadata-migration-check branch from 7b5fd7d to 105a0e8 Compare April 30, 2024 13:36
},
"packageManager": {
"type": "string",
"description": "Override of the package manager, otherwise it will be determined from the project."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the angular.json or the process env ? Since you are calling the getPackageManager() function

* @param granularity 'major' or 'minor'
*/
export function getVersionRangeFromLatestVersion(version: string, granularity: 'major' | 'minor'): string {
const semver = coerce(version);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a little permissive, but not sure it's a big deal here (ex: semver.valid(semver.coerce("42.6.7.9.3-alpha")); // '42.6.7')

@cpourcel cpourcel force-pushed the feature/metadata-migration-check branch from 105a0e8 to a8852c0 Compare May 28, 2024 16:16
@cpourcel cpourcel force-pushed the feature/metadata-migration-check branch from a8852c0 to f234d6b Compare May 31, 2024 07:56
@matthieu-crouzet matthieu-crouzet force-pushed the feature/metadata-migration-check branch 2 times, most recently from d97f03e to 67b9de7 Compare July 3, 2024 12:43
packages/@o3r/extractors/package.json Show resolved Hide resolved
*/
const getLocalizationArray = (content: LocalizationMetadata) => content;

const getLocalizationName = (localization: JSONLocalization) => localization.key;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a be strange to have comment only on 1 const (even if they are not required because not exported)

@fpaul-1A fpaul-1A force-pushed the feature/metadata-migration-check branch 3 times, most recently from c59ffc4 to 0d64b94 Compare July 15, 2024 14:13
@fpaul-1A fpaul-1A changed the base branch from main to release/11.0.0-rc July 15, 2024 14:13
@fpaul-1A fpaul-1A force-pushed the feature/metadata-migration-check branch 2 times, most recently from 0622812 to 2fbb35d Compare July 15, 2024 15:05
docs/cms-adapters/CMS_ADAPTERS.md Outdated Show resolved Hide resolved
docs/cms-adapters/CMS_ADAPTERS.md Outdated Show resolved Hide resolved
docs/cms-adapters/CMS_ADAPTERS.md Outdated Show resolved Hide resolved
: [config]
);

const getConfigurationPropertyName = (config: ComponentConfigOutput) => `${config.library}#${config.name}` + (config.properties.length ? ` ${config.properties[0].name}` : '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comment (not needed but provided in getConfigurationArray)

@fpaul-1A fpaul-1A force-pushed the feature/metadata-migration-check branch 2 times, most recently from 9a7031b to 4bc830d Compare July 18, 2024 12:36
* @returns {import('ts-jest/dist/types').JestConfigWithTsJest}
*/
module.exports.getJestProjectConfig = (rootDir, isAngularSetup) => {
module.exports.getJestProjectConfig = (rootDir, isAngularSetup, options) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking:
isAngularSetup could be included in options
maybe rootdir too .

@fpaul-1A fpaul-1A force-pushed the feature/metadata-migration-check branch from 4bc830d to 255b3bf Compare July 19, 2024 08:39
@fpaul-1A fpaul-1A enabled auto-merge July 19, 2024 08:51
@fpaul-1A fpaul-1A merged commit 07cb125 into AmadeusITGroup:release/11.0.0-rc Jul 19, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants