Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async make () {
const destinationDir = join(this._projectRoot, this._location, this._basedir)
const fileNameForLogs = join(this._basedir, this._location, this._fileName)
await ensureDir(destinationDir)
const resource = new TemplateFile(destinationDir, this._fileName, this._template)
/**
* Return early when resource file already exists
*/
if (resource.exists()) {
fancyLogs.error(`${fileNameForLogs} file already exists`)
return
}
resource
.apply(Object.assign(this._data, { resourceName: this._resourceName }))
.commit()
fancyLogs.create(fileNameForLogs)
}
}
.forEach((name: string) => {
const outputFileName = name.replace(/\.txt$/, '.ts')
const src = join(__dirname, '..', 'templates', state.boilerplate, name)
new TemplateFile(absPath, outputFileName, src).apply({}).commit()
logger.create(outputFileName)
})
}