Skip to content

Commit

Permalink
Remove anonymous metrics (and the option to disable it)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Apr 27, 2022
1 parent aa1815e commit e9ce69b
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 119 deletions.
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -306,8 +306,7 @@ Deprecated. Please see [distribution repository](./docs/recipes/distribution-rep

## Metrics

Use `--disable-metrics` to opt-out of sending some anonymous statistical data to Google Analytics. For details, refer to
[lib/metrics.js](./lib/metrics.js). Please consider to not opt-out: more data means more support for future development.
In release-it v15, anonymous metrics have been removed from the codebase and no data is sent or stored anywhere.

## Troubleshooting & debugging

Expand Down
4 changes: 0 additions & 4 deletions lib/config.js
Expand Up @@ -119,10 +119,6 @@ class Config {
get isReleaseVersion() {
return Boolean(this.options['release-version']);
}

get isCollectMetrics() {
return !this.options['disable-metrics'];
}
}

export default Config;
13 changes: 2 additions & 11 deletions lib/index.js
Expand Up @@ -5,7 +5,6 @@ import Config from './config.js';
import Shell from './shell.js';
import Prompt from './prompt.js';
import Spinner from './spinner.js';
import Metrics from './metrics.js';
import { reduceUntil, parseVersion } from './util.js';
import Plugin from './plugin/Plugin.js';

Expand All @@ -22,15 +21,12 @@ const runTasks = async (opts, di) => {
container.log = container.log || new Logger({ isCI, isVerbose, verbosityLevel, isDryRun });
container.spinner = container.spinner || new Spinner({ container, config });
container.prompt = container.prompt || new Prompt({ container: { config } });
container.metrics = new Metrics({ isEnabled: config.isCollectMetrics });
container.shell = container.shell || new Shell({ container });

const { log, metrics, shell, spinner } = container;
const { log, shell, spinner } = container;

const options = config.getContext();

metrics.trackEvent('start', options);

const { hooks } = options;

const runHook = async (...name) => {
Expand Down Expand Up @@ -118,8 +114,6 @@ const runTasks = async (opts, di) => {
}
}

await metrics.trackEvent('end');

log.log(`🏁 Done (in ${Math.floor(process.uptime())}s.)`);

return {
Expand All @@ -129,10 +123,7 @@ const runTasks = async (opts, di) => {
version
};
} catch (err) {
const { log, metrics } = container;
if (metrics) {
await metrics.trackException(err);
}
const { log } = container;
log ? log.error(err.message || err) : console.error(err); // eslint-disable-line no-console
throw err;
}
Expand Down
76 changes: 0 additions & 76 deletions lib/metrics.js

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -84,7 +84,6 @@
"shelljs": "0.8.5",
"update-notifier": "5.1.0",
"url-join": "5.0.0",
"uuid": "8.3.2",
"wildcard-match": "5.1.2",
"yargs-parser": "21.0.1"
},
Expand Down
17 changes: 0 additions & 17 deletions test/metrics.js

This file was deleted.

3 changes: 1 addition & 2 deletions test/plugins.js
Expand Up @@ -19,8 +19,7 @@ const sandbox = sinon.createSandbox();

const testConfig = {
ci: true,
config: false,
'disable-metrics': true
config: false
};

const log = sandbox.createStubInstance(Log);
Expand Down
3 changes: 1 addition & 2 deletions test/spinner.js
Expand Up @@ -10,8 +10,7 @@ test.beforeEach(t => {
const getConfig = options => {
const testConfig = {
ci: false,
config: false,
'disable-metrics': true
config: false
};
return new Config(Object.assign({}, testConfig, options));
};
Expand Down
3 changes: 1 addition & 2 deletions test/tasks.interactive.js
Expand Up @@ -19,8 +19,7 @@ const sandbox = sinon.createSandbox();

const testConfig = {
ci: false,
config: false,
'disable-metrics': true
config: false
};

const log = sandbox.createStubInstance(Log);
Expand Down
3 changes: 1 addition & 2 deletions test/tasks.js
Expand Up @@ -30,8 +30,7 @@ const sandbox = sinon.createSandbox();

const testConfig = {
ci: true,
config: false,
'disable-metrics': true
config: false
};

const log = sandbox.createStubInstance(Log);
Expand Down

0 comments on commit e9ce69b

Please sign in to comment.