pulsar/script/clean

38 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env node
2013-12-13 08:34:03 +04:00
var cp = require('./utils/child-process-wrapper.js');
var path = require('path');
var os = require('os');
2013-12-15 08:33:07 +04:00
var removeCommand = process.platform === 'win32' ? 'del /F /Q /S ' : 'rm -rf ';
2013-12-13 08:34:03 +04:00
var productName = require('../package.json').productName;
process.chdir(path.dirname(__dirname));
var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
2014-05-16 23:10:55 +04:00
var tmpdir = os.tmpdir();
2013-12-13 08:34:03 +04:00
2013-12-15 08:33:07 +04:00
// Windows: Use START as a way to ignore error if Atom.exe isnt running
var killatom = process.platform === 'win32' ? 'START taskkill /F /IM ' + productName + '.exe' : 'pkill -9 ' + productName + ' || true';
var commands = [
killatom,
[__dirname, '..', 'node_modules'],
2014-01-02 22:56:00 +04:00
[__dirname, '..', 'build', 'node_modules'],
[__dirname, '..', 'apm', 'node_modules'],
2013-12-15 08:33:07 +04:00
[__dirname, '..', 'atom-shell'],
[home, '.atom', '.node-gyp'],
2013-12-15 08:33:07 +04:00
[home, '.atom', 'storage'],
2014-03-04 21:58:05 +04:00
[home, '.atom', '.npm'],
2014-04-18 01:25:03 +04:00
[home, '.atom', 'compile-cache'],
2013-12-15 08:33:07 +04:00
[tmpdir, 'atom-build'],
[tmpdir, 'atom-cached-atom-shells'],
];
var run = function() {
var next = commands.shift();
if (!next)
process.exit(0);
if (Array.isArray(next))
next = removeCommand + path.resolve.apply(path.resolve, next);
2013-12-15 08:33:07 +04:00
cp.safeExec(next, run);
};
run();