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

fix: export transliterateAssembly and fix bug with transliterate cli (backport) #4166

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 11 additions & 10 deletions packages/jsii-rosetta/bin/jsii-rosetta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ function main() {
describe: 'Assembly to transliterate',
})
.option('language', {
alias: 'l',
type: 'string',
array: true,
default: [],
Expand Down Expand Up @@ -319,15 +318,17 @@ function main() {
);
const languages =
args.language.length > 0
? args.language.map((lang) => {
const target = Object.entries(TargetLanguage).find(([k]) => k === lang)?.[1];
if (target == null) {
throw new Error(
`Unknown target language: ${lang}. Expected one of ${Object.keys(TargetLanguage).join(', ')}`,
);
}
return target;
})
? args.language
.map((lang) => lang.toUpperCase())
.map((lang) => {
const target = Object.entries(TargetLanguage).find(([k]) => k === lang)?.[1];
if (target == null) {
throw new Error(
`Unknown target language: ${lang}. Expected one of ${Object.keys(TargetLanguage).join(', ')}`,
);
}
return target;
})
: Object.values(TargetLanguage);
return transliterateAssembly(assemblies, languages, args);
}),
Expand Down
1 change: 1 addition & 0 deletions packages/jsii-rosetta/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export * from './rosetta-reader';
export * from './rosetta-translator';
export * from './snippet';
export * from './markdown';
export * from './commands/transliterate';
export * from './strict';