Skip to content

Commit c3172be

Browse files
authored
feat(analytics): use Scarf.js to provide anonymized installation analytics (#5258)
## Anonymized analytics Swagger Editor uses [Scarf](https://scarf.sh/) to collect [anonymized installation analytics](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-what-information-does-scarf-js-send-about-me). These analytics help support the maintainers of this library and ONLY run during installation. To [opt out](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics), you can set the `scarfSettings.enabled` field to `false` in your project's `package.json`: ``` // package.json { // ... "scarfSettings": { "enabled": false } // ... } ``` Alternatively, you can set the environment variable `SCARF_ANALYTICS` to `false` as part of the environment that installs your npm packages, e.g., `SCARF_ANALYTICS=false npm install`.
1 parent 683fae5 commit c3172be

File tree

5 files changed

+42
-16
lines changed

5 files changed

+42
-16
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ This repository publishes to two different NPM modules:
3434

3535
If you're building a single-page application, using `swagger-editor` is strongly recommended, since `swagger-editor-dist` is significantly larger.
3636

37+
## Anonymized analytics
38+
39+
Swagger Editor uses [Scarf](https://scarf.sh/) to collect [anonymized installation analytics](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-what-information-does-scarf-js-send-about-me). These analytics help support the maintainers of this library and ONLY run during installation. To [opt out](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics), you can set the `scarfSettings.enabled` field to `false` in your project's `package.json`:
40+
41+
```
42+
// package.json
43+
{
44+
// ...
45+
"scarfSettings": {
46+
"enabled": false
47+
}
48+
// ...
49+
}
50+
```
51+
52+
Alternatively, you can set the environment variable `SCARF_ANALYTICS` to `false` as part of the environment that installs your npm packages, e.g., `SCARF_ANALYTICS=false npm install`.
53+
3754
## Helpful scripts
3855

3956
Any of the scripts below can be run by typing `npm run <script name>` in the project's root directory.

package-lock.json

Lines changed: 1 addition & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"watch": "webpack --config webpack/core.babel.js --watch --progress"
5959
},
6060
"dependencies": {
61+
"@scarf/scarf": "=1.3.0",
6162
"ajv": "^6.12.3",
6263
"ajv-errors": "^1.0.1",
6364
"ajv-keywords": "^3.5.2",
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1-
This module, `swagger-editor-dist`, exposes Swagger-Editor's entire dist folder as a dependency-free npm module.
1+
# swagger-editor-dist
2+
3+
This module, `swagger-editor-dist`, exposes Swagger-Editor's entire dist folder as an almost (see [anonymized analytics](#anonymized-analytics)) dependency-free npm module.
24

35
Use `swagger-editor` instead, if you'd like to have npm install dependencies for you.
6+
7+
## Anonymized analytics
8+
9+
`swagger-editor-dist` uses [Scarf](https://scarf.sh/) to collect [anonymized installation analytics](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-what-information-does-scarf-js-send-about-me). These analytics help support the maintainers of this library and ONLY run during installation. To [opt out](https://github.com/scarf-sh/scarf-js?tab=readme-ov-file#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics), you can set the `scarfSettings.enabled` field to `false` in your project's `package.json`:
10+
11+
```
12+
// package.json
13+
{
14+
// ...
15+
"scarfSettings": {
16+
"enabled": false
17+
}
18+
// ...
19+
}
20+
```
21+
22+
Alternatively, you can set the environment variable `SCARF_ANALYTICS` to `false` as part of the environment that installs your npm packages, e.g., `SCARF_ANALYTICS=false npm install`.

swagger-editor-dist-package/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"Sahar Jafari <[email protected]>"
1414
],
1515
"license": "Apache-2.0",
16-
"dependencies": {},
16+
"dependencies": {
17+
"@scarf/scarf": "=1.3.0"
18+
},
1719
"devDependencies": {}
1820
}

0 commit comments

Comments
 (0)