Here you will find scripts that allow you to get a package usage statistics.
Firstly you need to run:
npm install
In order to use scripts you need to get an Azure token.
-
Go to your company's Azure DevOps page.
-
Open "Personal access tokens" page
-
Click "New Token"
-
Give token a name, select "Read" permission under "Code" and click "Create"
-
Save your token in the safe place for later use.
In order to get specific package usage run this command:
node package-usage.js companyName packageName azureToken
companyName
- name of your company, you can just copy it from the URL https://dev.azure.com/companyName/
.
packageName
- name of the package that you want to get statistics.
azureToken
- Azure token that you got from previous step.
In order to get statistics of components usage per project, you need to run:
node components-usage.js companyName packageName azureToken
It will create a file repositoryComponentsMap-package-name.json
which contains an object where key is a repo name and value is object where components
is an object with keys being components name and components usage as values, there is also lastModifiedDate
that can be used to determine whether repo is stale.
Then you can run your own scripts on this file or you can also call node summary-component-usage.js
(firstly you need to change hardcoded components inside, sorry) and you will get .csv
file with unique components count used in the repos.