create-readme
Version:
Automatically creates README.md based on package.json and other existing files.
60 lines (50 loc) • 1.7 kB
JavaScript
// Generated by CoffeeScript 2.3.2
(function() {
var InstallParser, Promise, logger;
logger = require('../logger');
Promise = require('bluebird');
// Creates a installation informatin
module.exports = InstallParser = (function() {
class InstallParser {
// Creates a new InstallParser that parses installation information
// @param (options) [Object] An optional set of options
// @option options modules [Array<String>] Module formats supported by the module ['CommonJS']
constructor(options) {
var base, base1;
this.options = options;
if (this.options == null) {
this.options = {};
}
if ((base = this.options).modules == null) {
base.modules = ['CommonJS'];
}
if ((base1 = this.options).unpkg == null) {
base1.unpkg = false;
}
}
// Create data on installation
// @param pkg [Object] package.json data
// @returns [Promise<String>] Install info { modules: names: [string], unpkg: boolean }
run(pkg) {
logger.info("Creating installation info");
logger.debug(" Adding modules " + this.options.modules);
if (this.options.unpkg) {
logger.debug(" Adding unpkg");
}
return Promise.resolve({
modules: {
names: this.options.modules.map(function(module) {
return {
name: module
};
})
},
unpkg: this.options.unpkg
});
}
};
// @property [String] The name of this component
InstallParser.name = "InstallParser";
return InstallParser;
}).call(this);
}).call(this);