1.1.0 • Published 9 years ago
commonify v1.1.0
Converts AMD/RequireJS modules to CommonJS. Supports CoffeeScript.
Commonify
As you know, AMD handles path differently than CommonJS. Commonify automatically finds correct path using fuzzy search.
Example
Before convertation
define ['underscore', 'models/user'], (_, User) ->
initialize: (app) ->
After convertation
_ = require('underscore')
User = require('./models/user')
module.exports =
initialize: (app) ->
Usage
Install and run
$ npm install -g commonify
$ commonify app/*.coffee
$ commonify [--dry] files
Contributing (doesn't work? How to fix)
While this project lacks unit tests (yet), it has workflow focused on fixing bugs in the wild.
So, if you encounter the bug, please:
- Clone the repo, install deps in
npm install
. - Run Commonify in development mode (see below).
- You will likely want to fix grammar file coffee.pegjs. Use PEG.js docs for that. When you change any source file, Commonify re-runs the convertation.
- Do few quickly iterations.
- When you're done with the file, re-run Commonify on the whole project and review diffs.
Development Mode
$ git clone https://github.com/Lendar/commonify; cd commonify
$ npm start --files=../existing-project/file.coffee
Inspired by Bret Victor - Inventing on Principle talk
Licence
Copyright (c) 2015 Denis Elistratov