Skip to content

Commit 88b13dc

Browse files
committed
fix(docs): build
1 parent f56891d commit 88b13dc

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

packages/docs/docs/main/change-log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This page lists the changes to the IsaacScript framework.
99

1010
<br />
1111

12-
## November 1st, 2023 (Unreleased)
12+
## November 2nd, 2023
1313

1414
- Helper functions that deal with randomness now require you to pass the seed. If you want unseeded behavior, then you must explicitly pass `undefined`.
1515
- Added the following helper functions:

packages/docs/scripts/fixIsaacScriptCommon.mts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import {
4444
echo,
4545
makeDirectory,
4646
readFile,
47+
renameFile,
48+
writeFile,
4749
} from "isaacscript-common-node";
4850
import {
4951
assertDefined,
@@ -169,7 +171,7 @@ See the [ModCallbackCustom](/isaacscript-common/other/enums/ModCallbackCustom) e
169171
`
170172
.trim()
171173
.concat("\n");
172-
fs.writeFileSync(filePath, fileContent);
174+
writeFile(filePath, fileContent);
173175
}
174176

175177
/** Move the files in the "modules" directory to proper directories. */
@@ -201,7 +203,7 @@ function moveModulesFiles() {
201203
const dstDirectory = path.join(PACKAGE_DOCS_DIR, directoryName);
202204
makeDirectory(dstDirectory);
203205
const dstPath = path.join(dstDirectory, newFileName);
204-
fs.renameSync(markdownFilePath, dstPath);
206+
renameFile(markdownFilePath, dstPath);
205207

206208
if (DEBUG) {
207209
echo(`Moved:\n ${markdownFilePath}\n -->\n ${dstPath}`);
@@ -244,7 +246,7 @@ function moveDirsToOther() {
244246
for (const otherDirName of OTHER_DIR_NAMES) {
245247
const srcPath = path.join(PACKAGE_DOCS_DIR, otherDirName);
246248
const dstPath = path.join(OTHER_DIR, otherDirName);
247-
fs.renameSync(srcPath, dstPath);
249+
renameFile(srcPath, dstPath);
248250
}
249251
}
250252

@@ -260,7 +262,7 @@ function addCategoryFile(directoryPath: string) {
260262
if (position !== undefined) {
261263
fileContents += `position: ${position}\n`;
262264
}
263-
fs.writeFileSync(categoryFilePath, fileContents);
265+
writeFile(categoryFilePath, fileContents);
264266
}
265267

266268
function addMarkdownHeader(filePath: string, directoryName: string) {
@@ -292,7 +294,7 @@ custom_edit_url: null
292294
fileContents = lines.join("\n");
293295

294296
const newFileContents = header + fileContents;
295-
fs.writeFileSync(filePath, newFileContents);
297+
writeFile(filePath, newFileContents);
296298
}
297299

298300
function getTitle(filePath: string, directoryName: string) {
@@ -345,14 +347,14 @@ function renameSpecialPages() {
345347
"features_other_extraConsoleCommands_commands.md",
346348
);
347349
const newPath = path.join(FEATURES_DIR, "ExtraConsoleCommandsList.md");
348-
fs.renameSync(oldPath, newPath);
350+
renameFile(oldPath, newPath);
349351

350352
const contents = readFile(newPath);
351353
const newContents = contents.replace(
352354
"# features_other_extraConsoleCommands_commands",
353355
"# Extra Console Commands (List)",
354356
);
355-
fs.writeFileSync(newPath, newContents);
357+
writeFile(newPath, newContents);
356358
}
357359

358360
function deleteDuplicatedPages() {
@@ -412,7 +414,7 @@ function renameDuplicatedPages() {
412414
properPath = path.join(FEATURES_DIR, properName);
413415
}
414416

415-
fs.renameSync(filePath, properPath);
417+
renameFile(filePath, properPath);
416418

417419
if (DEBUG) {
418420
echo(`Renamed:\n ${filePath}\n -->\n ${properPath}`);
@@ -433,7 +435,8 @@ function fixLinks() {
433435
const markdownFilePaths = globSync("**/*.md", { cwd: PACKAGE_DOCS_DIR });
434436

435437
for (const filePath of markdownFilePaths) {
436-
const fileContents = readFile(filePath);
438+
const fullFilePath = path.join(PACKAGE_DOCS_DIR, filePath);
439+
const fileContents = readFile(fullFilePath);
437440
let newFileContents = fileContents;
438441

439442
// Start by removing any links with a "modules" prefix, since they are moved to the root.
@@ -472,7 +475,8 @@ function fixLinks() {
472475
newFileContents = newFileContents.replaceAll(brokenLink, fixedLink);
473476
}
474477

475-
const numDirectoriesAwayFromRoot = getNumDirectoriesAwayFromRoot(filePath);
478+
const numDirectoriesAwayFromRoot =
479+
getNumDirectoriesAwayFromRoot(fullFilePath);
476480
const linkPrefix = "../".repeat(numDirectoriesAwayFromRoot);
477481

478482
for (const brokenLinkDirName of BROKEN_LINK_DIR_NAMES) {
@@ -496,7 +500,7 @@ function fixLinks() {
496500
newFileContents = newFileContents.replaceAll(/types_\w+\./gm, "");
497501

498502
if (fileContents !== newFileContents) {
499-
fs.writeFileSync(filePath, newFileContents);
503+
writeFile(fullFilePath, newFileContents);
500504
}
501505
}
502506
}

0 commit comments

Comments
 (0)