-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: installed as the system command and supports hooks
- Loading branch information
blurooochen
committed
May 18, 2020
1 parent
bf3a34a
commit f0970b2
Showing
9 changed files
with
327 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os from 'os'; | ||
|
||
const platformMap = { | ||
aix: 'linux', | ||
freebsd: 'linux', | ||
linux: 'linux', | ||
openbsd: 'linux', | ||
sunos: 'linux', | ||
win32: 'windows', | ||
darwin: 'macos', | ||
}; | ||
|
||
const platform = os.platform(); | ||
const platformType = platformMap[platform]; | ||
|
||
function toArray(v: any, field: string, defaultV?: string[]): string[] { | ||
if (v && !Array.isArray(v)) { | ||
if (typeof v === 'string') { | ||
return [v]; | ||
} | ||
throw `field ${field} must provide either a string or an array of strings`; | ||
} | ||
return v || defaultV || []; | ||
} | ||
|
||
export { | ||
platform, | ||
platformType, | ||
toArray, | ||
}; |
Oops, something went wrong.