Skip to content

Commit

Permalink
fix: export transliterateAssembly and fix bug with transliterate cli …
Browse files Browse the repository at this point in the history
…(backport) (#4166)

Backport of aws/jsii-rosetta#121

---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
mrgrain authored Jul 3, 2023
1 parent 45ddc2d commit 6b7eb02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
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';

0 comments on commit 6b7eb02

Please sign in to comment.