Skip to content

Commit 5f7f18a

Browse files
committed
fix(uninstall): remove instance from global config on ghost uninstall
closes #205 - remove all instances with the same cwd as the installation on `ghost uninstall`
1 parent cf21285 commit 5f7f18a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/commands/uninstall.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const fs = require('fs-extra');
3+
const filter = require('lodash/filter');
34

45
const stop = require('./stop');
56
const Config = require('../utils/config');
@@ -37,6 +38,12 @@ module.exports.execute = function execute() {
3738

3839
return this.ui.run(this.service.callHook('uninstall'), 'Removing related configuration');
3940
}).then(() => this.ui.run(() => {
41+
let systemConfig = Config.load('system');
42+
let cleanedInstances = filter(systemConfig.get('instances'), (instance) => {
43+
return instance.cwd !== process.cwd();
44+
});
45+
systemConfig.set('instances', cleanedInstances).save();
46+
4047
return Promise.all(fs.readdirSync('.').map(file => fs.remove(file)));
4148
}, 'Removing Ghost installation'));
4249
}

0 commit comments

Comments
 (0)