Add support for crop_aspect_ratio option#53
Merged
Conversation
c791342 to
2dc2d32
Compare
There was a problem hiding this comment.
Pull Request Overview
Adds support for the crop_aspect_ratio option to allow specifying a fixed aspect ratio for crop areas.
- Defines new types and interfaces for
CropAspectRatioand its aliases (crop_ar,car) - Implements
testandbuildfunctions with validation and URL segment generation - Updates utility (
normalizeBoolean) to accept0and other boolean variants
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/optionsBasic/cropAspectRatio.test.ts | Adds tests covering detection, error conditions, and builds |
| src/utils.ts | Extends normalizeBoolean signature to accept 0 |
| src/types/index.ts | Imports new CropAspectRatioOptionsPartial into Options |
| src/types/cropAspectRatio.ts | Defines CropAspectRatio and partial options interface |
| src/options/index.ts | Exports new cropAspectRatio module |
| src/options/cropAspectRatio.ts | Implements option handling (test, build) |
Comments suppressed due to low confidence (4)
src/utils.ts:1
- Consider adding a test case to verify that passing
enlarge: 0correctly serializes to"f", since0is now an accepted input.
export const normalizeBoolean = (value: 1 | 0 | string | boolean): string => {
tests/optionsBasic/cropAspectRatio.test.ts:94
- Add a test for
enlarge: 0to ensurebuild({ crop_aspect_ratio: { aspect_ratio: X, enlarge: 0 } })yields the expected":f"suffix.
});
src/options/cropAspectRatio.ts:18
- The error always references
crop_aspect_ratioeven if the user passedcrop_arorcar. Consider capturing the actual key name for clearer error messages.
guardIsUndef(cropArOpts, "crop_aspect_ratio");
src/utils.ts:20
- The generated error message uses "less then" which is grammatically incorrect. Update to "less than" in the
getMinNumTextimplementation.
);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49