Skip to content

Commit

Permalink
refactor: remove serverless compat check
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jul 9, 2022
1 parent cac991a commit 21779ff
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 106 deletions.
11 changes: 8 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"object.hasown": "^1.1.1",
"p-memoize": "^7.1.0",
"p-retry": "^5.1.1",
"semver": "^7.3.7",
"velocityjs": "^2.0.6",
"ws": "^8.8.0"
},
Expand Down
33 changes: 0 additions & 33 deletions src/ServerlessOffline.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { createRequire } from 'node:module'
import process, { env, exit } from 'node:process'
import { log } from '@serverless/utils/log.js'
import chalk from 'chalk'
import semver from 'semver'
import { satisfiesVersionRange } from './utils/index.js'
import {
commandOptions,
CUSTOM_OPTION,
defaultOptions,
SERVER_SHUTDOWN_TIMEOUT,
} from './config/index.js'

const require = createRequire(import.meta.url)
const pkg = require('../package.json')

export default class ServerlessOffline {
#cliOptions = null

Expand Down Expand Up @@ -68,8 +62,6 @@ export default class ServerlessOffline {
// Put here so available everywhere, not just in handlers
env.IS_OFFLINE = true

this.#verifyServerlessVersionCompatibility()

this._mergeOptions()

const { httpEvents, lambdas, scheduleEvents, webSocketEvents } =
Expand Down Expand Up @@ -396,29 +388,4 @@ export default class ServerlessOffline {
getApiGatewayServer() {
return this.#http.getServer()
}

// TODO: missing tests
#verifyServerlessVersionCompatibility() {
const currentVersion = this.#serverless.version
const requiredVersionRange = pkg.peerDependencies.serverless

if (semver.parse(currentVersion).prerelease.length) {
// Do not validate, if run against serverless pre-release
return
}

const versionIsSatisfied = satisfiesVersionRange(
currentVersion,
requiredVersionRange,
)

if (!versionIsSatisfied) {
log.warning(
`'serverless-offline' requires 'serverless' version '${requiredVersionRange}' but found version '${currentVersion}'.
Be aware that functionality might be limited or contains bugs.
To avoid any issues update 'serverless' to a later version.
`,
)
}
}
}
55 changes: 0 additions & 55 deletions src/utils/__tests__/satisfiesVersionRange.test.js

This file was deleted.

1 change: 0 additions & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export { default as parseHeaders } from './parseHeaders.js'
export { default as parseMultiValueHeaders } from './parseMultiValueHeaders.js'
export { default as parseMultiValueQueryStringParameters } from './parseMultiValueQueryStringParameters.js'
export { default as parseQueryStringParameters } from './parseQueryStringParameters.js'
export { default as satisfiesVersionRange } from './satisfiesVersionRange.js'
export { default as splitHandlerPathAndName } from './splitHandlerPathAndName.js'
export { default as checkDockerDaemon } from './checkDockerDaemon.js'
export { default as checkGoVersion } from './checkGoVersion.js'
Expand Down
13 changes: 0 additions & 13 deletions src/utils/satisfiesVersionRange.js

This file was deleted.

0 comments on commit 21779ff

Please sign in to comment.