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: nightly fuels-ts docs API changes breaking the CI #584

Merged
merged 6 commits into from
Feb 7, 2025
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"export": "DOCS_DIST=${DOCS_DIST:=dist} next export -o $DOCS_DIST",
"generate:links": "node scripts/generate-links/index.mjs",
"generate:components": "node scripts/components.mjs",
"generate:sitemap": "run-s build:content sitemap",
"generate:sitemap": "run-s patch:ts build:content sitemap",
"sitemap": "node scripts/generate-sitemap/index.mjs",
"lint": "biome check --apply-unsafe .",
"lint:fix": "biome format --write .",
"lint:prod": "biome lint --max-diagnostics=1000 --diagnostic-level=error .",
"prepare": "husky install && pnpm copy:icons",
"start": "next start",
"patch:wallet": "node scripts/wallet-patch-fixes/index.mjs",
"patch:ts": "node scripts/ts-patch-fixes/index.mjs",
"test:guides": "npx playwright test tests/test.spec.ts",
"test:guides:debug": "DEBUG=pw:api npx playwright test tests/test.spec.ts",
"ts:check": "tsc --noEmit",
Expand Down
28 changes: 28 additions & 0 deletions scripts/ts-patch-fixes/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
import { globby } from 'globby';
import { cwd } from 'process';

const pathsAndUrls = new Map([
[
join(cwd(), 'docs/fuels-ts/apps/docs/src'),
'https://fuels-ts-docs-api.vercel.app',
],
[
join(cwd(), 'docs/nightly/fuels-ts/apps/docs/src'),
'https://fuels-ts-docs-api-nightly.vercel.app',
],
]);

for (const [docsPath, url] of pathsAndUrls) {
const filepaths = await globby(['**.md'], {
cwd: docsPath,
});

filepaths.forEach((filepath) => {
const path = join(docsPath, filepath);
const file = readFileSync(path).toString();

writeFileSync(path, file.replace(/DOCS_API_URL/g, url));
});
}
6 changes: 5 additions & 1 deletion scripts/update-nightly/updateSubmodules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export async function updateSubmodules(newDefaultVersions, newNightlyVersions) {
'docs/nightly/fuel-specs',
'docs/nightly/fuel-graphql-docs',
'docs/nightly/migrations-and-disclosures',
'docs/nightly/fuels-ts',
Copy link
Contributor Author

@nedsalk nedsalk Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition ensures that every call to the update-nightly workflow updates the nightly fuels-ts version. I only added fuels-ts and not the other repositories that have nightly versions because:

  1. I want to keep the focus on the API docs issue which is fuels-ts-specific,
  2. fuels-ts is the only repository in the versions.json file that calls the update-nightly workflow (reference).

Important

This will still require manual merging of the nightly docs PR - nothing changed about that.


Handling of the other nightly versions more appropriately would be done via

];
await Promise.all(
updateRegardless.map(async (sub) => {
Expand Down Expand Up @@ -73,7 +74,10 @@ async function updateDocs(versions, isNightly) {
submoduleName = `docs${isNightly ? '/nightly' : ''}/fuels-rs`;
break;
case 'ts':
submoduleName = `docs${isNightly ? '/nightly' : ''}/fuels-ts`;
if (isNightly) {
return;
}
submoduleName = 'docs/fuels-ts';
break;
case 'wallet':
submoduleName = `docs${isNightly ? '/nightly' : ''}/fuels-wallet`;
Expand Down
Loading