2021-01-22 15:54:13 +08:00
|
|
|
const Handlebars = require('handlebars');
|
|
|
|
const fs = require('fs');
|
|
|
|
const pjson = require('../package.json');
|
|
|
|
|
2021-01-23 21:07:47 +08:00
|
|
|
const parameters = process.argv.slice(2);
|
|
|
|
const outputFilePath = parameters[0];
|
2021-01-22 15:54:13 +08:00
|
|
|
|
2021-01-23 21:07:47 +08:00
|
|
|
console.debug('');
|
|
|
|
const template = Handlebars.compile('/*! {{ name }} v{{ version }} | MIT License | https://github.com/{{ author }}/{{ name }} */');
|
2021-01-22 15:54:13 +08:00
|
|
|
const result = template(pjson);
|
|
|
|
|
|
|
|
fs.writeFile(outputFilePath, result, err => {
|
|
|
|
if (err) {
|
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|