@jimdo/components-stats
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -22,5 +22,5 @@ "use strict"; | ||
const cloneReposList_1 = require("./cloneReposList"); | ||
const { ORG, PKG_NAME, GH_AUTHTOKEN, DAYS_UNTIL_STALE, COMPONENTS, } = require('../config'); | ||
const { org, pkgName, ghAuthToken, daysUntilStale, components, } = require('../config'); | ||
const currentLocation = (0, process_1.cwd)(); | ||
const stanitizedPkgName = PKG_NAME.replaceAll('/', '_'); | ||
const stanitizedPkgName = pkgName.replaceAll('/', '_'); | ||
const reposLocalDir = path_1.default.join(currentLocation, 'repositories'); | ||
@@ -32,10 +32,10 @@ const pkgAdoptionReport = path_1.default.join(currentLocation, 'pkgAdoption.json'); | ||
const relevantRepos = yield (0, package_adoption_1.getFilteredReposWithPackageForOrg)({ | ||
org: ORG, | ||
daysUntilStale: DAYS_UNTIL_STALE, | ||
ghAuthToken: GH_AUTHTOKEN, | ||
pkgName: PKG_NAME, | ||
org, | ||
daysUntilStale, | ||
ghAuthToken, | ||
pkgName, | ||
}); | ||
fs_1.default.writeFileSync(pkgAdoptionReport, JSON.stringify(relevantRepos)); | ||
if (relevantRepos === null || relevantRepos === void 0 ? void 0 : relevantRepos.length) { | ||
(0, cloneReposList_1.cloneReposList)(reposLocalDir, relevantRepos, ORG); | ||
(0, cloneReposList_1.cloneReposList)(reposLocalDir, relevantRepos, org); | ||
console.log('\n\n[components-stats] - Collect components usage for filtered repositories'); | ||
@@ -56,3 +56,3 @@ (0, shelljs_1.rm)('-rf', `${reportsOutputDir}/*`); | ||
includeSubComponents: true, | ||
importedFrom: PKG_NAME, | ||
importedFrom: pkgName, | ||
processors: [ | ||
@@ -64,3 +64,3 @@ [ | ||
], | ||
components: COMPONENTS, | ||
components, | ||
}; | ||
@@ -67,0 +67,0 @@ fs_1.default.writeFileSync(reactScannerConfig, `module.exports = ${JSON.stringify(scannerConfig)}`); |
{ | ||
"name": "@jimdo/components-stats", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Collect stats about ui components usage across the specified GitHub org", | ||
@@ -52,3 +52,3 @@ "main": "./build/src/index.js", | ||
"@types/shelljs": "^0.8.11", | ||
"package-adoption": "^1.3.0", | ||
"package-adoption": "^1.3.2", | ||
"react-scanner": "^1.0.3", | ||
@@ -60,2 +60,3 @@ "shelljs": "^0.8.5" | ||
"@ryansonshine/cz-conventional-changelog": "^3.3.4", | ||
"@semantic-release/git": "^10.0.1", | ||
"@types/jest": "^27.5.2", | ||
@@ -129,2 +130,11 @@ "@types/node": "^12.20.11", | ||
"@semantic-release/npm", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"package.json" | ||
], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
], | ||
"@semantic-release/github" | ||
@@ -131,0 +141,0 @@ ] |
# @jimdo/components-stats | ||
[![npm package][npm-img]][npm-url] | ||
[![Build Status][build-img]][build-url] | ||
[![Downloads][downloads-img]][downloads-url] | ||
[![Issues][issues-img]][issues-url] | ||
[![Commitizen Friendly][commitizen-img]][commitizen-url] | ||
[![Semantic Release][semantic-release-img]][semantic-release-url] | ||
Collect usage statistics for any npm package exposing React UI components, across a GitHub organization; based on [Twilio.com blogpost](https://www.twilio.com/blog/insights-metrics-inform-paste-design-system). | ||
@@ -12,14 +19,13 @@ | ||
Create a **config.js** file based on `config.example`. | ||
Create a **config.js** file based on `config.example`. | ||
A GitHub [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with scope `repo` is required, to access the `ORG` private repositories through GitHub APIs. | ||
A GitHub [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with scope `repo` is required, to access the `org` private repositories through GitHub APIs. | ||
Usage for `PKG_NAME` will be analyzed across `ORG`, excluding repositories that did not receive any commit in the last `DAYS_UNTIL_STALE` days. | ||
Usage for `pkgName` will be analyzed across `org`, excluding repositories that did not receive any commit in the last `daysUntilStale` days. | ||
Be patient, this will take some time. | ||
The list of repositories having `PKG_NAME` as dependency is collected through the [**package-adoption**](https://github.com/Jimdo/package-adoption) npm module. | ||
The list of repositories having `pkgName` as dependency is collected through the [**components-stats**](https://github.com/Jimdo/components-stats) npm module. | ||
Omit `COMPONENTS` to report all components. | ||
Omit `components` to report all components. | ||
> :warning: The script will clone all the eligible repositories locally and use them as source for [react-scanner](https://github.com/moroshko/react-scanner). If a repository already exists locally, it will update it with a `git pull`. | ||
@@ -36,3 +42,2 @@ | ||
## Results | ||
@@ -42,6 +47,18 @@ | ||
- a `pkgAdoption.json` file with the list of repositories that include `PKG_NAME` as a dependency. | ||
- a `pkgAdoption.json` file with the list of repositories that include `pkgName` as a dependency. | ||
- a `reports_by_repo` folder with one `scanner-report_[repo_name_subdir].json` file for each repository. Each file is a report with the usage of React components exposed by the `PKG_NAME` library. | ||
[react-scanner](https://github.com/moroshko/react-scanner) is used to produce the report. | ||
- a `reports_by_repo` folder with one `scanner-report_[repo_name_subdir].json` file for each repository. Each file is a report with the usage of React components exposed by the `pkgName` library. | ||
[react-scanner](https://github.com/moroshko/react-scanner) is used to produce the report. | ||
[build-img]: https://github.com/jimdo/components-stats/actions/workflows/release.yml/badge.svg | ||
[build-url]: https://github.com/jimdo/components-stats/actions/workflows/release.yml | ||
[downloads-img]: https://img.shields.io/npm/dt/components-stats | ||
[downloads-url]: https://www.npmtrends.com/components-stats | ||
[npm-img]: https://img.shields.io/npm/v/components-stats | ||
[npm-url]: https://www.npmjs.com/package/components-stats | ||
[issues-img]: https://img.shields.io/github/issues/jimdo/components-stats | ||
[issues-url]: https://github.com/jimdo/components-stats/issues | ||
[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg | ||
[semantic-release-url]: https://github.com/semantic-release/semantic-release | ||
[commitizen-img]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg | ||
[commitizen-url]: http://commitizen.github.io/cz-cli/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13829
62
20
Updatedpackage-adoption@^1.3.2