Skip to content

Commit a26279d

Browse files
authored
Merge branch 'dev' into feature/fix-partial-build
2 parents 8a2a9d6 + 055856d commit a26279d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+384
-118
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If you'd like to contribute to Pattern Lab Node, please do so! There is always a lot of ground to cover and something for your wheelhouse.
44

5-
No pull request is too small. Check out any [help wanted 🆘](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted+%3Asos%3A%22) or [good first issues 🎓](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue+%3Amortar_board%3A%22)as a good way to get your feet wet, or add some more unit tests.
5+
No pull request is too small. Check out any [help wanted 🆘](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted+%3Asos%3A%22) or [good first issues 🎓](https://github.com/pattern-lab/patternlab-node/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue+%3Amortar_board%3A%22) as a good way to get your feet wet, or add some more unit tests.
66

77
## Prerequisites
88

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [5.10.2](https://github.com/pattern-lab/patternlab-node/compare/v5.10.1...v5.10.2) (2020-05-24)
7+
8+
9+
### Bug Fixes
10+
11+
* update link to new PL docs homepage ([831b467](https://github.com/pattern-lab/patternlab-node/commit/831b467c57b9259c32ce3d3ddf366fe1867a48a9))
12+
13+
14+
15+
16+
617
## [5.10.1](https://github.com/pattern-lab/patternlab-node/compare/v5.10.0...v5.10.1) (2020-05-09)
718

819
**Note:** Version bump only for package pl-node

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"lerna": "3.11.0",
3-
"version": "5.10.1",
3+
"version": "5.10.2",
44
"packages": [
55
"packages/*"
66
],

packages/cli/test/fixtures/patternlab-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"patternStateCascade": ["inprogress", "inreview", "complete"],
7373
"patternExportDirectory": "./pattern_exports/",
7474
"patternExportPatternPartials": [],
75+
"patternMergeVariantArrays": true,
7576
"serverOptions": {
7677
"wait": 1000
7778
},

packages/core/.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test
2+
.nyc_output

packages/core/docs/events.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Emitted after global `data.json` and `listitems.json` are read, and the supporti
7777
Emitted before all data is merged prior to a Pattern's render. Global `data.json` is merged with any pattern `.json`. Global `listitems.json` is merged with any pattern `.listitems.json`.
7878

7979
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
80-
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16)
80+
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16)
8181
**Properties**
8282

8383
| Name | Type | Description |
@@ -92,7 +92,7 @@ Emitted before all data is merged prior to a Pattern's render. Global `data.json
9292
Emitted before a pattern's template, HTML, and encoded HTML files are written to their output location
9393

9494
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
95-
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16)
95+
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16)
9696
**Properties**
9797

9898
| Name | Type | Description |
@@ -107,7 +107,7 @@ Emitted before a pattern's template, HTML, and encoded HTML files are written to
107107
Emitted after a pattern's template, HTML, and encoded HTML files are written to their output location
108108

109109
**Kind**: inner property of [<code>EVENTS</code>](#exp_module_Events--EVENTS)
110-
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16)
110+
**See**: [Pattern](https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16)
111111
**Properties**
112112

113113
| Name | Type | Description |

packages/core/patternlab-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"patternExportPatternPartials": [],
7676
"patternExportPreserveDirectoryStructure": true,
7777
"patternExportRaw": false,
78+
"patternMergeVariantArrays": true,
7879
"serverOptions": {
7980
"wait": 1000
8081
},

packages/core/src/lib/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ const EVENTS = Object.freeze({
3939
* @desc Emitted before all data is merged prior to a Pattern's render. Global `data.json` is merged with any pattern `.json`. Global `listitems.json` is merged with any pattern `.listitems.json`.
4040
* @property {object} patternlab - global data store
4141
* @property {Pattern} pattern - current pattern
42-
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16|Pattern}
42+
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16|Pattern}
4343
*/
4444
PATTERNLAB_PATTERN_BEFORE_DATA_MERGE: 'patternlab-pattern-before-data-merge',
4545

4646
/**
4747
* @desc Emitted before a pattern's template, HTML, and encoded HTML files are written to their output location
4848
* @property {object} patternlab - global data store
4949
* @property {Pattern} pattern - current pattern
50-
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16|Pattern}
50+
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16|Pattern}
5151
*/
5252
PATTERNLAB_PATTERN_WRITE_BEGIN: 'patternlab-pattern-write-begin',
5353

5454
/**
5555
* @desc Emitted after a pattern's template, HTML, and encoded HTML files are written to their output location
5656
* @property {object} patternlab - global data store
5757
* @property {Pattern} pattern - current pattern
58-
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/src/lib/object_factory.js#L16|Pattern}
58+
* @see {@link https://github.com/pattern-lab/patternlab-node/blob/master/packages/core/src/lib/object_factory.js#L16|Pattern}
5959
*/
6060
PATTERNLAB_PATTERN_WRITE_END: 'patternlab-pattern-write-end',
6161

packages/core/src/lib/pseudopattern_hunter.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,24 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function(
6060
}
6161

6262
//extend any existing data with variant data
63-
variantFileData = _.merge(
63+
variantFileData = _.mergeWith(
6464
{},
6565
currentPattern.jsonFileData,
66-
variantFileData
66+
variantFileData,
67+
(objValue, srcValue) => {
68+
if (
69+
_.isArray(objValue) &&
70+
// If the parameter is not available after updating pattern lab but
71+
// not the patternlab-config it should not override arrays.
72+
patternlab.config.hasOwnProperty('patternMergeVariantArrays') &&
73+
!patternlab.config.patternMergeVariantArrays
74+
) {
75+
return srcValue;
76+
}
77+
// Lodash will only check for "undefined" and eslint needs a consistent
78+
// return so do not remove
79+
return undefined;
80+
}
6781
);
6882

6983
const variantName = pseudoPatterns[i]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"a": 1,
3+
"b": [2, 3],
4+
"c": {
5+
"d": [4, 5],
6+
"e": 8,
7+
"f": {"a": ["a"], "b": ["b"], "c": ["c"]}
8+
}
9+
}

0 commit comments

Comments
 (0)