forked from 11ty/eleventy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
11ty#1312 Improve situation for dependency monitoring
This change adds a "PathNormalizer" with tests which converts all paths to be unix compatible (replace "\" with "/"). That way auto reloading dependencies of the config also works on windows. Sadly nested dependencies still always lag exactly one update behind, so if you have the following dependency graph: - .eleventy.js depends on - middle.js depends on - nested.js and you update nested, you see the following: - do update 1 -> no result - do update 2 -> see update 1 - do update 3 -> see update 2 During a short lookaround, I was unable to resolve this issue. Signed-off-by: Raphael Höser <[email protected]>
- Loading branch information
1 parent
8674f34
commit 0b88d19
Showing
4 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const path = require("path"); | ||
|
||
class PathNormalizer { | ||
static normalizeSeperator(inputPath) { | ||
if (!inputPath) { | ||
return inputPath; | ||
} | ||
return inputPath.split(path.sep).join("/"); | ||
} | ||
} | ||
|
||
module.exports = PathNormalizer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const test = require("ava"); | ||
const PathNormalizer = require("../src/Util/PathNormalizer"); | ||
|
||
test("PathNormalize Seperator", (t) => { | ||
t.is(PathNormalizer.normalizeSeperator("."), "."); | ||
t.is(PathNormalizer.normalizeSeperator("a/b"), "a/b"); | ||
t.is(PathNormalizer.normalizeSeperator("a\\b"), "a/b"); | ||
t.is(PathNormalizer.normalizeSeperator("a\\b/c"), "a/b/c"); | ||
t.is(PathNormalizer.normalizeSeperator(undefined), undefined); | ||
}); |