Home > commonize

commonize

Commonize is a project mainly written in JavaScript, it's free.

A utility to convert RingoJS modules into pure CommonJS modules

Commonize

This is a RingoJS package that converts one or more RingoJS modules to portable CommonJS code by replacing their use of include() and export() with require() and the exports object, respectively. For example, the following fragment from the ringo/webapp/response module:

include('binary');
include('./util');
include('./mime');

export('Response',
       'skinResponse',
       'jsonResponse',
       'xmlResponse',
       'staticResponse',
       'redirectResponse',
       'notFoundResponse',
       'errorResponse');

will be converted to this:

var {ByteArray} = require('binary');
var {Headers, getMimeParameter} = require('./util');
var {mimeType} = require('./mime');

// Generated by commonize
exports.Response = Response;
exports.skinResponse = skinResponse;
exports.jsonResponse = jsonResponse;
exports.xmlResponse = xmlResponse;
exports.staticResponse = staticResponse;
exports.redirectResponse = redirectResponse;
exports.notFoundResponse = notFoundResponse;
exports.errorResponse = errorResponse;

Warning

This script will edit your files in-place without making backups.

Never ever run this script on resources that are not under a version control system.

Usage

bin/commonize path/to/directory/or/file
Previous:MOIA