Skip to content

Serve build output using Netlify CLI in postBuild stage #146

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

Closed
alexjfno1 opened this issue Mar 5, 2021 · 6 comments · Fixed by #151 or #171
Closed

Serve build output using Netlify CLI in postBuild stage #146

alexjfno1 opened this issue Mar 5, 2021 · 6 comments · Fixed by #151 or #171
Labels
enhancement New feature or request released

Comments

@alexjfno1
Copy link
Contributor

Describe the solution you'd like
We'd like to run the Cypress tests on post build so that we can ensure the files are built correctly. We have recently added some headers in the _headers file that we'd like to test using cypress. This means that we need to serve the build output using npx netlify dev. I can see a way to do this in the preBuild step but not on postBuild.

@bahmutov
Copy link
Contributor

bahmutov commented Mar 5, 2021

Does netlify CLI have a command similar to serve that serves the built folder BUT with functions and redirects? Because netlify dev would work great in preBuild step

@bahmutov bahmutov added the enhancement New feature or request label Mar 5, 2021
@alexjfno1
Copy link
Contributor Author

I'm not sure about functions but it does respect the _headers file. I was thinking that it could allow you to pass a custom command the same and start in the preBuild options. preBuild doesn't work for us as we want to serve the built assets from the Netlify build.

@bahmutov
Copy link
Contributor

bahmutov commented Mar 8, 2021

Hmm, I am not sure I understand how that would work. If you do

npx netlify build
npx netlify dev

Doesn't it serve the unbundled output and completely ignores the built dist folder? So it would be the same as simply npx netlify dev? I don't see any docs that would explain the difference.

@alexjfno1
Copy link
Contributor Author

Currently the plugin allows a start argument in the preBuild which runs the command you specify. I'm proposing that you allow a start argument in the postBuild as well with the same functionality which runs whatever command you specify. Does that make sense?

@alexjfno1
Copy link
Contributor Author

@bahmutov just to let you know I'm preparing a PR for this that should be finished in the next day or two.

alexjfno1 pushed a commit to alexjfno1/netlify-plugin-cypress that referenced this issue Mar 10, 2021
alexjfno1 pushed a commit to alexjfno1/netlify-plugin-cypress that referenced this issue Mar 10, 2021
alexjfno1 pushed a commit to alexjfno1/netlify-plugin-cypress that referenced this issue Mar 10, 2021
@bahmutov
Copy link
Contributor

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
2 participants