Skip to content

Commit

Permalink
chore: update nightly docs (#239)
Browse files Browse the repository at this point in the history
Co-authored-by: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and sarahschwartz authored Apr 16, 2024
1 parent 097502d commit eaa2dbe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/nightly/fuels-ts
Submodule fuels-ts updated 321 files
6 changes: 4 additions & 2 deletions src/lib/plugins/mdbook-example-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ export function handleExampleImports(
}

try {
if (fileAbsPath.includes('/fuels-ts/demo')) {
fileAbsPath = fileAbsPath.replace('fuels-ts/demo', 'fuels-ts/apps/demo');
if (fileAbsPath.includes('/fuels-ts/')) {
fileAbsPath = fileAbsPath
.replace('fuels-ts/demo', 'fuels-ts/apps/demo')
.replace('fuels-ts/create-fuels-counter-guide', 'fuels-ts/apps/create-fuels-counter-guide');
}
const fileContent = fs.readFileSync(fileAbsPath, 'utf8');
const cachedFile = getFilesOnCache(fileAbsPath);
Expand Down
10 changes: 8 additions & 2 deletions src/lib/plugins/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ function handleTSDocs(
// handle TS book versions
conditions.tsBookVersions(node) ||
(node.type === 'code' && node.lang === 'ts:line-numbers') ||
(node.type === 'code' && !node.lang)
(node.type === 'code' && !node.lang) ||
node.type === 'image'
) {
// biome-ignore lint/suspicious/noExplicitAny:
nodes.push([node as any, idx ?? null, parent as Parent<any, any>]);
Expand All @@ -264,8 +265,13 @@ function handleTSDocs(
}
} else if (node.type === 'code' && node.lang === 'ts:line-numbers') {
node.lang = 'ts';
} else {
} else if (node.type === 'code' && !node.lang) {
node.lang = 'sh';
} else if (node.type === 'image') {
if (node.url.startsWith('../../public/')) {
const path = node.url.replace('../../public/', '').replace('.png', '');
node.url = `/api/image/${path}`;
}
}
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/api/image/[imageName].ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
} else if (req.headers.referer?.includes('/beta-4/')) {
versionSet = 'beta-4';
}
const walletPath = 'fuels-wallet/packages/docs';
const tsPath = 'fuels-ts/apps/docs/src';
const imagePath = `${rootDir}/docs/${
versionSet === 'default' ? '' : versionSet
}fuels-wallet/packages/docs/public/${realName}.png`;
}/${req.headers.referer?.includes('/fuels-ts/') ? tsPath : walletPath}/public/${realName}.png`;

if (fs.existsSync(imagePath)) {
res.setHeader('Content-Type', 'image/png');
Expand Down

0 comments on commit eaa2dbe

Please sign in to comment.