From a0cd0c8393457617583db935f3ab090d6949b226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Wed, 2 Oct 2024 20:07:58 -0300 Subject: [PATCH] docs: adjustments to new doc snippets infra (#3238) --- .eslintignore | 1 - .prettierrc | 9 ++++++++- apps/docs-snippets2/scripts/wrap-snippets.ts | 10 ++-------- apps/docs/nodemon.config.json | 15 +++++++++++++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.eslintignore b/.eslintignore index 5a12f6796af..2f9746e2918 100644 --- a/.eslintignore +++ b/.eslintignore @@ -13,7 +13,6 @@ apps/demo-react-cra apps/demo-react-vite apps/create-fuels-counter-guide apps/docs-snippets2/src/typegend -apps/docs-snippets2/src/**/*.wrapped.ts packages/fuels/src/cli/commands/deploy/proxy packages/fuels/test/fixtures/project diff --git a/.prettierrc b/.prettierrc index 7ea88fcd47a..b33f0339180 100644 --- a/.prettierrc +++ b/.prettierrc @@ -24,6 +24,13 @@ "options": { "useTabs": false } + }, + { + "files": ["apps/docs-snippets2/src/**/*.ts"], + "excludeFiles": ["apps/docs-snippets2/src/**/*.test.ts"], + "options": { + "printWidth": 80 + } } ] -} \ No newline at end of file +} diff --git a/apps/docs-snippets2/scripts/wrap-snippets.ts b/apps/docs-snippets2/scripts/wrap-snippets.ts index ad37fc15cb4..4f2db820032 100644 --- a/apps/docs-snippets2/scripts/wrap-snippets.ts +++ b/apps/docs-snippets2/scripts/wrap-snippets.ts @@ -74,7 +74,7 @@ export const wrapSnippet = (filepath: string) => { const wrappedSnippet = // eslintDisableRule + wrapperFnContents - .replace('%IMPORTS%', imports) + .replace('// %IMPORTS%', imports) .replace('%NAME%', basename(filepath)) .replace('// %SNIPPET%', indented) .replace('// %NODE_LAUNCHER%', nodeLauncher) @@ -97,12 +97,6 @@ export const wrapSnippet = (filepath: string) => { */ const dir = 'src/**'; const src = `${dir}/*.ts`; -const ignore = [ - `src/typegend/**`, - `src/env.ts`, - `src/transactions/new-api.ts`, - `${dir}/*.test.ts`, - `${dir}/*.wrapped.ts`, -]; +const ignore = [`src/typegend/**`, `src/env.ts`, `src/transactions/new-api.ts`, `${dir}/*.test.ts`]; globSync(src, { ignore }).forEach(wrapSnippet); diff --git a/apps/docs/nodemon.config.json b/apps/docs/nodemon.config.json index ab2d2ac8620..1376f672752 100644 --- a/apps/docs/nodemon.config.json +++ b/apps/docs/nodemon.config.json @@ -1,6 +1,17 @@ { "verbose": true, "ext": "ts", - "watch": ["../../packages", "../docs-snippets"], - "ignore": ["**/*.d.ts", "**/*.map", "**/*.js", "**/out/release/**"] + "watch": [ + "../../packages", + "../docs-snippets", + "../docs-snippets2/src", + "../docs-snippets2/sway" + ], + "ignore": [ + "**/*.d.ts", + "**/*.map", + "**/*.js", + "**/out/release/**", + "../docs-snippets2/**/*.test.ts" + ] }