From 943395d5db1ebea1c11f880663ba0b228c41ca0d Mon Sep 17 00:00:00 2001 From: Sarah Schwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Wed, 9 Aug 2023 09:59:11 -0600 Subject: [PATCH] fix: update versions to latest compatible (#26) --- docs/builds/sway | 2 +- docs/fuel-indexer | 2 +- docs/fuels-rs | 2 +- docs/fuels-ts | 2 +- docs/sway | 2 +- scripts/clean-build-files.sh | 2 +- scripts/sync-repos.sh | 4 +++ src/components/List.tsx | 4 --- src/lib/md-doc.ts | 6 +++- src/lib/md-parser.ts | 4 +++ src/lib/plugins/mdbook-example-import.ts | 8 ++++- src/lib/plugins/plugins.ts | 3 +- src/lib/plugins/ts-versions.ts | 39 ------------------------ 13 files changed, 27 insertions(+), 53 deletions(-) delete mode 100644 src/lib/plugins/ts-versions.ts diff --git a/docs/builds/sway b/docs/builds/sway index da671915..ce8c1fe7 160000 --- a/docs/builds/sway +++ b/docs/builds/sway @@ -1 +1 @@ -Subproject commit da67191575b0a555ea95eb9249753eeadae4644e +Subproject commit ce8c1fe78a69f988e72d7d0aac2dbebf5ed60a98 diff --git a/docs/fuel-indexer b/docs/fuel-indexer index 006a1102..af26434f 160000 --- a/docs/fuel-indexer +++ b/docs/fuel-indexer @@ -1 +1 @@ -Subproject commit 006a11023de4d24f4e7f832ef63ce6a17a25f672 +Subproject commit af26434f536a73d16e1d1f4e7d5a7b89b81bf033 diff --git a/docs/fuels-rs b/docs/fuels-rs index f6b43273..31381724 160000 --- a/docs/fuels-rs +++ b/docs/fuels-rs @@ -1 +1 @@ -Subproject commit f6b43273bfe364e3092dbdeefe78a003ea7446a2 +Subproject commit 31381724c94e01613f361981dc557e4548a4a48d diff --git a/docs/fuels-ts b/docs/fuels-ts index 59d5c657..51bcfda6 160000 --- a/docs/fuels-ts +++ b/docs/fuels-ts @@ -1 +1 @@ -Subproject commit 59d5c6577ecc1e61edf8dd3dbc77222eda2df208 +Subproject commit 51bcfda69c68b0d9898f34fb2cdd7814a5229ac3 diff --git a/docs/sway b/docs/sway index fc34cb53..3b66f8e4 160000 --- a/docs/sway +++ b/docs/sway @@ -1 +1 @@ -Subproject commit fc34cb537ecb0fb1ccd5354c16ced2c601b0a1b9 +Subproject commit 3b66f8e424bd21e3ba467783b10b36e808cfa6ee diff --git a/scripts/clean-build-files.sh b/scripts/clean-build-files.sh index 658e7d4c..e50ba8b4 100644 --- a/scripts/clean-build-files.sh +++ b/scripts/clean-build-files.sh @@ -5,4 +5,4 @@ rm -rf ./docs/builds/sway/v* rm -rf ./docs/builds/sway/latest # generate sidebar links -pnpm generate:links +pnpm generate:links \ No newline at end of file diff --git a/scripts/sync-repos.sh b/scripts/sync-repos.sh index 2d1026c8..a7d461be 100644 --- a/scripts/sync-repos.sh +++ b/scripts/sync-repos.sh @@ -1,3 +1,7 @@ #!/bin/bash git submodule update --init + +# TODO: Remove after fuels-rs version updated past 43 +cd docs/fuels-rs +git cherry-pick 989026923b7cca989bf93a7aae481b04e7be915a diff --git a/src/components/List.tsx b/src/components/List.tsx index 5fe3594c..a493379d 100644 --- a/src/components/List.tsx +++ b/src/components/List.tsx @@ -42,9 +42,5 @@ const styles = { pl: '$1', lineHeight: '1.7', }, - - '& li > p': { - display: 'inline', - }, }), }; diff --git a/src/lib/md-doc.ts b/src/lib/md-doc.ts index 24450fa9..c8de613c 100644 --- a/src/lib/md-doc.ts +++ b/src/lib/md-doc.ts @@ -31,7 +31,11 @@ export class Doc { } const config = this.#getConfig(item.slug); - const pageLink = join(config.repository, item._raw.flattenedPath); + const splitPath = item._raw.flattenedPath.split('/'); + splitPath.splice(0, 2); + splitPath.pop(); + const actualPath = 'tree/master/' + splitPath.join('/'); + const pageLink = join(config.repository, actualPath); this.md = item; this.config = config; diff --git a/src/lib/md-parser.ts b/src/lib/md-parser.ts index acbd3dd8..2520d0ac 100644 --- a/src/lib/md-parser.ts +++ b/src/lib/md-parser.ts @@ -50,6 +50,10 @@ export class DocParser { } slug = slug.replace('README', 'index'); + // TODO: Remove after fixed + if (slug === 'docs/fuels-rs/contributing/contributing') { + slug = 'docs/fuels-rs/contributing'; + } return slug; } } diff --git a/src/lib/plugins/mdbook-example-import.ts b/src/lib/plugins/mdbook-example-import.ts index ecbd1d9c..c3b08797 100644 --- a/src/lib/plugins/mdbook-example-import.ts +++ b/src/lib/plugins/mdbook-example-import.ts @@ -103,7 +103,7 @@ export function handleExampleImports( } const bookPath = dirname.split('/')[1]; - const fileAbsPath = path.resolve( + let fileAbsPath = path.resolve( path.join(rootDir, `docs/${bookPath}/`), filePath ); @@ -118,6 +118,12 @@ export function handleExampleImports( } try { + if (fileAbsPath.includes('docs/fuels-ts/demo-typegen/')) { + fileAbsPath = fileAbsPath.replace( + 'fuels-ts/demo-typegen', + 'fuels-ts/apps/demo-typegen' + ); + } const fileContent = fs.readFileSync(fileAbsPath, 'utf8'); const cachedFile = getFilesOnCache(fileAbsPath); diff --git a/src/lib/plugins/plugins.ts b/src/lib/plugins/plugins.ts index 4996ce16..ecb6e61e 100644 --- a/src/lib/plugins/plugins.ts +++ b/src/lib/plugins/plugins.ts @@ -4,12 +4,12 @@ import { join } from 'path'; import type { Root } from 'remark-gfm'; import { visit } from 'unist-util-visit'; import type { Parent } from 'unist-util-visit/lib'; +import { versions } from '~/docs/fuels-ts/packages/versions/src'; import { handleForcGenDocs } from './forc-gen-docs'; import { handleLinks } from './links'; import { handleExampleImports } from './mdbook-example-import'; import { handleScriptLink } from './ts-docs'; -import { loadTSVersions } from './ts-versions'; import { handleDemoComp, handlePlayerComp, @@ -150,7 +150,6 @@ export function handlePlugins() { } if (filepath.includes('/fuels-ts/')) { - const versions = loadTSVersions(rootDir); // handle injected link urls if (hasScriptLink(tree.children[0])) { tree = handleScriptLink(tree, versions); diff --git a/src/lib/plugins/ts-versions.ts b/src/lib/plugins/ts-versions.ts deleted file mode 100644 index 4f61bed3..00000000 --- a/src/lib/plugins/ts-versions.ts +++ /dev/null @@ -1,39 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -export function loadTSVersions(rootDir: string) { - const versions = { - FORC: '0.0.0', - FUELS: '0.0.0', - FUEL_CORE: '0.0.0', - }; - - try { - const forcBinPath = path.join( - rootDir, - 'docs/fuels-ts/packages/forc-bin/package.json' - ); - const forcFile = fs.readFileSync(forcBinPath, 'utf8'); - const { config } = JSON.parse(forcFile); - ({ forcVersion: versions.FORC } = config); - - const fuelsPath = path.join( - rootDir, - 'docs/fuels-ts/packages/fuels/package.json' - ); - const fuelsFile = fs.readFileSync(fuelsPath, 'utf8'); - ({ version: versions.FUELS } = JSON.parse(fuelsFile)); - - const dockerfilePath = path.join( - rootDir, - 'docs/fuels-ts/.docker/fuel-core/Dockerfile' - ); - const dockerfile = fs.readFileSync(dockerfilePath, 'utf8'); - const regexFuelcore = /FROM ghcr\.io\/fuellabs\/fuel-core:v(\d+\.\d+\.\d+)/; - const match = dockerfile.match(regexFuelcore); - versions.FUEL_CORE = match?.[1] || versions.FUEL_CORE; - } catch { - return versions; - } - return versions; -}