Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 2ca0caf

Browse files
committed
fix failing windows test for file tracking
1 parent dfb0eac commit 2ca0caf

File tree

5 files changed

+54
-14
lines changed

5 files changed

+54
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The plugin can be found on [npm here](https://www.npmjs.com/package/@netlify/plu
5050
- [Using Netlify Identity](#using-netlify-identity)
5151
- [Caveats](#caveats)
5252
- [Fallbacks for Pages with `getStaticPaths`](#fallbacks-for-pages-with-getstaticpaths)
53-
- [next/image](#next/image)
53+
- [next/image](#nextimage)
5454
- [Credits](#credits)
5555
- [Showcase](#showcase)
5656

lib/helpers/handleFileTracking.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
const { join } = require("path");
22
const {
3+
emptyDirSync,
34
existsSync,
45
readdirSync,
56
readFileSync,
6-
writeFileSync,
7+
rmdirSync,
78
removeSync,
9+
writeFileSync,
810
} = require("fs-extra");
911
const findCacheDir = require("find-cache-dir");
1012
const { NETLIFY_PUBLISH_PATH, NETLIFY_FUNCTIONS_PATH } = require("../config");
@@ -25,12 +27,16 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
2527
const [trackedFunctions, trackedPublish] = trackingFile.split(
2628
TRACKING_FILE_SEPARATOR
2729
);
28-
2930
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
3031
trackedFiles.forEach((file) => {
31-
const filePath = join(dirPath, file);
32-
if (file !== "" && existsSync(filePath)) {
33-
removeSync(filePath);
32+
const filePath = join(dirPath, file.trim("\r"));
33+
if (file !== "") {
34+
if (process.platform === "win32") {
35+
rmdirSync(filePath, { recursive: true });
36+
removeSync(filePath);
37+
} else {
38+
removeSync(filePath);
39+
}
3440
}
3541
});
3642
};

package-lock.json

Lines changed: 41 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/fixtures/.nonfiletracking

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
next_shows_id
2+
next_image.js
23
---

tests/fixtures/my-functions/next_image.js

Whitespace-only changes.

0 commit comments

Comments
 (0)