mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-19 15:08:08 +03:00
Add script/clean
This commit is contained in:
parent
c4e06d9411
commit
e825d8d391
13
script/clean
Executable file
13
script/clean
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
const cleanCaches = require('./lib/clean-caches')
|
||||
const cleanDependencies = require('./lib/clean-dependencies')
|
||||
const cleanOutputDirectory = require('./lib/clean-output-directory')
|
||||
const killRunningAtomInstances = require('./lib/kill-running-atom-instances')
|
||||
|
||||
killRunningAtomInstances()
|
||||
cleanDependencies()
|
||||
cleanCaches()
|
||||
cleanOutputDirectory()
|
27
script/lib/clean-caches.js
Normal file
27
script/lib/clean-caches.js
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs-extra')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
|
||||
const CONFIG = require('../config')
|
||||
|
||||
module.exports = function () {
|
||||
const cachePaths = [
|
||||
path.join(CONFIG.repositoryRootPath, 'cache'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', '.node-gyp'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', 'storage'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', '.apm'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', '.npm'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', 'compile-cache'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', 'atom-shell'),
|
||||
path.join(CONFIG.homeDirPath, '.atom', 'electron'),
|
||||
path.join(os.tmpdir(), 'atom-build'),
|
||||
path.join(os.tmpdir(), 'atom-cached-atom-shells')
|
||||
]
|
||||
|
||||
for (let path of cachePaths) {
|
||||
console.log(`Cleaning ${path}...`)
|
||||
fs.removeSync(path)
|
||||
}
|
||||
}
|
12
script/lib/kill-running-atom-instances.js
Normal file
12
script/lib/kill-running-atom-instances.js
Normal file
@ -0,0 +1,12 @@
|
||||
const childProcess = require('child_process')
|
||||
|
||||
const CONFIG = require('../config.js')
|
||||
|
||||
module.exports = function () {
|
||||
if (process.platform === 'win32') {
|
||||
// Use START as a way to ignore error if Atom.exe isnt running
|
||||
childProcess.execSync(`START taskkill /F /IM ${CONFIG.appMetadata.productName}.exe`)
|
||||
} else {
|
||||
childProcess.execSync(`pkill -9 ${CONFIG.appMetadata.productName} || true`)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user