A console application that accepts Alien details and exports the same into a file of a certain format.
Please report any bugs or issues here.
Install Node.js
$ npm install
$ node aliens
$ node aliens --text
$ node aliens --pdf
|-- aliens.js
|-- add-generator.js
|-- command-line-arguments.js
|-- update-command-line-arguments.js
|-- generators
| |-- generate-pdf.js
| |-- generate-text.js
|-- package.json
|-- alien-details.js
|-- output
| |-- ALL GENERATED FILES WILL APPEAR HERE!
- Create a
<PLUGIN FILE NAME>.js
file - Write a function
var generate<FORMAT NAME> = function(alienDetails, numberOfAliens)
, for example -var generatePdf = function(alienDetails, numberOfAliens)
- Export function using
module.exports = generate<FORMAT NAME>
, for example -module.exports = generatePdf;
For reference, see this!
For reference,
alienDetails - is a JSON Object that contains all the alien details that have been accepted by the console application, with keys as specified by the alien-details.js
file and the corresponding values are the accepted details store sequentially.
An example, is as shown below
alienDetails = {
'Code Name': ["Jar Jar Binks", "Jaba the Hutt"],
'Blood Colour': ["red", "green"],
'Number of Antennas': ["2", "0"],
'Number of Legs': ["2", "2"],
'Home Planet': ["Naboo", "Tattooine"]
};
$ node add-generator.js -f <FORMAT NAME> -p <FULL PATH TO PLUGIN FILE>
Once a format generation plugin has been added using the add-generator.js
file, the corresponding command line argument to generate that format at runtime is --<FORMAT NAME>
. As an example, for the generator generator-pdf.js
, the command line argument is --pdf
Add the parameter as a key-value pair to the alienDetails
Javascript object in the alien-details.js
file by the following specification - '<PARAMETER NAME>': []
. For example, 'Number of Eyes: []
.