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

Commit 2c54f8c

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

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
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: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ const {
33
existsSync,
44
readdirSync,
55
readFileSync,
6-
writeFileSync,
6+
rmdirSync,
77
removeSync,
8+
writeFileSync,
89
} = require("fs-extra");
910
const findCacheDir = require("find-cache-dir");
1011
const { NETLIFY_PUBLISH_PATH, NETLIFY_FUNCTIONS_PATH } = require("../config");
@@ -25,11 +26,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
2526
const [trackedFunctions, trackedPublish] = trackingFile.split(
2627
TRACKING_FILE_SEPARATOR
2728
);
28-
2929
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
3030
trackedFiles.forEach((file) => {
31-
const filePath = join(dirPath, file);
32-
if (file !== "" && existsSync(filePath)) {
31+
const filePath = join(dirPath, file.trim("\r"));
32+
if (file !== "") {
33+
if (process.platform === "win32") {
34+
rmdirSync(filePath, { recursive: true });
35+
}
3336
removeSync(filePath);
3437
}
3538
});

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)