-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use correct publishDir when building from CLI with cwd option #1264
Conversation
🔮 Deploy Preview for netlify-plugin-nextjs-demo canceled.
|
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
👷 Deploy request for netlify-plugin-nextjs-static-root-demo pending review.Visit the deploys page to approve it
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I think it could be simplified a little.
Anything else to do here for merging? Wasn't sure with the failing checks and warning about the branch being out of date |
The failing e2e tests are expected! We just realized that secrets don't get shared to forks. |
Will them failing keep the automerge from working? |
This PR currently has a merge conflict. Please resolve this and then re-add the |
Summary
When building using the Netlify CLI with the cwd option, the

PUBLISH_DIR
is an absolute pathWithout the cwd option, it is a relative path

If it's an absolute path, it's a bug to join it on the
cwd
, this ends up injecting a path into the function that leads outside of the project. This change checks for if it's an absolute path before joining it.I also changed the value logged when the build cannot be found to print the full path instead of the relative path from the cwd; while debugging this, the value printing out for me was just "../.." which wasn't helpful.
Test plan
I've tested against the reproduction I made here https://github.com/lourd/netlify-cli-repro/blob/main/package.json#L9 and it works. I'm not sure how to make an automated demo test using the CLI.
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
Closes #1258.
Standard checks:
🧪 Once merged, make sure to update the version if needed and that it was published correctly.