diff --git a/.husky/pre-commit b/.husky/pre-commit index 056e73eb2b..b451f1ed26 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -4,6 +4,6 @@ npm run format:fix npm run lint:fix npm run typecheck -npm run update-toc +npm run generate:toc git add . diff --git a/package.json b/package.json index 90bc5b6d53..4313ae4f42 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "typecheck": "tsc --project tsconfig.json --noEmit", "prepare": "husky install", "jest-preview": "jest-preview", - "update-toc": "node scripts/update-toc.js" + "generate:toc": "find . -maxdepth 1 -name '*.md' -exec markdown-toc -i {} --bullets \"-\" \\;" }, "eslintConfig": { "extends": [ diff --git a/scripts/update-toc.js b/scripts/update-toc.js deleted file mode 100644 index 2b4e4f9b83..0000000000 --- a/scripts/update-toc.js +++ /dev/null @@ -1,13 +0,0 @@ -import fs from 'fs'; -import { execSync } from 'child_process'; - -const markdownFiles = fs - .readdirSync('./') - .filter((file) => file.endsWith('.md')); - -markdownFiles.forEach((file) => { - const command = `markdown-toc -i "${file}" --bullets "-"`; - execSync(command, { stdio: 'inherit' }); -}); - -console.log('Table of contents updated successfully.');