Skip to content

Commit

Permalink
fix: put toc under project
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Jun 18, 2024
1 parent baf7460 commit 1bc82c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/myst-cli/src/upgrade/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,7 @@ function convertGeneric(dir: string, data: Record<string, unknown>): any {
}
}
export function upgradeTOC(data: SphinxExternalTOC) {
return convertGeneric(cwd(), data) as any[];
const dir = cwd();
const entries = convertGeneric(dir, data) as any[];
return [{ file: relative(dir, resolveExtension(join(dir, data.root))!) }, ...entries];
}
3 changes: 2 additions & 1 deletion packages/myst-cli/src/upgrade/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function upgrade(session: ISession, opts: any) {

const config: Config = {
version: 1,
project: {}
};

// Does config file exist?
Expand All @@ -32,7 +33,7 @@ export async function upgrade(session: ISession, opts: any) {
const content = fs.readFileSync('_toc.yml').toString();
const data = validateSphinxExternalTOC(yaml.load(content));
if (defined(data)) {
(config as any).toc = upgradeTOC(data);
(config as any).project.toc = upgradeTOC(data);
}
}

Expand Down

0 comments on commit 1bc82c1

Please sign in to comment.