-
Notifications
You must be signed in to change notification settings - Fork 735
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
Update elliptic to >= 6.6.1 #4272
base: main
Are you sure you want to change the base?
Conversation
f865625
to
d54fe56
Compare
I ran this script to update all of the const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const targetVersion = '^6.6.1';
const targetDependency = 'elliptic';
function updatePackageJson(filePath) {
const packageJson = JSON.parse(fs.readFileSync(filePath, 'utf8'));
let updated = false;
// Update the version of elliptic in dependencies
if (packageJson.dependencies && packageJson.dependencies[targetDependency]) {
packageJson.dependencies[targetDependency] = targetVersion;
updated = true;
}
// Update the version of elliptic in devDependencies
if (packageJson.devDependencies && packageJson.devDependencies[targetDependency]) {
packageJson.devDependencies[targetDependency] = targetVersion;
updated = true;
}
// Add or update elliptic in overrides
if (!packageJson.overrides) {
packageJson.overrides = {};
}
if (packageJson.overrides[targetDependency] !== targetVersion) {
packageJson.overrides[targetDependency] = targetVersion;
updated = true;
}
if (updated) {
fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 2));
console.log(`Updated ${filePath}`);
// Run npm install in the directory of the updated package.json
const dir = path.dirname(filePath);
console.log(`Running npm install in ${dir}`);
execSync('npm install', { cwd: dir, stdio: 'inherit' });
}
}
function findPackageJsonFiles(dir) {
const files = fs.readdirSync(dir);
files.forEach((file) => {
const filePath = path.join(dir, file);
const stat = fs.statSync(filePath);
if (stat.isDirectory() && file !== 'node_modules') {
findPackageJsonFiles(filePath);
} else if (file === 'package.json') {
updatePackageJson(filePath);
}
});
}
// Start the search from the current directory
findPackageJsonFiles(process.cwd()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at a glance, the change / approach seem reasonable to me. also noting that many, if not all, of these packages / use cases are non-production and/or controlled inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat script! Thanks for updating
See: GHSA-vjh7-7g9h-fjfh