rxjs-report-usage
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -10,13 +10,16 @@ { | ||
"dependencies": { | ||
"@babel/parser": "^7.10.3", | ||
"@babel/traverse": "^7.10.3", | ||
"@babel/types": "^7.10.3", | ||
"bent": "^7.3.6", | ||
"chalk": "^4.1.0", | ||
"glob": "^7.1.6", | ||
"prompts": "^2.3.2" | ||
"@babel/parser": "~7.10.3", | ||
"@babel/traverse": "~7.10.3", | ||
"@babel/types": "~7.10.3", | ||
"bent": "~7.3.6", | ||
"chalk": "~4.1.0", | ||
"glob": "~7.1.6", | ||
"prompts": "~2.3.2" | ||
}, | ||
"description": "Report RxJS API usage to the core team", | ||
"devDependencies": { | ||
"jest": "^26.0.1" | ||
"csv-parser": "^2.3.3", | ||
"jest": "^26.0.1", | ||
"ndjson-cli": "^0.3.1", | ||
"yargs": "^15.3.1" | ||
}, | ||
@@ -50,3 +53,3 @@ "homepage": "https://github.com/cartant/rxjs-report-usage", | ||
"scripts": {}, | ||
"version": "1.0.4" | ||
"version": "1.0.5" | ||
} |
# rxjs-report-usage | ||
### What is it? | ||
The script within this package collects anonymous API usage statistics and reports them to the RxJS core team. | ||
### How do you run it? | ||
This package is included as a dependency in: | ||
* [`eslint-plugin-rxjs`](https://github.com/cartant/eslint-plugin-rxjs) | ||
* [`rxjs-etc`](https://github.com/cartant/rxjs-etc) | ||
* [`rxjs-marbles`](https://github.com/cartant/rxjs-marbles) | ||
* [`rxjs-spy`](https://github.com/cartant/rxjs-spy) | ||
* [`rxjs-tslint-rules`](https://github.com/cartant/rxjs-tslint-rules) | ||
So if you are using the most-recent version of any of those packages, you can run the following npm command: | ||
``` | ||
npm rxjs-report-usage | ||
``` | ||
Or, with yarn: | ||
``` | ||
yarn rxjs-report-usage | ||
``` | ||
If you're not using any of those packages, you can install `rxjs-report-usage` as a `devDependency` and then run one of the above commands, or you can use `npx` to run the script without installing the package: | ||
``` | ||
npx rxjs-report-error | ||
``` | ||
### What it does actually do? | ||
When run inside a project, the script locates all JavaScript and TypeScript files - except for those in the `node_modules` directory - and parses them with Babel. The parsed code is searched for `import` statements and `require` calls that consume `rxjs` and a usage count is recorded for each consumed RxJS API. | ||
@@ -22,3 +54,3 @@ | ||
"mergeMap": 1 | ||
}, | ||
} | ||
}, | ||
@@ -36,2 +68,2 @@ "packageVersions": { | ||
For more information - including the most convenient ways of running the script - see this blog post: [Reporting API Usage](http://ncjamieson.com/reporting-api-usage/). | ||
For more information see this blog post: [Reporting API Usage](http://ncjamieson.com/reporting-api-usage/). |
"use strict"; | ||
const { parse } = require("@babel/parser"); | ||
const { readFileSync } = require("fs"); | ||
const { readFileSync, statSync } = require("fs"); | ||
const glob = require("glob"); | ||
@@ -22,10 +22,14 @@ const { resolve } = require("path"); | ||
sourceFiles.forEach((file) => { | ||
const code = readFileSync(resolve(cwd, file), "utf8"); | ||
try { | ||
const resolvedFile = resolve(cwd, file); | ||
if (!statSync(resolvedFile).isFile()) { | ||
return; | ||
} | ||
const code = readFileSync(resolvedFile, "utf8"); | ||
const ast = parse(code, { | ||
// https://babeljs.io/docs/en/babel-parser#ecmascript-proposals-https-githubcom-babel-proposals | ||
plugins: [ | ||
"classProperties", | ||
"classPrivateMethods", | ||
"classPrivateProperties", | ||
"classProperties", | ||
"decorators-legacy", | ||
@@ -32,0 +36,0 @@ "jsx", |
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
11244
206
68
4
+ Added@babel/helper-function-name@7.24.7(transitive)
+ Added@babel/helper-split-export-declaration@7.24.7(transitive)
+ Added@babel/parser@7.10.5(transitive)
+ Added@babel/traverse@7.10.5(transitive)
+ Added@babel/types@7.10.5(transitive)
+ Addedglob@7.1.7(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedprompts@2.3.2(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
- Removed@babel/traverse@7.26.4(transitive)
- Removedglob@7.2.3(transitive)
- Removedprompts@2.4.2(transitive)
Updated@babel/parser@~7.10.3
Updated@babel/traverse@~7.10.3
Updated@babel/types@~7.10.3
Updatedbent@~7.3.6
Updatedchalk@~4.1.0
Updatedglob@~7.1.6
Updatedprompts@~2.3.2