Skip to content

feat: show summary build status #400

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

Merged
merged 5 commits into from
Jun 29, 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
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,21 @@ module.exports = {

async onPostBuild({ netlifyConfig, packageJson, constants: { FUNCTIONS_DIST = DEFAULT_FUNCTIONS_DIST }, utils }) {
if (doesNotNeedPlugin({ netlifyConfig, packageJson, utils })) {
utils.status.show({
title: 'Essential Next.js Build Plugin did not run',
summary: 'The site either uses static export, or manually runs next-on-netlify',
})
return
}
const nextRoot = getNextRoot({ netlifyConfig })

const nextConfig = await getNextConfig(utils.failBuild, nextRoot)
await saveCache({ cache: utils.cache, distDir: nextConfig.distDir })
copyUnstableIncludedDirs({ nextConfig, functionsDist: path.resolve(FUNCTIONS_DIST) })
utils.status.show({
title: 'Essential Next.js Build Plugin ran successfully',
summary: 'Generated serverless functions and stored the Next.js cache',
})
},
}

Expand Down
3 changes: 3 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const utils = {
save() {},
restore() {},
},
status: {
show() {},
},
}

// Temporary switch cwd
Expand Down