mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
46 lines
1.4 KiB
JavaScript
Executable file
46 lines
1.4 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
var cp = require('./utils/child-process-wrapper.js');
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
var os = require('os');
|
|
|
|
var removeCommand = process.platform === 'win32' ? 'rmdir /S /Q ' : 'rm -rf ';
|
|
var productName = require('../package.json').productName;
|
|
|
|
process.chdir(path.dirname(__dirname));
|
|
var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
|
|
var tmpdir = os.tmpdir();
|
|
|
|
// Windows: Use START as a way to ignore error if nylas.exe isnt running
|
|
var killnylas = process.platform === 'win32' ? 'START taskkill /F /IM ' + productName + '.exe' : 'pkill -9 ' + productName + ' || true';
|
|
|
|
var commands = [
|
|
killnylas,
|
|
[__dirname, '..', 'node_modules'],
|
|
[__dirname, '..', 'build', 'node_modules'],
|
|
[__dirname, '..', 'apm', 'node_modules'],
|
|
[__dirname, '..', 'electron'],
|
|
[home, '.nylas', '.node-gyp'],
|
|
[home, '.nylas', 'storage'],
|
|
[home, '.nylas', '.npm'],
|
|
[home, '.nylas', 'compile-cache'],
|
|
[home, '.nylas', 'electron'],
|
|
[tmpdir, 'nylas-build'],
|
|
[tmpdir, 'nylas-cached-electrons'],
|
|
];
|
|
var run = function() {
|
|
var next = commands.shift();
|
|
if (!next)
|
|
process.exit(0);
|
|
|
|
if (Array.isArray(next)) {
|
|
var pathToRemove = path.resolve.apply(path.resolve, next);
|
|
if (fs.existsSync(pathToRemove))
|
|
next = removeCommand + pathToRemove;
|
|
else
|
|
return run();
|
|
}
|
|
|
|
cp.safeExec(next, run);
|
|
};
|
|
run();
|