Skip to content

Commit

Permalink
Show warning console if version.js file is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
sujono91 committed May 20, 2018
1 parent aae106c commit cc4256a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const readMetadata = require('./server/readMetadata.js');
const versionFallback = require('./server/versionFallback.js');

const CWD = process.cwd();

const hasVersionFile = fs.existsSync(CWD + '/pages/en/versions.js');

let versions;
if (fs.existsSync(CWD + '/versions.json')) {
versions = require(CWD + '/versions.json');
Expand All @@ -33,6 +36,15 @@ program
})
.parse(process.argv);

if (!hasVersionFile) {
console.error(
`${chalk.yellow(
'No version.js file founded!'
)}\nPlease create your version.js file in pages/en directory.`
);
process.exit(1);
}

if (typeof version === 'undefined') {
console.error(
`${chalk.yellow(
Expand Down

0 comments on commit cc4256a

Please sign in to comment.