Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

kentcdodds commented Sep 5, 2018

<3

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