From fbddb0c98bfb1f8c7449564f80c9634a41337acd Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 10 Mar 2016 15:18:02 -0800 Subject: [PATCH] Add cleanup script (for developers) (Fix #124) --- bin/cleanup.js | 19 +++++++++++++++++++ bin/update-authors.sh | 1 + package.json | 3 +++ 3 files changed, 23 insertions(+) create mode 100755 bin/cleanup.js diff --git a/bin/cleanup.js b/bin/cleanup.js new file mode 100755 index 00000000..f99bc2a2 --- /dev/null +++ b/bin/cleanup.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node + +/** + * Remove all traces of WebTorrent.app from the system (config and temp files). + * Useful for developers. + */ + +var applicationConfigPath = require('application-config-path') +var config = require('../config') +var os = require('os') +var path = require('path') +var pathExists = require('path-exists') +var rimraf = require('rimraf') + +var tmpPath = path.join(pathExists.sync('/tmp') ? '/tmp' : os.tmpDir(), 'webtorrent') +var configPath = applicationConfigPath(config.APP_NAME) + +rimraf.sync(configPath) +rimraf.sync(tmpPath) diff --git a/bin/update-authors.sh b/bin/update-authors.sh index 1e31b41a..172061cf 100755 --- a/bin/update-authors.sh +++ b/bin/update-authors.sh @@ -1,4 +1,5 @@ #!/bin/sh + # Update AUTHORS.md based on git history. git log --reverse --format='%aN <%aE>' | perl -we ' diff --git a/package.json b/package.json index 800049f0..ce4479d3 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,8 @@ "devDependencies": { "electron-packager": "^5.0.0", "electron-prebuilt": "0.36.10", + "path-exists": "^2.1.0", + "rimraf": "^2.5.2", "standard": "^6.0.5" }, "homepage": "https://webtorrent.io", @@ -45,6 +47,7 @@ "url": "git://github.com/feross/webtorrent-app.git" }, "scripts": { + "cleanup": "node ./bin/cleanup.js", "debug": "DEBUG=* electron .", "package": "node ./bin/package.js", "start": "electron .",