Installed packages list into single file


#1

I would love if Atom came up with some sort of json file which includes all the installed packages.
I’m using Mac and Windows, now I have setup a git repository for my .atom folder, so that I can sync my settings, installed packages and themes via git, so that I wouldn’t need to do eveything twice (both on Mac and on Windows).
Now I think that syncing everything under .atom folder isn’t that great idea. I’d rather want to sync one file which lists all installed packages, so that I could easily keep both of my Atom installations in sync.


#2

There are a couple different ways to do this:

  1. Use the Stars functionality to keep a list of the packages you use
  2. Use a script to list the directories in the ~/.atom/packages folder and save that to a file

Stars

You can use the https://atom.io/packages site to find the packages you like and Star them. Or you can star the packages you like from the command line by issuing the command apm star package-name. Then you can install all of your starred packages at any time by executing the command apm stars --install at the command line.

You can also use the apm star --installed command to easily star all the packages you currently have installed.

(This is the method I use.)

Package List

You use the following:

apm list --installed --bare > package-list.txt

to create your package list and then apm install --packages-file package-list.txt to install them.

Edit: Since I’m referring to this post for people asking the question, I’ve updated it with the latest information.


How can I make the package list portable?
Is it possible to backup Atom packages to be able to auto-install them when using Atom on multiple computers
Example of Atom integrated into a dotfiles setup
Easy way to view user installed packages on settings
#3

Doesn’t apm list do the job?


#4

There are line-drawing elements, version numbers and headings in the apm list output. Also apm list lists all packages including the built-in ones. That’s why I opened the enhancement request on the apm tool … so that it will work :smile:


#5

@mark_hahn, The stars functionality saves on the server and will load all of yours for you across environments for you…


#6

Oops, I guess you meant instead of the ls command, yeah well it’s not your standard unix like, homogenous line output heh…


#7

I think https://atom.io/packages/parcel does something like this. It does write to a packages.cson file in your .atom/ folder, though I’m not sure if that’s what you wanted or not. I like it. The apm stars stuff was lacking something like a --prune-uninstalled feature when I played with it IIRC.


#8

I wanted/want to get a single file which will trigger Atom to automatically install/update every single package in that file.
I know I can get a list of installed packages via few command line commands, so that I could manually install them on my other OS, but that’s not what I meant/wanted. I’d want Atom to automatically install/update every single package found from one file, so that I could have synchronized installed packages on my OSX and Windows, without any effort from me. Now I’m handling it via git (and maybe I could handle it with it in the future, if I made my repository more rational), but I’m fairly certain I’m not the only one who would want this feature and not everyone wants to handle it via git repository(?).

It was just a suggestion and I think it wouldn’t take that much of a time to make such a feature, which would help users like me a lot.


#9
apm stars --install

Didn’t work for you @kirbo?


#10

I didn’t care for apm stars because it requires an account on the server which I generally don’t want to bother with when I’m bringing up a fresh system (which is often a disposable VM that I want to just bring up as quickly as possible). Rather than commit 80MBs of packages to my dotfiles repo, I came up with the a simple Makefile that automates syncing packages for me. So now I have a ~/.atom/Makefile that looks like this:

install-all-packages:
	cat packages.list | xargs apm install

packages.list: packages/*/
	ls packages/ > packages.list

So, two simple rules, whenever I add or remove a package on my main machine, I run make packages.list and it records my current configuration of packages, which I then commit to my github dotfiles project, and then on my other machines I just run make and all those packages are automatically installed.


#11

I’m trying to use the list file method. I have generated my packages file, which I store on Dropbox, but when I run

apm install --package-file atom-packages.txt
I get the following error:
npm ERR! install Couldn't read dependencies
npm ERR! Linux 3.13.0-48-generic
npm ERR! argv "/opt/atom/resources/app/apm/bin/node" "/opt/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/home/goffreder/.atom/.apm/.apmrc" "--userconfig" "/home/goffreder/.atom/.apmrc" "install" "--target=0.22.0" "--arch=x64"
npm ERR! node v0.10.35
npm ERR! npm  v2.5.1
npm ERR! path /home/goffreder/Dropbox/Resources/scripts/.dotfiles/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34

npm ERR! package.json ENOENT, open '/home/goffreder/Dropbox/Resources/scripts/.dotfiles/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/goffreder/Dropbox/Resources/scripts/.dotfiles/npm-debug.log

This is my npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/opt/atom/resources/app/apm/bin/node',
1 verbose cli   '/opt/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js',
1 verbose cli   '--globalconfig',
1 verbose cli   '/home/goffreder/.atom/.apm/.apmrc',
1 verbose cli   '--userconfig',
1 verbose cli   '/home/goffreder/.atom/.apmrc',
1 verbose cli   'install',
1 verbose cli   '--target=0.22.0',
1 verbose cli   '--arch=x64' ]
2 info using npm@2.5.1
3 info using node@v0.10.35
4 error install Couldn't read dependencies
5 verbose stack Error: ENOENT, open '/home/goffreder/Dropbox/Resources/scripts/.dotfiles/package.json'
6 verbose cwd /home/goffreder/Dropbox/Resources/scripts/.dotfiles
7 error Linux 3.13.0-48-generic
8 error argv "/opt/atom/resources/app/apm/bin/node" "/opt/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/home/goffreder/.atom/.apm/.apmrc" "--userconfig" "/home/goffreder/.atom/.apmrc" "install" "--target=0.22.0" "--arch=x64"
9 error node v0.10.35
10 error npm  v2.5.1
11 error path /home/goffreder/Dropbox/Resources/scripts/.dotfiles/package.json
12 error code ENOPACKAGEJSON
13 error errno 34
14 error package.json ENOENT, open '/home/goffreder/Dropbox/Resources/scripts/.dotfiles/package.json'
14 error package.json This is most likely not a problem with npm itself.
14 error package.json npm can't find a package.json file in your current directory.
15 verbose exit [ 34, true ]

#12

It should be apm install --packages-file packages.txt You for got the s in packages-file


#13

Of course it’s working -___-. Thank you.


#14

I’d like to +1 this. I’m often working on different systems, and generally I just install my dotfiles and go. The rest of atom’s state exists in files like config.cson or keymaps.cson and are easily transferred, but the packages are the notable (and important) exception.

I certainly can add another step to the process, but that adds a little more friction that would be nice to remove.


#15

Since we already have packages exporting configs in config.json, i.e.

  "one-dark-ui": {}
  jshint:
    supportLintingJsx: true

why not adding the version there and make sure all installed packages are listed instead of just those exporting configs?

  "one-dark-ui":
    version: "1.0.3"
  jshint:
    version: "1.3.10"
    supportLintingJsx: true

#16

Here’s an example of a shared atom configuration with a package list as suggested by @leedohm.

Previously we staged the complete .atom directory which was a pain.


#17

To expand a little…

To star all installed:

apm star --installed (you will be prompted for an API token from https://atom.io/account )

To get the list of stars:

apm stars (or if you prefer, using the alias apm starred)

To install all (already) starred:

apm stars --install (or if you prefer, using the alias apm starred --install)


#18

That’s great. However, is possible to list only enabled installed packages? To list only the ones we really use.


#19

Not from the command line, no.


#20

Thanks. That solved my problem. I use Mac and Linux, this method really helps me a lot.