File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/services/dependencies Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11import { satisfies } from 'semver'
22import { exec } from '../node'
33
4- const semverRegex = / (?< = ^ v ? | \s v ? ) (?: 0 | [ 1 - 9 ] \d * ) \. (?: 0 | [ 1 - 9 ] \d * ) \. (?: 0 | [ 1 - 9 ] \d * ) (?: - (?: 0 | [ 1 - 9 ] \d * | [ \d a - z - ] * [ a - z - ] [ \d a - z - ] * ) (?: \. (?: 0 | [ 1 - 9 ] \d * | [ \d a - z - ] * [ a - z - ] [ \d a - z - ] * ) ) * ) ? (?: \+ [ \d a - z - ] + (?: \. [ \d a - z - ] + ) * ) ? (? = $ | \s ) / gi
4+ const semverRegex = / (?< = ^ v ? | \s v ? ) (?: 0 | [ 1 - 9 ] \d * ) \. (?: 0 | [ 1 - 9 ] \d * ) \. (?: 0 | [ 1 - 9 ] \d * ) (?: - (?: 0 | [ 1 - 9 ] \d * | [ \d a - z - ] * [ a - z - ] [ \d a - z - ] * ) (?: \. (?: 0 | [ 1 - 9 ] \d * | [ \d a - z - ] * [ a - z - ] [ \d a - z - ] * ) ) * ) ? (?: \+ [ \d a - z - ] + (?: \. [ \d a - z - ] + ) * ) ? ( \. w i n d o w s . [ 0 - 9 ] + ) ? ( ?= $ | \s ) / gi
55
66export const version = async ( name : string ) : Promise < string | null > => {
77 try {
88 const { stdout, stderr } = await exec ( `${ name } --version` )
99 if ( ! stderr ) {
1010 const match = stdout . match ( semverRegex )
1111 if ( match ) {
12- return match [ 0 ]
12+ const parsedVersion = match [ 0 ] . split ( '.' ) . slice ( 0 , 3 ) . join ( '.' )
13+ return parsedVersion
1314 }
1415 }
1516 return null
You can’t perform that action at this time.
0 commit comments