Skip to content

Commit

Permalink
feat: 增加指令
Browse files Browse the repository at this point in the history
  • Loading branch information
TickHeart committed Jan 15, 2023
1 parent 848bbd1 commit 7da08e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/pit.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
import '../dist/pit.mjs'
1 change: 1 addition & 0 deletions src/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const options = {
pb: [['pnpm run build {0}', 'yarn run build {0}', 'npm run build {0}'], '执行 `build` 指令'],
px: [['pnpx {0}', 'npx {0}', 'npx {0}'], '执行 npx'],
psf: [['pnpm start --filter {0}'], '执行 monorepo子项目'],
pit: [['pnpm install --registry=http://registry.npmmirror.com {0}', 'yarn install --registry=http://registry.npmmirror.com {0}', 'npm install --registry=http://registry.npmmirror.com {0}'], '执行 `install` 指令携带单次镜像源 flag'],
} as Record<string, [string[], string]>

type ValueType = Record<keyof typeof options, string>
Expand Down
8 changes: 8 additions & 0 deletions src/commands/pit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { AGENTS } from '../agents'
import { run } from '../runner'

run((cmd, args) => {
const argStr = args!.join(' ')
const ms = AGENTS[cmd]
return ms.pit.replace('{0}', argStr)
})

0 comments on commit 7da08e5

Please sign in to comment.