Skip to content

Commit

Permalink
feat(module): support telemetry: true
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Jun 26, 2020
1 parent 911b68d commit 4010c07
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,33 @@ The data we collect is completely anonymous, not traceable to the source (using

You can disable Nuxt Telemetry for your project with several ways:

1. Using `npx nuxt telemetry disable`
1. Setting `telemetry: false` in your `nuxt.config`:

```bash
npx nuxt telemetry [status|enable|disable] [-g,--global] [dir]
```js
export default {
telemetry: false
}
```

2. Using an environment variable
2. Using an environment variable:

```bash
NUXT_TELEMETRY_DISABLED=1
```

3. Setting `telemetry: false` in your `nuxt.config.js`:
3. Using `npx nuxt telemetry disable`

```bash
npx nuxt telemetry [status|enable|disable] [-g,--global] [dir]
```

## Skip Prompt

If you encounter problems with consent prompt, and want to participate without asking this question, you can set `telemetry: true` from `nuxt.config`:

```js
export default {
telemetry: false
telemetry: true
}
```

Expand Down
17 changes: 10 additions & 7 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ async function _telemetryModule (nuxt) {
log.level = -Infinity
}

if (
toptions.enabled === false ||
nuxt.options.telemetry === false ||
!await ensureUserconsent(toptions)
) {
log.info('Telemetry disabled')
return
if (nuxt.options.telemetry !== true) {
if (
toptions.enabled === false ||
nuxt.options.telemetry === false ||
!await ensureUserconsent(toptions)
) {
log.info('Telemetry disabled')
return
}
}

log.info('Telemetry enabled')

if (!toptions.seed) {
Expand Down

0 comments on commit 4010c07

Please sign in to comment.