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

Commit 5ddb83d

Browse files
prevent copy of .public to .public (#146)
* prevent copy of .public to .public * normalize functions and publish paths at entry point
1 parent e343288 commit 5ddb83d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { normalize } = require("path");
12
const prepareFolders = require("./lib/steps/prepareFolders");
23
const copyPublicFiles = require("./lib/steps/copyPublicFiles");
34
const copyNextAssets = require("./lib/steps/copyNextAssets");
@@ -18,8 +19,10 @@ const {
1819
*/
1920

2021
const nextOnNetlify = (options = {}) => {
21-
const functionsPath = options.functionsDir || NETLIFY_FUNCTIONS_PATH;
22-
const publishPath = options.publishDir || NETLIFY_PUBLISH_PATH;
22+
const functionsPath = normalize(
23+
options.functionsDir || NETLIFY_FUNCTIONS_PATH
24+
);
25+
const publishPath = normalize(options.publishDir || NETLIFY_PUBLISH_PATH);
2326

2427
const trackNextOnNetlifyFiles = prepareFolders({
2528
functionsPath,

lib/steps/copyPublicFiles.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ const copyPublicFiles = (publishPath) => {
88
if (!existsSync(PUBLIC_PATH)) return;
99

1010
// Perform copy operation
11-
logTitle("🌍️ Copying", PUBLIC_PATH, "folder to", publishPath);
12-
copySync(PUBLIC_PATH, publishPath);
11+
if (publishPath !== PUBLIC_PATH) {
12+
logTitle("🌍️ Copying", PUBLIC_PATH, "folder to", publishPath);
13+
copySync(PUBLIC_PATH, publishPath);
14+
}
1315
};
1416

1517
module.exports = copyPublicFiles;

0 commit comments

Comments
 (0)