File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ class Channel implements Channel {
9494 // setup tutorial config (save watcher, test runner, etc)
9595 await this . context . setTutorial ( this . workspaceState , data )
9696
97+ // validate dependencies
98+
9799 const error : E . ErrorMessage | void = await tutorialConfig ( { config : data . config } ) . catch ( ( error : Error ) => ( {
98100 type : 'UnknownError' ,
99101 message : `Location: tutorial config.\n\n${ error . message } ` ,
Original file line number Diff line number Diff line change 1+ import node from '../node'
2+
3+ 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+
5+ export const getVersion = async ( name : string ) : Promise < string | null > => {
6+ const { stdout, stderr } = await node . exec ( `${ name } --version` )
7+ if ( ! stderr ) {
8+ const match = stdout . match ( semverRegex )
9+ if ( match ) {
10+ return match [ 0 ]
11+ }
12+ }
13+ return null
14+ }
You can’t perform that action at this time.
0 commit comments