Skip to content

Commit a66d0a8

Browse files
committed
Made pseudopattern_hunter a bit less hardcoded
added unit test for pseudopattern generation fixed a bug where pseudopatterns were being added to the UI twice explicitly sorted patterns before UI build setting version to v0.16.0
1 parent 277fdff commit a66d0a8

19 files changed

+147
-31
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public/index.html
44
public/styleguide.html
55
public/styleguide/html/styleguide.html
66
public/css/*
7+
public/data/*
78
public/fonts/*
89
public/js/*
910
public/images/*

CHANGELOG

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
22

3-
PL-node-v0.15.2
3+
PL-node-v0.16.0
44
- FIX: Resolve issue with not hiding underscored patterns.
55
- THX: Thanks @ivancamilov for reporting this regression.
66
- FIX: Fix misapplied error input class
77
- THX: Thanks @johngerome for the pull request!
88
- ADD: Added a note in the README during installation to run with elevated privileges
99
- THX: Thanks @RichardBray for the heads up
1010
- ADD: Added a Prerequisites section to the README
11+
- ADD: Added unit tests for pattern states and pseudopatterns
12+
- CHG: Changed pseudopattern generation to use config.patterns.source directory instead of hardcode
13+
- CHG: Explicitly sorting patterns by name prior to building the UI
1114

1215
PL-node-v0.15.1
1316
- FIX: Resolve issue with styleModifiers not being replaced when the partial has spaces in it.

builder/lineage_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/list_item_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/media_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/object_factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/parameter_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/pattern_assembler.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -46,7 +46,7 @@
4646
}
4747

4848
function setState(pattern, patternlab){
49-
if(patternlab.config.patternStates[pattern.patternName]){
49+
if(patternlab.config.patternStates && patternlab.config.patternStates[pattern.patternName]){
5050
pattern.patternState = patternlab.config.patternStates[pattern.patternName];
5151
} else{
5252
pattern.patternState = "";
@@ -102,13 +102,9 @@
102102
//make a new Pattern Object
103103
var currentPattern = new of.oPattern(file, subdir, filename);
104104

105-
//if file is named in the syntax for variants
105+
//if file is named in the syntax for variants, no need to process further
106+
//processPatternRecursive() will run find_pseudopatterns() and look at each pattern for a variant
106107
if(ext === '.json' && filename.indexOf('~') > -1){
107-
//add current pattern to patternlab object with minimal data
108-
//processPatternRecursive() will run find_pseudopatterns() to fill out
109-
//the object in the next diveSync
110-
addPattern(currentPattern, patternlab);
111-
//no need to process further
112108
return;
113109
}
114110

builder/pattern_exporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/patternlab.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.2 - 2015
2+
* patternlab-node - v0.16.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -211,6 +211,18 @@ var patternlab_engine = function () {
211211
//build the patternlab website
212212
var patternlabSiteTemplate = fs.readFileSync('./source/_patternlab-files/index.mustache', 'utf8');
213213

214+
//sort all patterns explicitly.
215+
patternlab.patterns = patternlab.patterns.sort(function(a,b){
216+
if (a.name > b.name) {
217+
return 1;
218+
}
219+
if (a.name < b.name) {
220+
return -1;
221+
}
222+
// a must be equal to b
223+
return 0;
224+
});
225+
214226
//loop through all patterns.to build the navigation
215227
//todo: refactor this someday
216228
for(var i = 0; i < patternlab.patterns.length; i++){

0 commit comments

Comments
 (0)