Skip to content

Commit

Permalink
feat: remove anonymous analytics (fixes thumbsup#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
rprieto authored and ebardsley committed May 25, 2023
1 parent 8653579 commit 4ff17e0
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1,882 deletions.
35 changes: 0 additions & 35 deletions bin/analytics.js

This file was deleted.

16 changes: 2 additions & 14 deletions bin/thumbsup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const fs = require('fs-extra')
const moment = require('moment')
const Analytics = require('./analytics')
const dependencies = require('../src/cli/dependencies')
const messages = require('../src/cli/messages')
const options = require('../src/cli/options')
Expand All @@ -24,12 +23,6 @@ if (firstRun) {
console.log(`${messages.GREETING()}\n`)
}

// Basic usage report (anonymous statistics)
const analytics = new Analytics({
enabled: opts.usageStats
})
analytics.start()

// Catch all exceptions and exit gracefully
process.on('uncaughtException', handleError)
process.on('unhandledRejection', handleError)
Expand Down Expand Up @@ -59,7 +52,6 @@ index.build(opts, (err, result) => {
photos: result.album.stats.photos,
videos: result.album.stats.videos
}
analytics.finish(stats)
console.log(messages.SUCCESS(stats) + '\n')
exit(0)
}
Expand All @@ -68,7 +60,6 @@ index.build(opts, (err, result) => {
// Print an error report and exit
// Note: remove "err.context" (entire data model) which can make the output hard to read
function handleError (err) {
analytics.error()
delete err.context
require('debug')('thumbsup:error')(err)
console.error('\nUnexpected error', err.message)
Expand All @@ -77,12 +68,9 @@ function handleError (err) {
}

// Force a successful or failed exit
// This is required
// - because capturing unhandled errors will make Listr run forever
// - to ensure pending Analytics HTTP requests don't keep the tool running
// This is required because capturing unhandled errors will make Listr run forever
function exit (code) {
// just some time to ensure analytics has time to fire
setTimeout(() => process.exit(code), 10)
process.exit(code)
}

// Count the total number of nested albums
Expand Down
Loading

0 comments on commit 4ff17e0

Please sign in to comment.