From 13d0d6aa59f17d3fcb5ab439f1815e306686d0cb Mon Sep 17 00:00:00 2001 From: Mats Byrkjeland Date: Thu, 25 Nov 2021 23:37:51 +0100 Subject: [PATCH] Rebrand project from abandoned to ditched --- README.md | 31 ++++++++++++++++++++++++------- bin/{abandoned.js => ditched.js} | 14 +++++++------- package-lock.json | 7 ++++--- package.json | 15 ++++++++------- 4 files changed, 43 insertions(+), 24 deletions(-) rename bin/{abandoned.js => ditched.js} (88%) diff --git a/README.md b/README.md index 079dd03..eb9de15 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,32 @@ -# abandoned +# ditched -Command line tool to find abandoned npm dependencies in your project. +Command line tool to find npm dependencies that have been ditched. +A ditched package is one that has not been updated in a long time. -![abandoned usage](screenshot.png) +This is a fork of the abandoned project [abandoned](https://github.com/brendonboshell/abandoned). + +![ditched usage](screenshot.png) ## How to Use -First, +Within your project, run + +``` +npx abandoned +``` + +You can also install it as a dev dependency and use it in your scripts, +for example as part of your build procedure or as a reminder after install. - npm install abandoned -g +``` +npm install --dev ditched +``` -Then, within a project, run +package.json: - abandoned +``` +"scripts": { + "test": "ditched", + "postinstall": "ditched" +} +``` diff --git a/bin/abandoned.js b/bin/ditched.js similarity index 88% rename from bin/abandoned.js rename to bin/ditched.js index 59bbe21..ecafab3 100755 --- a/bin/abandoned.js +++ b/bin/ditched.js @@ -7,7 +7,7 @@ const colors = require("colors/safe"); const prettyDate = require("pretty-date"); const MS_IN_A_DAY = 1000 * 60 * 60 * 24; -const ABANDONED_DAYS = 90; +const DITCHED_DAYS = 90; const REGISTRY_URL = "https://registry.npmjs.org"; const showAllPackages = @@ -31,9 +31,9 @@ function getJSON(url) { }); } -function isAbandoned({ modifiedDate }) { +function isDitched({ modifiedDate }) { const ageDays = (new Date() - modifiedDate) / MS_IN_A_DAY; - return ageDays > ABANDONED_DAYS; + return ageDays > DITCHED_DAYS; } function printInfoTable(dataForPackages) { @@ -41,19 +41,19 @@ function printInfoTable(dataForPackages) { head: [ colors.gray("Package"), colors.gray("Last Modified"), - colors.gray("Abandoned?"), + colors.gray("Ditched?"), ], colWidths: [30, 40, 15], }); dataForPackages - .filter((data) => showAllPackages || isAbandoned(data)) + .filter((data) => showAllPackages || isDitched(data)) .sort((a, b) => b.modifiedDate - a.modifiedDate) .forEach((packageInfo) => { table.push([ packageInfo.name, prettyDate.format(packageInfo.modifiedDate), - isAbandoned(packageInfo) ? colors.red("Yes") : colors.green("No"), + isDitched(packageInfo) ? colors.red("Yes") : colors.green("No"), ]); }); @@ -97,7 +97,7 @@ async function main() { const dataForPackages = await Promise.all(packages.map(getInfoForPackage)); printInfoTable(dataForPackages); - if (dataForPackages.filter(isAbandoned).length > 0) { + if (dataForPackages.filter(isDitched).length > 0) { process.exit(1); } } diff --git a/package-lock.json b/package-lock.json index 92992af..9116416 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,13 @@ { - "name": "abandoned", + "name": "ditched", "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "abandoned", + "name": "ditched", "version": "0.1.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "cli-table": "^0.3.1", @@ -14,7 +15,7 @@ "pretty-date": "^0.2.0" }, "bin": { - "abandoned": "bin/abandoned.js" + "abandoned": "bin/ditched.js" }, "devDependencies": { "prettier": "^2.5.0" diff --git a/package.json b/package.json index cbfa2e1..c3ca1d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "abandoned", - "description": "'npm outdated' for abandoned projects. find abandoned dependencies easily.", + "name": "ditched", + "description": "List dependencies that haven't been updated in a long time.", "version": "0.1.0", "keywords": [ "cli", @@ -10,19 +10,20 @@ "outdated" ], "bugs": { - "url": "https://github.com/brendonboshell/abandoned/issues" + "url": "https://github.com/draperunner/ditched/issues" }, "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/brendonboshell/abandoned.git" + "url": "https://github.com/draperunner/ditched.git" }, "bin": { - "abandoned": "bin/abandoned.js" + "abandoned": "bin/ditched.js" }, "scripts": { - "start": "node bin/abandoned.js", - "format": "prettier . --write" + "start": "node bin/ditched.js", + "format": "prettier . --write", + "postinstall": "npm start" }, "dependencies": { "cli-table": "^0.3.1",