-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: add new builders for metadata migration check #1732
Conversation
815ce00
to
3a39949
Compare
3a39949
to
7b5fd7d
Compare
packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Show resolved
Hide resolved
* @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> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing constraint on T
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-files.helper.ts
Outdated
Show resolved
Hide resolved
* Read and parses a JSON file | ||
* @param metadataPath Path of the file | ||
*/ | ||
export function getLocalMetadataFile<T>(metadataPath: string): T { |
There was a problem hiding this comment.
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)
packages/@o3r/extractors/src/core/comparator/metadata-files.helper.ts
Outdated
Show resolved
Hide resolved
...3r/extractors/src/core/comparator/package-managers-extractors/yarn2-file-extractor.helper.ts
Outdated
Show resolved
Hide resolved
...3r/extractors/src/core/comparator/package-managers-extractors/yarn2-file-extractor.helper.ts
Outdated
Show resolved
Hide resolved
...@o3r/localization/builders/metadata-check/helpers/localization-metadata-comparison.helper.ts
Show resolved
Hide resolved
packages/@o3r/styling/builders/metadata-check/helpers/styling-metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
The following items are missing to the feature:
|
7b5fd7d
to
105a0e8
Compare
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
}, | ||
"packageManager": { | ||
"type": "string", | ||
"description": "Override of the package manager, otherwise it will be determined from the project." |
There was a problem hiding this comment.
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
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
* @param granularity 'major' or 'minor' | ||
*/ | ||
export function getVersionRangeFromLatestVersion(version: string, granularity: 'major' | 'minor'): string { | ||
const semver = coerce(version); |
There was a problem hiding this comment.
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')
...@o3r/localization/builders/metadata-check/helpers/localization-metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
105a0e8
to
a8852c0
Compare
packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
a8852c0
to
f234d6b
Compare
packages/@o3r/extractors/src/core/comparator/metadata-files.helper.ts
Outdated
Show resolved
Hide resolved
d97f03e
to
67b9de7
Compare
packages/@o3r/extractors/src/core/comparator/metadata-files.helper.ts
Outdated
Show resolved
Hide resolved
7b11207
to
d1d1e8c
Compare
packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts
Show resolved
Hide resolved
*/ | ||
const getLocalizationArray = (content: LocalizationMetadata) => content; | ||
|
||
const getLocalizationName = (localization: JSONLocalization) => localization.key; |
There was a problem hiding this comment.
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)
packages/@o3r/extractors/src/core/comparator/metadata-files.helper.ts
Outdated
Show resolved
Hide resolved
...@o3r/extractors/src/core/comparator/package-managers-extractors/npm-file-extractor.helper.ts
Show resolved
Hide resolved
c59ffc4
to
0d64b94
Compare
0622812
to
2fbb35d
Compare
packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts
Outdated
Show resolved
Hide resolved
: [config] | ||
); | ||
|
||
const getConfigurationPropertyName = (config: ComponentConfigOutput) => `${config.library}#${config.name}` + (config.properties.length ? ` ${config.properties[0].name}` : ''); |
There was a problem hiding this comment.
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
)
...3r/extractors/src/core/comparator/package-managers-extractors/yarn2-file-extractor.helper.ts
Show resolved
Hide resolved
9a7031b
to
4bc830d
Compare
* @returns {import('ts-jest/dist/types').JestConfigWithTsJest} | ||
*/ | ||
module.exports.getJestProjectConfig = (rootDir, isAngularSetup) => { | ||
module.exports.getJestProjectConfig = (rootDir, isAngularSetup, options) => { |
There was a problem hiding this comment.
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 .
4bc830d
to
255b3bf
Compare
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