Comparing version 0.5.1 to 0.6.0
22
cli.js
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
const fs = require('fs'); | ||
const creative = JSON.parse(fs.readFileSync(cwd('./creative.json'))); | ||
@@ -64,19 +65,12 @@ const getValues = param => { | ||
const creative = JSON.parse(fs.readFileSync(cwd('./creative.json'))); | ||
let result = ''; | ||
const utils = { | ||
getAdParameters(params) { | ||
result = paramsTemplate(params); | ||
return params; | ||
}, | ||
}; | ||
try { | ||
const params = JSON.parse(fs.readFileSync(cwd('./params.json'))); | ||
result = paramsTemplate(params); | ||
} catch (e) { | ||
const utils = {getAdParameters: params => result = paramsTemplate(params)}; | ||
eval(fs.readFileSync(cwd('./js/params.js')).toString('utf8').replace(/export default |export /, '')); | ||
} | ||
let analyticsDescription; | ||
let sFile = fs.readFileSync(cwd('./js/params.js')).toString('utf8').replace(/export default |export /, ''); | ||
sFile += ';try{analyticsDescription = analytics} catch (e) { /* nop */ };'; | ||
eval(sFile); | ||
result += analyticsDescription ? analyticsTemplate(analyticsDescription) : ''; | ||
fs.writeFile(cwd('README.md'), result, () => ora('README.md created').succeed()); |
{ | ||
"name": "mhr", | ||
"description": "The util creates readme for creative", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "mhr": "cli.js" |
2166
62