patchboard / patchboard-js

JavaScript client for Patchboard APIs
MIT License
2 stars 5 forks source link

Publish a js package #16

Open bezreyhan opened 9 years ago

bezreyhan commented 9 years ago

We are using patchboard-js in our clients, which will be used by other developers. Any developer not using coffee-script will not be able to use the patchboard-js unless they compile it ahead of time. This includes compiling all of patchboard-js's coffee-script dependencies as well.

What do you think about publishing patchboard-js in javascript? This way both coffee-script and js developers could easily use the package.

I could compile it and publish a second patchboard-js package but I wanted to run it by you first. I thought that you may want to prevent any splits and confusion that may result from it.

automatthew commented 9 years ago

Would you want to change the "main" setting in package.json?

bezreyhan commented 9 years ago

To client.js? Yea, but from my understanding we will have to compile all of the src files, as well as node_module dependencies (i.e evie and fairmont).

automatthew commented 9 years ago

There's a lot that can be done with current situation:

bezreyhan commented 9 years ago

I've tried to browserify patchboard-js but wasn't able to because

In regards to Node.js users, I think developers would appreciate not having to add an extra dependency. You also have to run Coffee.register(), which while not a big deal it's an extra step that could be avoided.

Though, I think Browserify poses a bigger problem: even if you are using the coffee-script transform when browserifying a module, the transform cannot recursively transform all dependencies (i.e evie and fairmont). At least I wasn't able to get it to work in a straightforward way.

NPM has a pre-publish script that you can configure to run before the module is published. Placing coffee -c -o /lib /src will take care of it. Though this script will have to be placed in all coffee dependencies.

bezreyhan commented 9 years ago

Sorry, I misspoke - Fairmont is already published as a javascript package. The latest version of Evie seems to do the same, though it has a coffescript dependency (Typely).

After compiling Evie and Patchboard, browserify worked fine.

I made a pull request where I added a prepublish scrip to Patchboard but I'm not sure what we want to do about Evie. Do we want to upgrade to the latest version but then will have to add a prepublish script to Typely as well? Or do we want to use the same version of Evie but publish it as a js package?

automatthew commented 9 years ago

We can substitute vanilla EventEmitter for Evie. I'm testing this now.

automatthew commented 9 years ago

@bezreyhan master is now rid of Evie.