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 5ddb83d

Browse filesBrowse 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
Copy full SHA for 5ddb83d

File tree

Expand file treeCollapse file tree

2 files changed

+9
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-4
lines changed

‎index.js

Copy file name to clipboardExpand all lines: index.js
+5-2Lines changed: 5 additions & 2 deletions
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

Copy file name to clipboardExpand all lines: lib/steps/copyPublicFiles.js
+4-2Lines changed: 4 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.