mirror of
https://github.com/serverless/serverless.git
synced 2026-02-01 16:07:28 +00:00
implement version check
This commit is contained in:
parent
07712fcf99
commit
9ec317aa3a
@ -4,6 +4,7 @@ const SError = require('./Error').SError;
|
||||
const path = require('path');
|
||||
const _ = require('lodash');
|
||||
const BbPromise = require('bluebird');
|
||||
const version = require('../../package.json').version;
|
||||
|
||||
class Service {
|
||||
|
||||
@ -52,6 +53,12 @@ class Service {
|
||||
.then((serverlessFileParam) => {
|
||||
const serverlessFile = serverlessFileParam;
|
||||
// basic service level validation
|
||||
const ymlVersion = serverlessFile.frameworkVersion;
|
||||
if (ymlVersion && ymlVersion !== version) {
|
||||
const msgPartOne = `The Serverless version (${version}) is not matching the`;
|
||||
const msgPartTwo = `"frameworkVersion" (${ymlVersion}) in serverless.yml`;
|
||||
throw new SError(`${msgPartOne} ${msgPartTwo}`);
|
||||
}
|
||||
if (!serverlessFile.service) {
|
||||
throw new SError('"service" property is missing in serverless.yml');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user