File tree 3 files changed +85
-64
lines changed
3 files changed +85
-64
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
Original file line number Diff line number Diff line change @@ -76,10 +76,30 @@ function generateExampleJSON(){
76
76
77
77
}
78
78
79
+ // Computes the list of files for each example.
80
+ // Sorts files by:
81
+ // index.html > *.html > *.js > *.json > *
79
82
function listFilesForExample ( file ) {
80
83
var path = snapshotsPath + file ,
81
- files = fs . readdirSync ( path ) ;
82
- return _ . difference ( files , irrelevantFiles ) ;
84
+ allFiles = fs . readdirSync ( path ) ,
85
+ files = _ . difference ( allFiles , irrelevantFiles ) ;
86
+ return _ . sortBy ( files , filePrecedence ) ;
87
+ }
88
+
89
+ function filePrecedence ( name ) {
90
+ var ext = name . substr ( name . lastIndexOf ( '.' ) ) ;
91
+
92
+ if ( name === 'index.html' ) {
93
+ return 0 ;
94
+ } else if ( ext === '.html' ) {
95
+ return 1 ;
96
+ } else if ( ext === '.js' ) {
97
+ return 2 ;
98
+ } else if ( ext === '.json' ) {
99
+ return 3 ;
100
+ } else {
101
+ return 4 ;
102
+ }
83
103
}
84
104
85
105
function extractNumber ( name ) {
You can’t perform that action at this time.
0 commit comments