Skip to content

Commit

Permalink
Win path support for v2 (#53)
Browse files Browse the repository at this point in the history
* Added slash function to the output to fix double slashes issue on Windows

* Changed the rm -rf to rimraf and included dependencies

---------

Co-authored-by: BA <[email protected]>
  • Loading branch information
Daguima-dag and daguima authored May 8, 2023
1 parent 2440820 commit 5af9ac7
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 3 deletions.
339 changes: 339 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run clean && tsc -d",
"watch": "npm run clean && tsc --watch",
"clean": "rm -rf dist",
"clean": "rimraf ./dist",
"prepare": "npm run build"
},
"keywords": [
Expand Down Expand Up @@ -40,7 +40,8 @@
"@types/slash": "3.0.0",
"@types/traverse": "0.6.32",
"@types/unist": "2.0.3",
"typescript": "4.0.2"
"typescript": "4.0.2",
"rimraf": "^3.0.2"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion src/on-create-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
MarkdownNode,
findMatchingFile,
} from '.';
import { slash } from './utils';

export type GatsbyPluginArgs = {
node: MarkdownNode;
Expand Down Expand Up @@ -52,7 +53,7 @@ export const onCreateNode = (

const file = findMatchingFile(value, files, options);

const newValue = path.relative(directory, file.absolutePath);
const newValue = slash(path.relative(directory, file.absolutePath));

this.update(newValue);
});
Expand Down

0 comments on commit 5af9ac7

Please sign in to comment.