Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"dependencies": {
"@srcset/bundler-utils": "workspace:^",
"@srcset/core": "workspace:^",
"argue-cli": "^3.1.0",
"argue-cli": "^3.2.0",
"tinyglobby": "^0.2.10"
},
"devDependencies": {
Expand Down
16 changes: 16 additions & 0 deletions packages/cli/src/args.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ describe('cli', () => {
})
})

it('should keep a brace glob of the match option in one piece', () => {
setArgs('-m', '**/*.{jpg,png}')

expect(parseCliArgs().rule).toEqual({
match: ['**/*.{jpg,png}']
})
})

it('should collect the repeated match options', () => {
setArgs('-m', '**/*.jpg', '-m', '(min-width: 1000px)')

expect(parseCliArgs().rule).toEqual({
match: ['**/*.jpg', '(min-width: 1000px)']
})
})

it('should support camelCase twins and negation', () => {
setArgs('--skipOptimization', '--no-scalingUp')

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const usage = `srcset [...sources] [...options]
sources Source image(s) glob patterns.
--help, -h Print this message.
--verbose, -v Print processed images.
--match, -m Glob pattern(s) or media query(ies) to match images by name or size. Multiple values must all match.
--match, -m Glob pattern or media query to match images by name or size. Repeat to add more - all of them must match.
--width, -w Output image(s) widths to resize, value less than or equal to 1 is treated as a multiplier.
--format, -f Output image(s) formats to convert.
--skip-optimization Do not optimize output images.
Expand Down Expand Up @@ -60,7 +60,7 @@ export function parseCliArgs(): CliArgs {
} = readOptions(
flag(alias('help', 'h')),
flag(alias('verbose', 'v')),
option(alias('match', 'm'), Array),
option(alias('match', 'm'), [String]),
option(alias('width', 'w'), Array),
option(alias('format', 'f'), Array),
flag(autocase('skipOptimization')),
Expand Down
10 changes: 8 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ minimumReleaseAgeExclude:
- '@oxlint-tsgolint/win32-arm64@0.25.0'
- '@oxlint-tsgolint/win32-x64@0.25.0'
- oxlint-tsgolint@0.25.0
- argue-cli@3.2.0
packageExtensions:
'@sveltejs/package':
dependencies:
Expand Down