-
Notifications
You must be signed in to change notification settings - Fork 86
fix: skip plugin if build command is empty #471
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
Conversation
helpers/doesNotNeedPlugin.js
Outdated
@@ -6,6 +6,11 @@ const doesNotNeedPlugin = ({ netlifyConfig, packageJson }) => { | |||
const { build } = netlifyConfig | |||
const { scripts = {} } = packageJson | |||
|
|||
if (!build.command) { | |||
console.log("No build command specified in the site's Netlify config. Skipping plugin") |
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.
should we maybe make this more noticeable somehow? i feel like it might get lost or like it might rly be worthy of a build failure. if we were going to fail the build tho, this check would have to come after/outside of doesNotNeedPlugin
. therefore, we'd establish, ok, yes, so this site does need the plugin. it needs a build command for the plugin to work. then we could do the check, and then we should probably fail the build if it doesn't exist.
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.
The reason I didn't make it fail the build is because of the auto-install. It might be a site that somebody is building elsewhere, doing an export, then deploying. "doesNotNeedPlugin
" wouldn't catch that scenario, because the command could be run elsewhere so wouldn;t show up in the config
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.
Maybe just making it bright red or something
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.
if doesNotNeedPlugin doesn't catch that scenario, wouldnt that just fail blindly anyways?
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.
It would fail because of this check, so if we moved it then it wouldn't fail.
c21847a
to
84dc6f5
Compare
if (!build.command) { | ||
console.log( | ||
redBright`⚠️ Warning: No build command specified in the site's Netlify config, so plugin will not run. This deploy will fail unless you have already exported the site. ⚠️`, | ||
) |
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.
@lindsaylevine How about this? It also shows up in the build status now.
If the build command is empty then we won't be able to generate anything, so skip running the plugin