Skip to content

Commit 46c805c

Browse files
committed
update scripts and filename
1 parent 86c629f commit 46c805c

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

normalizeLinks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ function normalizeLinksInMarkdownFile(file, files) {
2929
to = `${to}.md`;
3030
}
3131

32+
to = to.replaceAll('/', path.sep);
33+
3234
// ensure simplest relative path
3335
// this removes trailing slash, so need to do this after the file name and extension checks above
3436
const absolute = path.resolve(relativeToDir, to);
@@ -38,6 +40,8 @@ function normalizeLinksInMarkdownFile(file, files) {
3840
// ensure the link we constructed above exists
3941
const toExists = relativeFiles.find(file => to === file);
4042

43+
to = to.replaceAll(path.sep, '/');
44+
4145
if(to !== from && toExists) {
4246
linkMap.set(from, to);
4347
}

renameFiles.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ function getFileMap(files) {
5454
function getLinkMap(fileMap, relativeToDir) {
5555
const linkMap = new Map();
5656
fileMap.forEach((toFile, fromFile) => {
57-
const fromRelFile = path.relative(relativeToDir, fromFile);
58-
const toRelFile = path.relative(relativeToDir, toFile);
57+
let fromRelFile = path.relative(relativeToDir, fromFile);
58+
fromRelFile = fromRelFile.replaceAll(path.sep, '/');
59+
60+
let toRelFile = path.relative(relativeToDir, toFile);
61+
toRelFile = toRelFile.replaceAll(path.sep, '/');
62+
5963
linkMap.set(fromRelFile, toRelFile);
6064
});
6165
return linkMap;
@@ -83,7 +87,7 @@ function renameLinksInRedirectsFile(fileMap) {
8387
}
8488

8589
function renameLinksInGatsbyConfigFile(fileMap, file) {
86-
const dir = 'src/pages';
90+
const dir = path.join('src', 'pages');
8791
replaceLinksInFile({
8892
file,
8993
linkMap: getLinkMap(fileMap, dir),

scriptUtils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const fs = require('node:fs');
33
const { globSync }= require('glob');
44

55
function getRedirectionsFilePath() {
6-
return path.resolve(__dirname + '/src/pages/redirects.json');
6+
const redirectionsFilePath = path.join(__dirname, 'src', 'pages', 'redirects.json');
7+
return path.resolve(redirectionsFilePath);
78
}
89

910
function readRedirectionsFile() {

src/pages/guides/services/services-add-api-jwt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
<InlineAlert slots="text"/>
44

5-
Service Account (JWT) credentials have been deprecated in favor of the OAuth Server-to-Server credentials. View our [migration guide](../authentication/ServerToServerAuthentication/migration.md) to know more. The new version of this guide that uses OAuth Server-to-Server credentials is now available here - [**Add API to project using OAuth Server-to-Server credentials**](../services/services-add-api-oauth-s2s.md).
5+
Service Account (JWT) credentials have been deprecated in favor of the OAuth Server-to-Server credentials. View our [migration guide](../authentication/ServerToServerAuthentication/migration.md) to know more. The new version of this guide that uses OAuth Server-to-Server credentials is now available here - [**Add API to project using OAuth Server-to-Server credentials**](services-add-api-oauth-s2s.md).
File renamed without changes.

0 commit comments

Comments
 (0)