From aeff7cc6e86230ec313993b4c6cdd00375c4f153 Mon Sep 17 00:00:00 2001 From: Lindsay Levine Date: Mon, 16 Nov 2020 15:06:38 -0500 Subject: [PATCH] remove legacy functions_src conditional --- index.js | 11 +---------- test/index.js | 13 ------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/index.js b/index.js index 7490994e78..70a3e65d5e 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ const pCopy = util.promisify(copy) // - Between the build and postbuild steps, any functions are bundled module.exports = { - async onPreBuild({ netlifyConfig, packageJson, utils, constants: { FUNCTIONS_SRC } }) { + async onPreBuild({ netlifyConfig, packageJson, utils }) { const { failBuild } = utils.build if (Object.keys(packageJson).length === 0) { @@ -44,15 +44,6 @@ module.exports = { // return failBuild(`This plugin cannot support apps that manually use next-on-netlify. Uninstall next-on-netlify as a dependency to resolve.`); // } - const isFunctionsDirectoryCorrect = - FUNCTIONS_SRC !== undefined && path.resolve(FUNCTIONS_SRC) === path.resolve('out_functions') - if (!isFunctionsDirectoryCorrect) { - // to do rephrase - return failBuild( - `You must designate a functions directory named "out_functions" in your netlify.toml or in your app's build settings on Netlify. See docs for more info: https://docs.netlify.com/functions/configure-and-deploy/#configure-the-functions-folder`, - ) - } - const nextConfigPath = await findUp('next.config.js') if (nextConfigPath !== undefined) { // If the next config exists, fail build if target isnt in acceptableTargets diff --git a/test/index.js b/test/index.js index be67b695c2..4e30f6d96e 100644 --- a/test/index.js +++ b/test/index.js @@ -93,19 +93,6 @@ describe('preBuild()', () => { ).rejects.toThrow(`Could not find a package.json for this project`) }) - test('fail build if the app has no functions directory defined', async () => { - await expect( - plugin.onPreBuild({ - netlifyConfig: {}, - packageJson: DUMMY_PACKAGE_JSON, - utils, - constants: {}, - }), - ).rejects.toThrow( - `You must designate a functions directory named "out_functions" in your netlify.toml or in your app's build settings on Netlify. See docs for more info: https://docs.netlify.com/functions/configure-and-deploy/#configure-the-functions-folder`, - ) - }) - test('create next.config.js with correct target if file does not exist', async () => { await plugin.onPreBuild({ netlifyConfig: {},