diff options
author | 2024-08-14 18:05:50 +0800 | |
---|---|---|
committer | 2024-08-14 11:05:50 +0100 | |
commit | 849e4c6c23e61f7fa59f583419048b998bef2475 (patch) | |
tree | d656071362f3d38704cee20fab58d856182873a9 /scripts/cmd/copy.js | |
parent | a23c69d0d0bed229bee52a32e61f135f9ebf9122 (diff) | |
download | astro-849e4c6c23e61f7fa59f583419048b998bef2475.tar.gz astro-849e4c6c23e61f7fa59f583419048b998bef2475.tar.zst astro-849e4c6c23e61f7fa59f583419048b998bef2475.zip |
Use node parseArgs instead of yargs-parser and arg (#11645)
* wip
* done
* Add changeset
* Format
* Update
* Fix houston
* Fix test
* Fix test
Diffstat (limited to 'scripts/cmd/copy.js')
-rw-r--r-- | scripts/cmd/copy.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/cmd/copy.js b/scripts/cmd/copy.js index 943c998df..948ed114f 100644 --- a/scripts/cmd/copy.js +++ b/scripts/cmd/copy.js @@ -1,19 +1,20 @@ -import arg from 'arg'; import { globby as glob } from 'globby'; import { promises as fs, readFileSync } from 'node:fs'; import { posix } from 'node:path'; +import { parseArgs } from 'node:util'; import * as tar from 'tar/create'; const { resolve, dirname, sep, join } = posix; -/** @type {import('arg').Spec} */ -const spec = { - '--tgz': Boolean, -}; - export default async function copy() { - let { _: patterns, ['--tgz']: isCompress } = arg(spec); - patterns = patterns.slice(1); + const args = parseArgs({ + allowPositionals: true, + options: { + tgz: { type: 'boolean' }, + }, + }); + const patterns = args.positionals.slice(1); + const isCompress = args.values.tgz; if (isCompress) { const files = await glob(patterns, { gitignore: true }); |