yuan-cmd2amd

0.0.3 • Public • Published

yuan-cmd2amd is used to transform javascript code from CMD to AMD. Here, CMD means Common Module Definition, and AMD means Asynchronous Module Definition. When globally installed through npm install -g yuan-cmd2amd, a command named cmd2amd will be created in your system. You may also invoke such functionality through an API provided by require('yuan-cmd2amd'). In current version, recursive transformation is NOT supported yet.

Install

npm install -g yuan-cmd2amd

Run In CLI

# Display help info. 
cmd2amd -h
 
# Transfer js file. 
cmd2amd --input ./some.js --output ./some.amd.js

API

var cmd2amd = require('yuan-cmd2amd');
 
var cmdCode = fs.readFileSync('/path/to/jsfile', 'utf8');
var options = {
    execOnRequired : false,
    moduleBuiltIn : false
};
var amdCode = cmd2amd(cmdCode, options);

Demo

# Run demo. 
cd $(npm root -g)/yuan-cmd2amd
npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i yuan-cmd2amd

Weekly Downloads

0

Version

0.0.3

License

SEE LICENSE IN LICENSE.txt

Last publish

Collaborators

  • youngoat