Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
feat(setup): Add warning if config file exist
Browse files Browse the repository at this point in the history
issue #16
  • Loading branch information
ianpogi5 committed Oct 27, 2019
1 parent e9b9f0c commit 1e9d94f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/kdc-cms-setup/lib/questions-aws.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
const inquirer = require("inquirer");
const validator = require("validator");
const {
Expand All @@ -12,6 +13,9 @@ const rootDir = path.resolve(__dirname, "../../../");

const start = async ctx => {
const { stage } = ctx;

console.log(`Setting up STAGE: ${chalk.green.bold(stage)}\n`);

if (stage === "local") {
return ctx;
}
Expand All @@ -25,10 +29,21 @@ const start = async ctx => {
} catch (error) {}

if (configFileExists) {
console.log(
chalk.bold("=================================") +
chalk.red.bold(" WARNING!!! ") +
chalk.bold("=================================\n\n") +
`'${chalk.bold.red(
`config.${stage}.yml`
)}' exist. This mean you've run setup for this stage before.\n` +
`Continuing means the file contents will be delete and you'll lose control\n` +
`over the previous setup.\n`
);

ans = await inquirer.prompt([
{
type: "confirm",
message: `config.${stage}.yml already exist. Contents will be deleted. Are you sure you want to continue?`,
message: `Are you sure you want to continue?`,
name: "configOverwrite",
default: false
}
Expand Down

0 comments on commit 1e9d94f

Please sign in to comment.