warn if bad value

This commit is contained in:
Ryan Lewis 2017-09-14 22:38:05 -07:00
parent 965ae8acec
commit e2eef30453

View File

@ -5,6 +5,7 @@ const BbPromise = require('bluebird');
const fs = BbPromise.promisifyAll(require('fs'));
const _ = require('lodash');
const os = require('os');
const chalk = require('chalk');
const findKeyChain = (astContent) => {
let content = astContent;
@ -24,6 +25,11 @@ const parseAST = (ymlAstContent, astObject) => {
let newAstObject = astObject || {};
if (ymlAstContent.mappings && _.isArray(ymlAstContent.mappings)) {
_.forEach(ymlAstContent.mappings, (v) => {
if (!v.value) {
console.log(`Serverless: ${chalk.red(`Your serverless.yml has an invalid value with key: ${v.key.value}. Ignoring...`)}`);
return;
}
if (v.key.kind === 0 && v.value.kind === 0) {
newAstObject[findKeyChain(v)] = v.value;
} else if (v.key.kind === 0 && v.value.kind === 2) {