Skip to content

Commit

Permalink
fix: log the message before copying (#71)
Browse files Browse the repository at this point in the history
* fix: destructure import for format

* fix: fix logging bug when installing files
  • Loading branch information
varl authored Jun 13, 2019
1 parent 7930085 commit 531e115
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ function wipeConfigFiles(repo) {

function copy(from, to, overwrite = true) {
try {
fs.ensureDirSync(path.dirname(to))
fs.copySync(from, to, { overwrite })
if (fs.existsSync(to) && overwrite) {
log.info(
`Installing configuration file: ${path.relative(
if (fs.existsSync(to) && !overwrite) {
log.warn(
`Skip existing configuration file: ${path.relative(
process.cwd(),
to
)}`
)
} else {
log.warn(
`Skip existing configuration file: ${path.relative(
log.info(
`Installing configuration file: ${path.relative(
process.cwd(),
to
)}`
)
}
fs.ensureDirSync(path.dirname(to))
fs.copySync(from, to, { overwrite })
} catch (err) {
log.error(`Failed to install configuration file: ${to}`, err)
}
Expand Down

0 comments on commit 531e115

Please sign in to comment.