Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Jun 4, 2021
2 parents 5f3a609 + f8ff940 commit 6d65529
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 19 deletions.
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,46 @@
[![Test](https://github.com/LinqLover/downstream-repository-mining/actions/workflows/test.yml/badge.svg)](https://github.com/LinqLover/downstream-repository-mining/actions/workflows/test.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/linqlover/downstream-repository-mining/badge)](https://www.codefactor.io/repository/github/linqlover/downstream-repository-mining)

Student project as part of the course "Software Mining and Applications" offered by the Computer Graphics System Group ([@hpicgs](https://github.com/hpicgs)/[@varg-dev](https://github.com/varg-dev)) at the Hasso Plattner Institute (HPI), Potsdam, Germany.
Mine usage information about your JavaScript/TypeScript package from dependent repositories.

For more information, read the [exposé](./docs/exposé.md):
[![Exposé](https://github.com/LinqLover/downstream-repository-mining/actions/workflows/expos%C3%A9.yml/badge.svg?branch=master)](https://github.com/LinqLover/downstream-repository-mining/actions/workflows/exposé.yml?query=branch%3Amaster)

This is currently a student project for the course "Software Mining and Applications" offered by the Computer Graphics System Group ([@hpicgs](https://github.com/hpicgs)/[@varg-dev](https://github.com/varg-dev)) at the Hasso Plattner Institute (HPI), Potsdam, Germany.
Thanks to my supervisors, Daniel Limberger ([@cgcostume](https://github.com/cgcostume)) and Willy Scheibel ([@scheibel](https://github.com/scheibel))!

## Installation

```sh
$ yarn install
$ npm bind

# Install autocompletion (optional)
$ dowdep autocomplete
```

## Usage

```bash
./bin/run.js
Find downstream dependencies of a package:

```sh
dowdep list <your-package> [--limit=<number>]
```

Download downstream dependencies:

```sh
NPM_CACHE=<path/to/cache> dowdep download <your-package> [--limit=<number>]
```

Search downloaded dependencies for references to package:

```sh
NPM_CACHE=<path/to/cache> dowdep search <your-package> [--limit=<number>]
```

Show help:

```sh
dowdep help [<command>]
```
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,28 @@
"*"
],
"license": "UNLICENSED",
"main": "lib/index.js",
"main": "bin/run.js",
"scripts": {
"lint": "eslint . --ext=.js,.ts,.json",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
},
"oclif": {
"bin": "dowdep",
"commands": "./lib/cli/commands",
"commands": "./src/cli/commands",
"description": "downstream repository mining CLI",
"hooks": {
"init": "./src/cli/oclif.init.ts"
},
"plugins": [
"@oclif/plugin-help"
"@oclif/plugin-autocomplete",
"@oclif/plugin-help",
"@oclif/plugin-not-found"
]
},
"types": "lib/index.d.ts",
"dependencies": {
"@types/node": "^15.6.1",
"@oclif/plugin-autocomplete": "^0.3.0",
"@types/node": "^15.12.0",
"dotenv": "^10.0.0",
"download-package-tarball": "^1.0.7",
"escape-string-regexp": "^5.0.0",
Expand Down
7 changes: 4 additions & 3 deletions src/cli/commands/search.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Command, flags } from '@oclif/command'
import * as util from 'util'
import asyncIteratorToArray from "it-all"

import { ReferenceSearcher } from '../../references'

Expand All @@ -26,8 +25,10 @@ export default class Search extends Command {
const limit = flags.limit == -1 ? undefined : flags.limit

const searcher = new ReferenceSearcher(packageName)
const references = await asyncIteratorToArray(searcher.searchReferences(limit))
const references = searcher.searchReferences(limit)

console.log(util.inspect(references, { showHidden: false, depth: null, maxArrayLength: Infinity }))
for await (const reference of references) {
console.log(util.inspect(reference, { showHidden: false, depth: null, maxArrayLength: Infinity }))
}
}
}
2 changes: 1 addition & 1 deletion src/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class ReferenceSearcher {
for await (const depDirectory of depDirectories) {
for await (const reference of this.basicSearchReferences(path.join(rootDirectory, depDirectory.name), undefined, depth + 1)) {
yield reference
if (limit && ++i > limit) {
if (limit && ++i >= limit) {
return
}
}
Expand Down
58 changes: 50 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@
supports-color "^5.4.0"
tslib "^1"

"@oclif/command@^1.5.10", "@oclif/command@^1.5.20", "@oclif/command@^1.6", "@oclif/command@^1.6.0":
"@oclif/command@^1.5.10", "@oclif/command@^1.5.13", "@oclif/command@^1.5.20", "@oclif/command@^1.6", "@oclif/command@^1.6.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.8.0.tgz#c1a499b10d26e9d1a611190a81005589accbb339"
integrity sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw==
Expand All @@ -686,7 +686,7 @@
debug "^4.1.1"
semver "^7.3.2"

"@oclif/config@^1.12.10", "@oclif/config@^1.12.6", "@oclif/config@^1.12.8", "@oclif/config@^1.15.1":
"@oclif/config@^1.12.10", "@oclif/config@^1.12.6", "@oclif/config@^1.12.8", "@oclif/config@^1.13.0", "@oclif/config@^1.15.1":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.17.0.tgz#ba8639118633102a7e481760c50054623d09fcab"
integrity sha512-Lmfuf6ubjQ4ifC/9bz1fSCHc6F6E653oyaRXxg+lgT4+bYf9bk+nqrUpAbrXyABkCqgIBiFr3J4zR/kiFdE1PA==
Expand Down Expand Up @@ -734,6 +734,19 @@
chalk "^2.4.2"
tslib "^1.9.3"

"@oclif/plugin-autocomplete@^0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@oclif/plugin-autocomplete/-/plugin-autocomplete-0.3.0.tgz#eec788596a88a4ca5170a9103b6c2835119a8fbd"
integrity sha512-gCuIUCswvoU1BxDDvHSUGxW8rFagiacle8jHqE49+WnuniXD/N8NmJvnzmlNyc8qLE192CnKK+qYyAF+vaFQBg==
dependencies:
"@oclif/command" "^1.5.13"
"@oclif/config" "^1.13.0"
chalk "^4.1.0"
cli-ux "^5.2.1"
debug "^4.0.0"
fs-extra "^9.0.1"
moment "^2.22.1"

"@oclif/plugin-help@^3":
version "3.2.2"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-3.2.2.tgz#063ee08cee556573a5198fbdfdaa32796deba0ed"
Expand Down Expand Up @@ -938,10 +951,10 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==

"@types/node@*", "@types/node@^15.6.1":
version "15.6.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.6.1.tgz#32d43390d5c62c5b6ec486a9bc9c59544de39a08"
integrity sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==
"@types/node@*", "@types/node@^15.12.0":
version "15.12.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.0.tgz#6a459d261450a300e6865faeddb5af01c3389bb3"
integrity sha512-+aHJvoCsVhO2ZCuT4o5JtcPrCPyDE3+1nvbDprYes+pPkEsbjH7AGUCNtjMOXS0fqH14t+B7yLzaqSz92FPWyw==

"@types/node@^12.0.4":
version "12.20.11"
Expand Down Expand Up @@ -1345,6 +1358,11 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=

at-least-node@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==

atob@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
Expand Down Expand Up @@ -2225,7 +2243,7 @@ dateformat@^3.0.3:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==

debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
Expand Down Expand Up @@ -3123,6 +3141,16 @@ fs-extra@^8.1, fs-extra@^8.1.0:
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^9.0.1:
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
Expand Down Expand Up @@ -4679,6 +4707,15 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies:
graceful-fs "^4.1.6"

jsonparse@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
Expand Down Expand Up @@ -5117,7 +5154,7 @@ mkdirp@^0.5.0, mkdirp@^0.5.1:
dependencies:
minimist "^1.2.5"

moment@^2.15.1, moment@^2.24.0:
moment@^2.15.1, moment@^2.22.1, moment@^2.24.0:
version "2.29.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==
Expand Down Expand Up @@ -7197,6 +7234,11 @@ universalify@^0.1.0, universalify@^0.1.2:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==

universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

unset-value@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559"
Expand Down

0 comments on commit 6d65529

Please sign in to comment.