Skip to content

Commit 97e0137

Browse files
nzakassrijan-deepsource
authored andcommitted
chore: Refactor docs to work with docs.eslint.org (eslint#15744)
* chore: Refactor docs to work with docs.eslint.org * Fix Makefile.js * fix copying of files * Fix edit links and copying commands
1 parent 1c9970a commit 97e0137

File tree

382 files changed

+9
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

382 files changed

+9
-5
lines changed

Makefile.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ target.gensite = function(prereleaseVersion) {
622622

623623
// 3. Copy docs folder to a temporary directory
624624
echo("> Copying the docs folder (Step 3)");
625-
cp("-rf", "docs/*", TEMP_DIR);
625+
cp("-rf", "docs/src/*", TEMP_DIR);
626+
627+
// special case (for now)
628+
cp("-f", "docs/src/pages/index.md", path.join(TEMP_DIR, "index.md"));
629+
rm("-rf", path.join(TEMP_DIR, "pages"));
626630

627631
let versions = test("-f", "./versions.json") ? JSON.parse(cat("./versions.json")) : {};
628632

@@ -650,12 +654,12 @@ target.gensite = function(prereleaseVersion) {
650654

651655
const rulesUrl = "https://github.com/eslint/eslint/tree/HEAD/lib/rules/",
652656
testsUrl = "https://github.com/eslint/eslint/tree/HEAD/tests/lib/rules/",
653-
docsUrl = "https://github.com/eslint/eslint/tree/HEAD/docs/rules/",
657+
docsUrl = "https://github.com/eslint/eslint/tree/HEAD/docs/src/rules/",
654658
baseName = path.basename(filename),
655659
sourceBaseName = `${path.basename(filename, ".md")}.js`,
656660
sourcePath = path.join("lib/rules", sourceBaseName),
657661
ruleName = path.basename(filename, ".md"),
658-
filePath = path.join("docs", path.relative("tmp", filename));
662+
filePath = path.posix.join("docs", path.relative("tmp", filename));
659663
let text = cat(filename),
660664
ruleType = "",
661665
title;
@@ -697,7 +701,7 @@ target.gensite = function(prereleaseVersion) {
697701
"---",
698702
`title: ${title}`,
699703
"layout: doc",
700-
`edit_link: https://github.com/eslint/eslint/edit/main/${filePath}`,
704+
`edit_link: https://github.com/eslint/eslint/edit/main/${filePath.replace("docs/", "docs/src/")}`,
701705
ruleType,
702706
"---",
703707
"<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->",
@@ -789,7 +793,7 @@ target.checkRuleFiles = function() {
789793

790794
RULE_FILES.forEach(filename => {
791795
const basename = path.basename(filename, ".js");
792-
const docFilename = `docs/rules/${basename}.md`;
796+
const docFilename = `docs/src/rules/${basename}.md`;
793797
const docText = cat(docFilename);
794798
const docMarkdown = marked.lexer(docText, { gfm: true, silent: false });
795799
const ruleCode = cat(filename);

0 commit comments

Comments
 (0)