Search code examples
javascriptbuildcoffeescriptopen-source

How should I organize a JS open source library project?


I maintain a JS frontend library.

To get going I wrote it in Rails, as that's what I know. It works quite well if you have Rails installed, but it's a pretty silly way to work for anyone else.

What's a "best practice" way to organize a frontend JS library written in CoffeeScript on Github?

There needs to be simple ways to

  1. build a compressed compiled release version from a set of CoffeeScript files.

  2. run a fresh version in the browser during development

  3. run a test suite


Solution

  • i am not sure whether my suggestion will answer your question or not.

    my suggestion are

    1. use dependency management tool, e.g., npm or bower to manage 3rd parties lib
    2. use build tool, e.g., grunt or gulp or webpack to build your packange including minify, get only needed files, compile coffee to js
    3. use mocha or other test framework to run test

    then integrate tasks above to ci tool, e.g., jenkins to automate them

    your jenkins job will do these task step by step

    1. pull code from github auto
    2. clean your repo, e.g., git reset --hard && git clean -xdf
    3. npm install or bower install
    4. run webpack or grunt or gulp
    5. run test