Skip to content

Commit

Permalink
Normalize to forward slashes on Windows too. Eleventy normalizes this…
Browse files Browse the repository at this point in the history
… in post but this change fixes the CI tests on Windows too.
  • Loading branch information
zachleat committed Aug 25, 2023
1 parent b841c9f commit 64da172
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require("path");
const { TemplatePath } = require("@11ty/eleventy-utils");

function getAbsolutePath(filename) {
let normalizedFilename = path.normalize(filename); // removes dot slash
Expand Down Expand Up @@ -113,7 +114,14 @@ function getDependenciesFor(filename, avoidCircular, optionsArg = {}) {
}

function getCleanDependencyListFor(filename, options = {}) {
return Array.from( getDependenciesFor(filename, null, options) );
let deps = Array.from( getDependenciesFor(filename, null, options) );

return deps.map(filePath => {
if(filePath.startsWith("./")) {
return TemplatePath.standardizeFilePath(filePath);
}
return filePath; // node_module name
});
}

module.exports = getCleanDependencyListFor;
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
"devDependencies": {
"@sindresorhus/is": "^4.6.0",
"ava": "^5.3.1"
},
"dependencies": {
"@11ty/eleventy-utils": "^1.0.2"
}
}

0 comments on commit 64da172

Please sign in to comment.