Skip to content

Instantly share code, notes, and snippets.

@euharrison
Created February 28, 2018 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save euharrison/9db65a6b630ecb8da382eac80f016fc4 to your computer and use it in GitHub Desktop.
Save euharrison/9db65a6b630ecb8da382eac80f016fc4 to your computer and use it in GitHub Desktop.
List peerDependencies for specific package version and above
const { execSync } = require('child_process');
const packageName = 'react-hot-loader';
const currentVersion = '1.3.0';
const allVersions = eval(execSync(`npm view ${packageName} versions`).toString());
const currentVersionIndex = allVersions.indexOf(currentVersion);
const forwardVersions = allVersions.slice(currentVersionIndex);
forwardVersions.forEach(version => {
const peer = execSync(`npm view ${packageName}@${version} peerDependencies`).toString();
console.log(`[${packageName}@${version}] ${peer}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment