Comparing version 0.2.2 to 0.2.3
30
cli.js
#!/usr/bin/env node | ||
const cwd = require(`cwd`); | ||
const ora = require(`ora`); | ||
const fs = require(`fs`); | ||
const cwd = require('cwd'); | ||
const ora = require('ora'); | ||
const fs = require('fs'); | ||
const rowTemplate = (name, option) => ` | ||
const rowTemplate = (name, param) => ` | ||
<tr> | ||
<td>${name}</td> | ||
<td>${option.type}</td> | ||
<td>${option.default}</td> | ||
<td>${typeof option.default === `boolean` ? `true or false` : | ||
option.range instanceof Array ? `From ${option.range[0]} to ${option.range[1]}` : | ||
option.range || ``}</td> | ||
<td>${option.description || ``}</td> | ||
<th>${name}</th> | ||
<th>${param.type}</th> | ||
<th>${param.default}</th> | ||
<th>${typeof param.default === 'boolean' ? 'true or false' : | ||
param.range instanceof Array ? `From ${param.range[0]} to ${param.range[1]}` : | ||
param.range || ''}</th> | ||
<th>${param.description || ''}</th> | ||
</tr>`; | ||
@@ -29,10 +29,10 @@ | ||
</thead> | ||
<tbody>${Object.keys(params).map(name => rowTemplate(name, params[name])).join(``)}</tbody> | ||
<tbody>${Object.keys(params).map(name => rowTemplate(name, params[name])).join('')}</tbody> | ||
</table> | ||
`; | ||
const creative = JSON.parse(fs.readFileSync(cwd(`./creative.json`))); | ||
const creative = JSON.parse(fs.readFileSync(cwd('./creative.json'))); | ||
const utils = { | ||
getAdParameters(params) { | ||
fs.writeFile(cwd(`README.md`), template(params), () => ora(`README.md created`).succeed()); | ||
fs.writeFile(cwd('README.md'), template(params), () => ora('README.md created').succeed()); | ||
return params; | ||
@@ -42,2 +42,2 @@ } | ||
eval(fs.readFileSync(cwd(`./js/params.js`)).toString(`utf8`).replace(/export default |export /, ``)); | ||
eval(fs.readFileSync(cwd('./js/params.js')).toString('utf8').replace(/export default |export /, '')); |
{ | ||
"name": "mhr", | ||
"description": "The util creates readme for creative", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "mhr": "cli.js" |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2
1462