How to use the CSON parser in your package?


In my package, the structure of view is designed in CSON. From that, it programmatically parses the CSON and builds the HTML. That’s how my view system will work

But there is one problem in this system of events. I cannot figure out how to require the parser that’s necessary for parsing the view’s structure.

From this post I saw that atom uses a package called season to parse it’s CSON. So here is what I did:

CSON = require "season"

This would appear to be the way to require the season library, based on the post, but I get an error:

Error: Cannot find module ‘season’

Due to this error, I’m forced to keep looking…
And while browsing through Atom’s GitHub, I ran across another library. It was named cson-safe

So, I decided to give it a shot as well:

CSON = require "cson-safe"

But again, I get the same error:

Error: Cannot find module ‘cson-safe’

How can I parse CSON from my package?


Atom still uses season. You have to include it as a dependency of your package though before you can use it since it is an npm module.


You must have the module installed before you can require it. To install it, navigate to your package’s directory and run npm install --save season.