Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5513a1d

Browse files
committed
create getVersion fn
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentc4d2e35 commit5513a1d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎src/channel/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class Channel implements Channel {
9494
// setup tutorial config (save watcher, test runner, etc)
9595
awaitthis.context.setTutorial(this.workspaceState,data)
9696

97+
// validate dependencies
98+
9799
consterror:E.ErrorMessage|void=awaittutorialConfig({config:data.config}).catch((error:Error)=>({
98100
type:'UnknownError',
99101
message:`Location: tutorial config.\n\n${error.message}`,

‎src/services/dependencies/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
importnodefrom'../node'
2+
3+
constsemverRegex=/(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/gi
4+
5+
exportconstgetVersion=async(name:string):Promise<string|null>=>{
6+
const{ stdout, stderr}=awaitnode.exec(`${name} --version`)
7+
if(!stderr){
8+
constmatch=stdout.match(semverRegex)
9+
if(match){
10+
returnmatch[0]
11+
}
12+
}
13+
returnnull
14+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp