Skip to content

Commit fb55b9c

Browse files
authored
feat(analytics): use Scarf.js to provide anonymized installation analytics (#10194)
1 parent a6e61df commit fb55b9c

File tree

6 files changed

+58
-1
lines changed

6 files changed

+58
-1
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ The OpenAPI Specification has undergone 5 revisions since initial creation in 20
4545
| 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
4646
| 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |
4747

48+
## Anonymized analytics
49+
50+
SwaggerUI 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`:
51+
52+
```
53+
// package.json
54+
{
55+
// ...
56+
"scarfSettings": {
57+
"enabled": false
58+
}
59+
// ...
60+
}
61+
```
62+
63+
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`.
64+
4865
## Documentation
4966

5067
#### Usage

flavors/swagger-ui-react/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ It has a few differences from the main version of Swagger UI:
1010

1111
Versions of this module mirror the version of Swagger UI included in the distribution.
1212

13+
## Anonymized analytics
14+
15+
`swagger-ui-react` 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`:
16+
17+
```
18+
// package.json
19+
{
20+
// ...
21+
"scarfSettings": {
22+
"enabled": false
23+
}
24+
// ...
25+
}
26+
```
27+
28+
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`.
29+
30+
1331
## Quick start
1432

1533
Install `swagger-ui-react`:

package-lock.json

Lines changed: 1 addition & 0 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
@@ -73,6 +73,7 @@
7373
"dependencies": {
7474
"@babel/runtime-corejs3": "^7.24.7",
7575
"@braintree/sanitize-url": "=7.0.4",
76+
"@scarf/scarf": "=1.3.0",
7677
"base64-js": "^1.5.1",
7778
"classnames": "^2.5.1",
7879
"css.escape": "1.5.1",

swagger-ui-dist-package/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# Swagger UI Dist
22
[![NPM version](https://badge.fury.io/js/swagger-ui-dist.svg)](http://badge.fury.io/js/swagger-ui-dist)
33

4+
## Anonymized analytics
5+
6+
SwaggerUI 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`:
7+
8+
```
9+
// package.json
10+
{
11+
// ...
12+
"scarfSettings": {
13+
"enabled": false
14+
}
15+
// ...
16+
}
17+
```
18+
19+
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`.
20+
21+
422
# API
523

624
This module, `swagger-ui-dist`, exposes Swagger-UI's entire dist folder as a dependency-free npm module.

swagger-ui-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 <shr.jafari@gmail.com>"
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)