~romuloalves/create-micro

e343a3ddc59eab33b7fc8ae2db29b8ad7ba76a7f — romuloalves 1 year, 5 months ago 32bfee9
Fixes XO errors
4 files changed, 9 insertions(+), 5 deletions(-)

M bin/create-file.js
M bin/get-template-files.js
M bin/index.js
M bin/render-template.js
M bin/create-file.js => bin/create-file.js +3 -2
@@ 11,10 11,11 @@ module.exports = (data, dirname) => {
      if (!existsSync(dir)) {
        mkdirSync(dir)
      }

      writeFileSync(distPath.replace('.tmpl', ''), data.content)
      resolve()
    } catch (err) {
      reject(err)
    } catch (error) {
      reject(error)
    }
  })
}

M bin/get-template-files.js => bin/get-template-files.js +2 -0
@@ 13,12 13,14 @@ module.exports = options => {
    if (!basenameFile.endsWith('.tmpl')) {
      return false
    }

    for (const key in options) {
      if (basenameFile.startsWith(key)) {
        return !options[key]
      }
    }
  }

  return new Promise((resolve, reject) => {
    recursive(templatePath, [ignoreFiles], (err, files) => {
      if (err) {

M bin/index.js => bin/index.js +3 -3
@@ 43,8 43,8 @@ createDir(name)
    return install(projectPath)
  })
  .then(() => console.log(chalk.green('\nDone!')))
  .catch(err => {
    console.log(chalk.red(`ERROR`))
    console.error(err)
  .catch(error => {
    console.log(chalk.red('ERROR'))
    console.error(error)
    trash(name)
  })

M bin/render-template.js => bin/render-template.js +1 -0
@@ 11,6 11,7 @@ module.exports = (templateData, data) => {
    if (!files || files.length === 0) {
      return resolve([])
    }

    const renderedFiles = files.map(file => {
      const content = fs.readFileSync(file, {encoding: 'utf-8'})
      const rendered = mustache.render(content, data)