From 941570a14060793f0123f0aa73beaf4d035fef26 Mon Sep 17 00:00:00 2001 From: Karl-Philipp Wulfert Date: Tue, 4 Dec 2018 17:27:24 +0100 Subject: [PATCH] refactor: add prefix to templates to avoid side effects --- src/cli.ts | 6 ++++-- templates/{.npmignore => template-.npmignore} | 0 templates/{tsconfig.json => template-tsconfig.json} | 0 templates/{tslint.json => template-tslint.json} | 0 4 files changed, 4 insertions(+), 2 deletions(-) rename templates/{.npmignore => template-.npmignore} (100%) rename templates/{tsconfig.json => template-tsconfig.json} (100%) rename templates/{tslint.json => template-tslint.json} (100%) diff --git a/src/cli.ts b/src/cli.ts index c796bd69..ca5971d4 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -79,14 +79,16 @@ NEEDED_FILES.forEach((file) => { // remove templates directory for destination files if (destinationFile.indexOf('templates') === 0) { destinationFile = destinationFile.split(sep).slice(1).join(sep); + file = `templates/template-${destinationFile}`; } + const source = resolve(__dirname, '..', file); const destination = resolve(path, destinationFile); // check if file exists or replace flag is set if (!existsSync(destination) || commander.replace) { - copyFileSync(resolve(__dirname, '..', file), destination); - console.info(`Added file "${destination}".`); + copyFileSync(source, destination); + console.info(`Copied file "${source}" to "${destination}".`); } else { console.info(`Not replacing "${destination}". Use "-r" or "--replace" to do so.`); } diff --git a/templates/.npmignore b/templates/template-.npmignore similarity index 100% rename from templates/.npmignore rename to templates/template-.npmignore diff --git a/templates/tsconfig.json b/templates/template-tsconfig.json similarity index 100% rename from templates/tsconfig.json rename to templates/template-tsconfig.json diff --git a/templates/tslint.json b/templates/template-tslint.json similarity index 100% rename from templates/tslint.json rename to templates/template-tslint.json