From 74f9c66c89ef68f79fbb29ee88b9e9c4e53f89fa Mon Sep 17 00:00:00 2001 From: Sherakama Date: Tue, 14 May 2024 09:36:09 -0700 Subject: [PATCH] NoJira: NextJS Runtime Plugin 5.2 Compatibility (#28) --- package.json | 12 ++++++++++++ src/index.js | 16 +--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 0e86138..51a22f9 100644 --- a/package.json +++ b/package.json @@ -26,5 +26,17 @@ "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^5.1.0", "eslint-plugin-prettier": "^5.0.0" + }, + "peerDependencies": { + "@netlify/plugin-nextjs": ">=5.2", + "next": ">=13.5.6" + }, + "peerDependenciesMeta": { + "@netlify/plugin-nextjs": { + "optional": true + }, + "next": { + "optional": true + } } } diff --git a/src/index.js b/src/index.js index 6020745..2fb55a4 100644 --- a/src/index.js +++ b/src/index.js @@ -73,12 +73,6 @@ module.exports = { netlifyConfig.functions['*'].external_node_modules = []; } netlifyConfig.functions['*'].external_node_modules.push('dotenv'); - - // Ensure that the .env file we are writing gets bundled with the func. - if (!Array.isArray(netlifyConfig.functions['*'].included_files)) { - netlifyConfig.functions['*'].included_files = []; - } - netlifyConfig.functions['*'].included_files.push('.env'); } // Contextualize the secrets. @@ -118,15 +112,7 @@ module.exports = { // Display success information status.show({ - summary: `Added environment variables from vault to environment and LAMBDA`, + summary: `Added ${secretsToWrite.length} environment variables from vault to this build.`, }); }, - // Remove env file if on Netilfy. - async onPostBuild() { - const isNetlify = process.env.NETLIFY || false; - const envFilePath = path.resolve(process.cwd(), '.env'); - if (isNetlify) { - fs.unlinkSync(envFilePath); - } - }, };