@@ -22,6 +22,23 @@ var shred = function(shredOptions) {
22
22
}
23
23
}
24
24
25
+ var shredSingleExampleDir = function ( shredOptions , fileDir ) {
26
+ shredOptions = resolveShredOptions ( shredOptions ) ;
27
+ var relativePath = path . relative ( shredOptions . examplesDir , fileDir ) ;
28
+ var examplesDir = path . join ( shredOptions . examplesDir , relativePath ) ;
29
+ var fragmentsDir = path . join ( shredOptions . fragmentsDir , relativePath ) ;
30
+ var options = {
31
+ includeSubdirs : true ,
32
+ examplesDir : examplesDir ,
33
+ fragmentsDir : fragmentsDir
34
+ }
35
+ var cleanPath = path . join ( fragmentsDir , '*.*' )
36
+ return del ( [ cleanPath , '!**/*.ovr.*' ] ) . then ( function ( paths ) {
37
+ // console.log('Deleted files/folders:\n', paths.join('\n'));
38
+ return shred ( options ) ;
39
+ } ) ;
40
+ }
41
+
25
42
var shredSingleDir = function ( shredOptions , filePath ) {
26
43
shredOptions = resolveShredOptions ( shredOptions ) ;
27
44
var fileDir = path . dirname ( filePath ) ;
@@ -72,6 +89,7 @@ var buildShredMap = function(shredMapOptions) {
72
89
73
90
module . exports = {
74
91
shred : shred ,
92
+ shredSingleExampleDir : shredSingleExampleDir ,
75
93
shredSingleDir : shredSingleDir ,
76
94
shredSingleJadeDir : shredSingleJadeDir ,
77
95
buildShredMap : buildShredMap
@@ -108,12 +126,15 @@ function createShredExamplePackage(shredOptions) {
108
126
// HACK ( next two lines) because the glob function that dgeni uses internally isn't good at removing 'node_modules' early
109
127
// this just uses globby to 'preglob' the include files ( and exclude the node_modules).
110
128
var nmPattern = '**/node_modules/**' ;
111
- var includeFiles = globby . sync ( includeFiles , { ignore : [ nmPattern ] } ) ;
129
+ var distPattern = '**/dist/**' ;
130
+ var includeFiles = globby . sync ( includeFiles , { ignore : [ nmPattern , distPattern ] } ) ;
131
+
132
+ console . log ( `Shredding ${ includeFiles . length } files inside ${ shredOptions . examplesDir } ` ) ;
112
133
113
134
readFilesProcessor . sourceFiles = [ {
114
135
// Process all candidate files in `src` and its subfolders ...
115
136
include : includeFiles ,
116
- exclude : [ '**/node_modules/**' , '**/typings/**' , '**/packages/**' , '**/build/**' ] ,
137
+ exclude : [ '**/node_modules/**' , '**/dist/**' , '**/ typings/**', '**/packages/**' , '**/build/**' ] ,
117
138
// When calculating the relative path to these files use this as the base path.
118
139
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
119
140
basePath : options . examplesDir
0 commit comments