Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 3edc992

Browse filesBrowse files
fix failing windows test for file tracking (#142)
1 parent dfb0eac commit 3edc992
Copy full SHA for 3edc992

File tree

Expand file treeCollapse file tree

4 files changed

+10
-5
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+10
-5
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-1Lines 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

Copy file name to clipboardExpand all lines: lib/helpers/handleFileTracking.js
+8-4Lines changed: 8 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");
@@ -18,18 +19,21 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
1819
const isConfiguredPublishDir = publishPath !== NETLIFY_PUBLISH_PATH;
1920

2021
const cacheDir = findCacheDir({ name: "next-on-netlify", create: true });
22+
if (!cacheDir) return () => {};
2123
const trackingFilePath = join(cacheDir, ".nonfiletracking");
2224

2325
if (existsSync(trackingFilePath)) {
2426
const trackingFile = readFileSync(trackingFilePath, "utf8");
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)) {
32+
const filePath = join(dirPath, file.trim("\r"));
33+
if (file !== "") {
34+
if (process.platform === "win32") {
35+
rmdirSync(filePath, { recursive: true });
36+
}
3337
removeSync(filePath);
3438
}
3539
});

‎tests/fixtures/.nonfiletracking

Copy file name to clipboard
+1Lines 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

Copy file name to clipboardExpand all lines: tests/fixtures/my-functions/next_image.js
Whitespace-only changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.