Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Apr 28, 2024
1 parent 2a8a0bd commit d0f4512
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function main() {
.option('readme', { alias: 'r', type: 'boolean', required: false, desc: 'Include the user defined README.md in the documentation.' })
.option('submodule', { alias: 's', type: 'string', required: false, desc: 'Generate docs for a specific submodule (or "root")' })
.option('split-by-submodule', { type: 'boolean', required: false, desc: 'Generate a separate file for each submodule' })
.example('$0', 'Generate documentation for the current module as a single file (auto-resolves node depedencies)')
.example('$0', 'Generate documentation for the current module as a single file (auto-resolves node dependencies)')
.argv;

const submodule = args.submodule === 'root' ? undefined : args.submodule;
Expand Down
12 changes: 10 additions & 2 deletions src/docgen/view/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ export class Documentation {
});

const ts = new reflect.TypeSystem();
for (let dotJsii of await glob.promise(`${this.assembliesDir}/**/${SPEC_FILE_NAME}`)) {
console.log(dotJsii);
const searchPattern = normalizePathForGlob(this.assembliesDir) + `/**/${SPEC_FILE_NAME}`;
for (let dotJsii of await glob.promise(searchPattern)) {
// 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.
Expand Down Expand Up @@ -557,3 +557,11 @@ function maybeCorruptedAssemblyError(error: Error): CorruptedAssemblyError | und
}
return;
}

/**
* glob needs the pattern to only use forward slashes.
* So we split the path based on the current platforms separator and re-join using /.
*/
function normalizePathForGlob(pattern: string): string {
return path.normalize(pattern).split(path.sep).join(path.posix.sep);
}

0 comments on commit d0f4512

Please sign in to comment.