Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Morphs package meta files into each other.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
test
.gitignore
.jshintrc
.npmignore
Gruntfile.js
LICENSE-MIT
README.md
index.js
package.json

README.md

metamorph

Morphs package meta files into each other.

Currently supports: npm, jamjs, component.

Using Globally

Install globally with: npm install metamorph -g

metamorph component.json jam will generate a jam compatible package.json meta file.

Specify a 3rd arg to change the output filepath: metamorph package.json component /some/path/component.json

Using Locally

Install with: npm install metamorph --save

var metamorph = require('metamorph');
var fs = require('fs');

// convert a component.json into a jam compatible package.json
metamorph('component.json', 'jam', function(err, data) {
  fs.writeFileSync('package.json', data);
});

// and back again
metamorph('package.json', 'component', 'component.json');

Feed it missing/override data:

var metamorph = require('metamorph');

var data = { repo: "shama/custom" };
metamorph('package.json', 'component', data, function(err, p) {
  console.log(JSON.parse(p).repo); // === 'shama/custom'
});

Stream

var metamorph = require('metamorph');
var fs = require('fs');

var mm = metamorph('component.json', 'jam');
mm.pipe(fs.createWriteStream('package.json'));
var Metamorph = require('metamorph').Metamorph;
var fs = require('fs');

var mm = new Metamorph('component');
fs.createReadStream('package.json')
  .pipe(mm)
  .pipe(fs.createWriteStream('component.json'));

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

  • 0.1.0 - Initial release.

License

Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

Something went wrong with that request. Please try again.