feat: supported bee version check (#223)

This commit is contained in:
Adam Uhlíř 2022-11-08 04:58:13 -08:00 committed by GitHub
parent 86e86491d4
commit 4b029108ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 11 deletions

44
package-lock.json generated
View File

@ -14,7 +14,8 @@
"dockerode": "^3.3.4",
"furious-commander": "^1.7.1",
"node-fetch": "3.0.0-beta.9",
"ora": "^5.3.0"
"ora": "^5.3.0",
"semver": "^7.3.8"
},
"bin": {
"bee-factory": "dist/src/index.js"
@ -47,7 +48,8 @@
"engines": {
"bee": "1.9.0",
"node": ">=12.0.0",
"npm": ">=6.0.0"
"npm": ">=6.0.0",
"supportedBee": ">=1.9.0"
}
},
"node_modules/@ampproject/remapping": {
@ -747,6 +749,21 @@
"node": ">=v14"
}
},
"node_modules/@commitlint/is-ignored/node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@commitlint/lint": {
"version": "17.1.0",
"resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-17.1.0.tgz",
@ -6387,9 +6404,9 @@
}
},
"node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@ -7801,6 +7818,17 @@
"requires": {
"@commitlint/types": "^17.0.0",
"semver": "7.3.7"
},
"dependencies": {
"semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
}
}
},
"@commitlint/lint": {
@ -11999,9 +12027,9 @@
}
},
"semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"requires": {
"lru-cache": "^6.0.0"
}

View File

@ -44,12 +44,13 @@
"dockerode": "^3.3.4",
"furious-commander": "^1.7.1",
"node-fetch": "3.0.0-beta.9",
"ora": "^5.3.0"
"ora": "^5.3.0",
"semver": "^7.3.8"
},
"devDependencies": {
"@ethersphere/jest-serial-runner": "^1.0.0",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@ethersphere/jest-serial-runner": "^1.0.0",
"@fluffy-spoon/substitute": "^1.208.0",
"@jest/types": "^29.2.1",
"@types/dockerode": "^3.3.11",
@ -74,6 +75,7 @@
"engines": {
"node": ">=12.0.0",
"npm": ">=6.0.0",
"bee": "1.9.0"
"bee": "1.9.0",
"supportedBee": ">=1.9.0"
}
}

View File

@ -12,6 +12,8 @@ import { waitForBlockchain, waitForQueen, waitForWorkers } from '../utils/wait'
import ora from 'ora'
import { VerbosityLevel } from './root-command/logging'
import { findBeeVersion, stripCommit } from '../utils/config-sources'
import PackageJson from '../../package.json'
import semver from 'semver'
const DEFAULT_REPO = 'ethersphere'
@ -101,6 +103,13 @@ export class Start extends RootCommand implements LeafCommand {
}
this.beeVersion = stripCommit(this.beeVersion)
const supportedBeeVersion = PackageJson.engines.supportedBee
if (!semver.satisfies(this.beeVersion, supportedBeeVersion)) {
throw new Error(
`Unsupported Bee version!\nThis version of Bee Factory supports versions: ${supportedBeeVersion}, but you have requested start of ${this.beeVersion}`,
)
}
const dockerOptions = await this.buildDockerOptions()
const docker = new Docker(this.console, this.envPrefix, this.imagePrefix, this.repo)