Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit 87fb18f

Browse files
committed
fix(config): config height/width parsing and preset merging
The width/height properties are now correctly expected to be numbers (and not strings), are no longer required (to ignore that dimension) and new presets now overwrite the default ones, instead of appending to the array. fix #7
1 parent 2a7e3c5 commit 87fb18f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1313

1414
- Updated dependencies
1515

16+
### Fixed
17+
18+
- Width/height preset properties now (correctly) accept numbers
19+
- When merging configs, default presets are now overwritten
20+
1621
## [3.1.1] - 2019-06-06
1722

1823
### Changed

src/Config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,16 @@ const configSchema = {
292292
type: "array",
293293
items: {
294294
type: "object",
295-
required: ["name", "width", "height"],
295+
required: ["name"],
296296
properties: {
297297
name: {
298298
type: "string"
299299
},
300300
width: {
301-
type: "string"
301+
type: "number"
302302
},
303303
height: {
304-
type: "string"
304+
type: "number"
305305
},
306306
force: {
307307
type: "boolean"
@@ -433,5 +433,5 @@ export function parseConfig(receivedConfig: Partial<IConfig>): IConfig {
433433
}
434434

435435
// Merge the config with the default
436-
return merge(defaultConfig, config);
436+
return merge(defaultConfig, config, { arrayMerge: (target, source) => source });
437437
}

0 commit comments

Comments
 (0)