Skip to content

Commit

Permalink
refactor(botonic-cli): use regex to get only cli version
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed Oct 1, 2024
1 parent 48f02e1 commit 2099368
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/botonic-cli/src/util/bot-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as util from 'util'

const BOTONIC_PREFIX_PACKAGE = '@botonic'
const BOTONIC_CORE_PACKAGE = `${BOTONIC_PREFIX_PACKAGE}/core`
const botonicCliVersionRegex = /@botonic\/cli\/([\d.]+-[\w.]+)/
const NPM_DEPTH_1 = 1
const NPM_DEPTH_0 = 0

Expand Down Expand Up @@ -34,13 +35,15 @@ export class BotConfig {
this.getOutputByCommand(command)

Check warning on line 35 in packages/botonic-cli/src/util/bot-config.ts

View check run for this annotation

Codecov / codecov/patch

packages/botonic-cli/src/util/bot-config.ts#L35

Added line #L35 was not covered by tests
)
)
const botonicCliVersion =
botonicCli.match(botonicCliVersionRegex)?.[1] || ''
spinner.succeed()

Check warning on line 40 in packages/botonic-cli/src/util/bot-config.ts

View check run for this annotation

Codecov / codecov/patch

packages/botonic-cli/src/util/bot-config.ts#L40

Added line #L40 was not covered by tests

return {

Check warning on line 42 in packages/botonic-cli/src/util/bot-config.ts

View check run for this annotation

Codecov / codecov/patch

packages/botonic-cli/src/util/bot-config.ts#L42

Added line #L42 was not covered by tests
build_info: {
node_version: nodeVersion,
npm_version: npmVersion,
botonic_cli_version: botonicCli,
botonic_cli_version: botonicCliVersion,
},
packages,
}
Expand Down

0 comments on commit 2099368

Please sign in to comment.