Skip to content
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

NoJira: NextJS Runtime Plugin 5.2 Compatibility #28

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"next": ">13.5.6"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming forward compatibility after these versions.

},
"peerDependenciesMeta": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as peerDependencies and set the meta to optional so the package manager doesn't get angry.

"@netlify/plugin-nextjs": {
"optional": true
},
"next": {
"optional": true
}
}
}
16 changes: 1 addition & 15 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
},
};
Loading