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

chore(enum-updater): add enum updater tool #33681

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ensure the replacement logic works properly
  • Loading branch information
Leonardo Gama committed Feb 26, 2025
commit 9b9f6dc0abab566fa72a1d2498ece774fda666d2
25 changes: 13 additions & 12 deletions tools/@aws-cdk/construct-metadata-updater/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { ConstructsUpdater, EnumLikeUpdater, EnumsUpdater, MethodsUpdater, PropertyUpdater } from './metadata-updater';

import { EnumLikeUpdater } from './metadata-updater';
// TODO: Uncomment out the rest of the updaters and tweak the import before raising a PR.
// If you're reading this on GitHub, someone forgot to double-check!
export function main() {
const dir = '../../../../packages/'

new ConstructsUpdater(dir).execute();
console.log('Constructs updater finished.');
// new ConstructsUpdater(dir).execute();
// console.log('Constructs updater finished.');

new PropertyUpdater(dir).execute();
console.log('Property updater finished.')
// new PropertyUpdater(dir).execute();
// console.log('Property updater finished.')

new EnumsUpdater(dir).execute();
console.log('Enums updater finished.');
// new EnumsUpdater(dir).execute();
// console.log('Enums updater finished.');

new MethodsUpdater(dir).execute();
console.log('Methods updater finished.');
// new MethodsUpdater(dir).execute();
// console.log('Methods updater finished.');

new EnumLikeUpdater(dir).execute();
console.log('Enum-like updater finished.');
new EnumLikeUpdater(dir).TEST();
// console.log('Enum-like updater finished.');
}
Original file line number Diff line number Diff line change
@@ -893,7 +893,7 @@ export class EnumLikeUpdater extends MetadataUpdater {
// Add the missing enum-like values
for (const enumLikeVal of missingValue['missing_values']) {
classDeclaration.addProperty({
name: enumLikeVal.toUpperCase().replace('-', '_').replace('.', '_'),
name: enumLikeVal.toUpperCase().replaceAll('-', '_').replaceAll('.', '_'),
scope: Scope.Public,
isStatic: true,
isReadonly: true,
@@ -908,6 +908,6 @@ export class EnumLikeUpdater extends MetadataUpdater {
}

public TEST() {
this.updateEnumLikeValues();
console.log(this.updateEnumLikeValues())
}
}