Hemanth.HM

A Computer Polyglot, CLI + WEB ♥'r.

Atom Editor Packages With Yeoman

| Comments

atom editor the editor that GitHub is building the text editor we've always wanted is at a very early state and has some great potential, luckily got an invite from to paw at and it and did a silly plugin for it as well which just plays around with some text converting colors to RGB:

RGB

Lately I wrote a Yeoman generator to create packages from atom editor. You can paw at the source of generator-atom and install it npm install generator-atom

Simple demo of using generator-atom:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
[generator-atom] $ mkdir atom-plugin && cd $_
[generator-atom] $ yo atom

     _-----_
    |       |
    |--(o)--|   .--------------------------.
   `---------´  |    Welcome to Yeoman,    |
    ( _´U`_ )   |   ladies and gentlemen!  |
    /___A___\   '__________________________'
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

You're using the fantastic Atom generator.
[?] What would like name your atom package? atom-plugin
[?] Descirbe your package in one-line: My awesome atom package!
[?] What license would apply for this package? MIT
[?] What's your github username? hemanth
[?] Are you using any grammars? yes
[?] Are you using keymaps? yes
[?] Are you adding menus? yes
[?] Are you writing any snippets? yes
[?] Are you doing some stylesheets? yes
   create lib/atom-plugin.coffee
   create grammars/grammar.cson
   create keymaps/keymap.cson
   create stylesheets/style.css
   create menus/application-menu.cson
   create menus/context-menu.cson
   create snippets/language.cson
   create spec/atom-plugin_test.coffee
   create spec/fixtures/atom-plugin_fixture.coffee
   create .jshintrc
   create .gitignore
   create .travis.yml
   create README.md
   create package.json
   create index.coffee


I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.


[generator-atom] $ tree
.
├── README.md
├── grammars
│   └── grammar.cson
├── index.coffee
├── keymaps
│   └── keymap.cson
├── lib
│   └── atom-plugin.coffee
├── menus
│   ├── application-menu.cson
│   └── context-menu.cson
├── package.json
├── snippets
│   └── language.cson
├── spec
│   ├── atom-plugin_test.coffee
│   └── fixtures
│       └── atom-plugin_fixture.coffee
└── stylesheets
    └── style.css

8 directories, 12 files

You may not need all of the directories, indeed based on your need. Each of those file will have minimal boilerplate code that would help you get started.

The index.coffee includes the file in the lib dir and it looks like:

1
2
3
module.exports = require "./lib/atom-plugin"

# Add the rest of the logic below.

The package.json would be:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
  "name": "atom-plugin",
  "main": "./lib/atom-plugin",
  "version": "0.0.0",
  "description": "My awesome atom package!",
  "license": "MIT",
  "private": true,
  "repository": "https://github.com/hemanth/atom-plugin",
  "engines": {
    "atom": ">0.61.0"
  },
  "dependencies": {
  }
}

If you notice the version is 0.0.0 and modifying the code as per the need, you could do a apm publish minor to publish the package, giving the fact that the repo is published in Github.

gif FTW?

atom

Yeoman as always been at our service to make life easier, hope this generator helps you to create atom packages with ease!

Further, it would be useful if you could read creating atom package an official documentation and their API.

Comments