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

prevent copy of .public to .public #146

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { normalize } = require("path");
const prepareFolders = require("./lib/steps/prepareFolders");
const copyPublicFiles = require("./lib/steps/copyPublicFiles");
const copyNextAssets = require("./lib/steps/copyNextAssets");
Expand All @@ -18,8 +19,10 @@ const {
*/

const nextOnNetlify = (options = {}) => {
const functionsPath = options.functionsDir || NETLIFY_FUNCTIONS_PATH;
const publishPath = options.publishDir || NETLIFY_PUBLISH_PATH;
const functionsPath = normalize(
options.functionsDir || NETLIFY_FUNCTIONS_PATH
);
const publishPath = normalize(options.publishDir || NETLIFY_PUBLISH_PATH);

const trackNextOnNetlifyFiles = prepareFolders({
functionsPath,
Expand Down
6 changes: 4 additions & 2 deletions lib/steps/copyPublicFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ const copyPublicFiles = (publishPath) => {
if (!existsSync(PUBLIC_PATH)) return;

// Perform copy operation
logTitle("🌍️ Copying", PUBLIC_PATH, "folder to", publishPath);
copySync(PUBLIC_PATH, publishPath);
if (publishPath !== PUBLIC_PATH) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should path.normalize() be used on both sides?

logTitle("🌍️ Copying", PUBLIC_PATH, "folder to", publishPath);
copySync(PUBLIC_PATH, publishPath);
}
};

module.exports = copyPublicFiles;