Skip to content

Commit

Permalink
chore: support the filter script name for building monkey script
Browse files Browse the repository at this point in the history
  • Loading branch information
Arylo committed Oct 28, 2024
1 parent 8f76ec1 commit f428faa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion etc/build/monkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { buildScript, exportLatestDeployInfo, isFile, stringifyBanner, parseFile
const srcPath = path.resolve(ROOT_PATH, 'src/monkey')
const outPath = path.resolve(ROOT_PATH, 'dist/monkey')

const matchValueIndex = process.argv.findIndex((v) => ['--match', '-m'].includes(v))
let matchValue!: string
if (matchValueIndex > 0) {
matchValue = process.argv[matchValueIndex + 1]
}

;(async () => {
const filepaths = fs.readdirSync(srcPath)
.map((filename) => path.resolve(srcPath, filename))
Expand All @@ -21,8 +27,9 @@ const outPath = path.resolve(ROOT_PATH, 'dist/monkey')
raw,
meta,
user,
deployJson
deployJson,
} = parseFilenames(filepath)
if (matchValue && !raw.includes(matchValue)) continue
await loggerInject(raw, async () => {
const sourcePath = path.resolve(filepath, parseFilenames(filepath).name)
const targetPath = path.resolve(outPath, user)
Expand Down

0 comments on commit f428faa

Please sign in to comment.