From c3172be9c46243a3c6a0bdbeae02d44da54e0a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Wed, 6 Nov 2024 11:00:44 +0100 Subject: [PATCH] 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`. --- README.md | 17 +++++++++++++++++ package-lock.json | 15 +-------------- package.json | 1 + swagger-editor-dist-package/README.md | 21 ++++++++++++++++++++- swagger-editor-dist-package/package.json | 4 +++- 5 files changed, 42 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fc7fc7c6641..4306915c47d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,23 @@ This repository publishes to two different NPM modules: If you're building a single-page application, using `swagger-editor` is strongly recommended, since `swagger-editor-dist` is significantly larger. +## 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`. + ## Helpful scripts Any of the scripts below can be run by typing `npm run