mirror of
https://github.com/logos-storage/codex-factory.git
synced 2026-01-03 13:33:06 +00:00
feat: allow version with commit hash
This commit is contained in:
parent
b7659fc8b4
commit
9c99180aac
@ -11,7 +11,7 @@ import {
|
||||
import { waitForBlockchain, waitForQueen, waitForWorkers } from '../utils/wait'
|
||||
import ora from 'ora'
|
||||
import { VerbosityLevel } from './root-command/logging'
|
||||
import { findBeeVersion } from '../utils/config-sources'
|
||||
import { findBeeVersion, stripCommit } from '../utils/config-sources'
|
||||
|
||||
const DEFAULT_REPO = 'ethersphere'
|
||||
|
||||
@ -85,6 +85,8 @@ export class Start extends RootCommand implements LeafCommand {
|
||||
this.console.log(`Spinning up cluster with Bee version ${this.beeVersion}.`)
|
||||
}
|
||||
|
||||
this.beeVersion = stripCommit(this.beeVersion)
|
||||
|
||||
const dockerOptions = await this.buildDockerOptions()
|
||||
const docker = new Docker(this.console, this.envPrefix, this.imagePrefix, this.repo)
|
||||
const status = await docker.getAllStatus()
|
||||
|
||||
@ -1,6 +1,17 @@
|
||||
import { readFile } from 'fs/promises'
|
||||
import * as path from 'path'
|
||||
|
||||
const VERSION_REGEX = /^\d\.\d\.\d(-\w+)+$/
|
||||
|
||||
export function stripCommit(version: string): string {
|
||||
if (!VERSION_REGEX.test(version)) {
|
||||
throw new Error('The version does not have expected format!')
|
||||
}
|
||||
|
||||
// If the version contains commit ==> hash remove it
|
||||
return version.replace(/(-\w+)+$/g, '')
|
||||
}
|
||||
|
||||
async function searchPackageJson(): Promise<string | undefined> {
|
||||
const expectedPath = path.join(process.cwd(), 'package.json')
|
||||
const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' }))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user