Skip to content

Commit

Permalink
Rebrand project from abandoned to ditched
Browse files Browse the repository at this point in the history
  • Loading branch information
draperunner committed Nov 25, 2021
1 parent e013017 commit 13d0d6a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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"
}
```
14 changes: 7 additions & 7 deletions bin/abandoned.js → bin/ditched.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -31,29 +31,29 @@ 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) {
const table = new CliTable({
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"),
]);
});

Expand Down Expand Up @@ -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);
}
}
Expand Down
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 13d0d6a

Please sign in to comment.