lee-dohm / package-sync

Atom package synchronization across machines
https://atom.io/packages/package-sync
MIT License
61 stars 10 forks source link

Uninstall packages not listed in packages.cson #22

Closed jbhannah closed 2 years ago

jbhannah commented 8 years ago

Adds a setting that, when enabled, uninstalls packages missing from packages.cson on sync. Fixes #11.

lee-dohm commented 8 years ago

Can you resolve the conflicts here and add some specs?

jbhannah commented 8 years ago

Will-do. I did add a spec for the inverse case of getMissingPackages, any other in particular you're looking for?

dsifford commented 8 years ago

Any status updates on this? This feature alone will convert me from sync-settings to this package.

dsifford commented 8 years ago

Scratch the urgency. I just dropped this little script in my ~/bin directory and it seems to do the job just fine with this package installed.

ATOM-ORPHANED

#!/usr/bin/node
const fs = require('fs');
const { HOME } = process.env;
const haystack = fs.readFileSync(`${HOME}/.dotfiles/packages.cson`, 'utf8');
const hs = haystack.match(/"(.+)"/g).map(p => p.replace(/"/g, ''));
const needle = fs.readdirSync(`${HOME}/.atom/packages`)
  .filter(p => p !== '.wlck' && haystack.indexOf(p) === -1)
  .join('\n');

console.log(needle);

After running a package-sync:sync, I just do apm rm $(ATOM-ORPHANED) and all orphans are removed 👍

My packages.cson file is symlinked using Dotbot (if you're wondering about the weird location)

mauricerkelly commented 7 years ago

Is there anything holding this up from being merged? I would love to see this feature included.

czchen commented 7 years ago

@jbhannah

Any progress for this feature? I would love to have this feature in package-sync.

jbhannah commented 7 years ago

@czchen I haven't heard back from @lee-dohm if there are any other specs that he would like added before this can be merged in.

Gerschtli commented 6 years ago

@lee-dohm @jbhannah is there any chance, this PR gets merged?

Gerschtli commented 6 years ago

For the ones interested in a maintained alternative, have a look at https://atom.io/packages/manage-packages