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: rosetta failures causes fallback to typescript #373

Merged
merged 3 commits into from
Jul 22, 2021
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
6 changes: 3 additions & 3 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions src/docgen/view/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,16 @@ async function createAssembly(name: string, tsDir: string, loose: boolean, langu
console.log(`Creating assembly in ${language ?? 'ts'} for ${name} from ${tsDir} (loose: ${loose})`);
const ts = new reflect.TypeSystem();
for (let dotJsii of await glob.promise(`${tsDir}/**/.jsii`)) {
if (language) {
// we only transliterate the top level assembly and not the entire type-system.
// note that the only reason to translate dependant assemblies is to show code examples
// for expanded python arguments - which we don't to right now anyway.
// we don't want to make any assumption of the directory structure, so this is the most
// robuse way to detect the root assembly.
const spec = JSON.parse(await fs.readFile(dotJsii, 'utf-8'));
if (language && spec.name === name) {
const packageDir = path.dirname(dotJsii);
try {
await transliterateAssembly([packageDir], [language], { loose });
dotJsii = path.join(packageDir, `.jsii.${language}`);
} catch (e) {
if (!loose) {
throw e;
}
console.log(`Caught transliteration error: ${e}. Ignoring...`);
}
await transliterateAssembly([packageDir], [language], { loose });
dotJsii = path.join(packageDir, `.jsii.${language}`);
}
await ts.load(dotJsii);
}
Expand Down
Loading