MCPcopy Index your code
hub / github.com/JohnnyMorganz/stylua-action / getAssetFilenamePatternForPlatform

Function getAssetFilenamePatternForPlatform

src/stylua.ts:41–76  ·  view source on GitHub ↗
(
  platform: NodeJS.Platform,
  machine: string
)

Source from the content-addressed store, hash-verified

39export type Matcher = (name: string) => boolean
40
41export const getAssetFilenamePatternForPlatform = (
42 platform: NodeJS.Platform,
43 machine: string
44): RegExp => {
45 let platformPattern
46
47 switch (platform) {
48 case 'win32':
49 platformPattern = '(windows|win64)'
50 break
51 case 'linux':
52 platformPattern = 'linux'
53 break
54 case 'darwin':
55 platformPattern = 'macos'
56 break
57 default:
58 throw new Error('platform not supported')
59 }
60
61 let archPattern
62 switch (machine) {
63 case 'arm64':
64 archPattern = 'aarch64'
65 break
66 case 'x64':
67 archPattern = 'x86_64'
68 break
69 default:
70 archPattern = ''
71 }
72
73 return new RegExp(
74 `stylua(-[\\dw\\-\\.]+)?-${platformPattern}(-${archPattern})?.zip`
75 )
76}
77
78export const getFilenameMatcher = (
79 platform: NodeJS.Platform,

Callers 1

getFilenameMatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected