Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
Last active November 8, 2018 19:34
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save elijahmanor/4cc8e3eac9fb5999c5d759388ff27c64 to your computer and use it in GitHub Desktop.
Save elijahmanor/4cc8e3eac9fb5999c5d759388ff27c64 to your computer and use it in GitHub Desktop.
Has Deprecated Packages

Feel free to run via...

npx https://gist.github.com/elijahmanor/4cc8e3eac9fb5999c5d759388ff27c64

#!/usr/bin/env node
const fs = require("fs");
const { exec } = require("child_process");
const getPackageJson = () => {
const contents = fs.readFileSync("./package.json", "utf-8");
return contents ? JSON.parse(contents) : {};
};
const package = getPackageJson();
const dependencies = Object.assign( {}, package.dependencies, package.devDependencies );
Object.keys( dependencies ).forEach( key => {
exec(`npm view ${ key }@${ dependencies[key] } deprecated`, (err, stdout) => {
if (err) { return; }
if ( stdout ) {
console.log(`${ key }@${ dependencies[key] } is deprecated: ${ stdout }`);
}
});
} );
{
"name": "has-deprecated-packages",
"version": "1.0.0",
"bin": "./index.js"
}
@kentcdodds
Copy link

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment