Skip to content

Commit e2aa7ea

Browse files
remove legacy functions_src conditional (#40)
1 parent 7e54623 commit e2aa7ea

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

index.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const pCopy = util.promisify(copy)
1919
// - Between the build and postbuild steps, any functions are bundled
2020

2121
module.exports = {
22-
async onPreBuild({ netlifyConfig, packageJson, utils, constants: { FUNCTIONS_SRC } }) {
22+
async onPreBuild({ netlifyConfig, packageJson, utils }) {
2323
const { failBuild } = utils.build
2424

2525
if (Object.keys(packageJson).length === 0) {
@@ -44,15 +44,6 @@ module.exports = {
4444
// return failBuild(`This plugin cannot support apps that manually use next-on-netlify. Uninstall next-on-netlify as a dependency to resolve.`);
4545
// }
4646

47-
const isFunctionsDirectoryCorrect =
48-
FUNCTIONS_SRC !== undefined && path.resolve(FUNCTIONS_SRC) === path.resolve('out_functions')
49-
if (!isFunctionsDirectoryCorrect) {
50-
// to do rephrase
51-
return failBuild(
52-
`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`,
53-
)
54-
}
55-
5647
const nextConfigPath = await findUp('next.config.js')
5748
if (nextConfigPath !== undefined) {
5849
// If the next config exists, fail build if target isnt in acceptableTargets

test/index.js

-13
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,6 @@ describe('preBuild()', () => {
9393
).rejects.toThrow(`Could not find a package.json for this project`)
9494
})
9595

96-
test('fail build if the app has no functions directory defined', async () => {
97-
await expect(
98-
plugin.onPreBuild({
99-
netlifyConfig: {},
100-
packageJson: DUMMY_PACKAGE_JSON,
101-
utils,
102-
constants: {},
103-
}),
104-
).rejects.toThrow(
105-
`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`,
106-
)
107-
})
108-
10996
test('create next.config.js with correct target if file does not exist', async () => {
11097
await plugin.onPreBuild({
11198
netlifyConfig: {},

0 commit comments

Comments
 (0)