@@ -41,7 +41,9 @@ async function _compilePackagesWithNgc(pkg: string) {
41
41
: [ pkg , 'index' ] ;
42
42
43
43
const entryTypeDefinition = `export * from './${ exportPath } /${ moduleName } ';` ;
44
- const entryMetadata = `{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./${ pkg } /index"}]}` ;
44
+ const entryMetadata = `{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./${
45
+ pkg
46
+ } /index"}]}`;
45
47
46
48
await Promise . all ( [
47
49
util . writeFile ( `./dist/packages/${ pkg } .d.ts` , entryTypeDefinition ) ,
@@ -57,6 +59,9 @@ export async function bundleFesms(config: Config) {
57
59
const pkgs = util . getAllPackages ( config ) ;
58
60
59
61
await mapAsync ( pkgs , async pkg => {
62
+ if ( ! util . shouldBundle ( config , pkg ) ) {
63
+ return ;
64
+ }
60
65
const topLevelName = util . getTopLevelName ( pkg ) ;
61
66
62
67
await util . exec ( 'rollup' , [
@@ -79,6 +84,9 @@ export async function downLevelFesmsToES5(config: Config) {
79
84
const tscArgs = [ '--target es5' , '--module es2015' , '--noLib' , '--sourceMap' ] ;
80
85
81
86
await mapAsync ( packages , async pkg => {
87
+ if ( ! util . shouldBundle ( config , pkg ) ) {
88
+ return ;
89
+ }
82
90
const topLevelName = util . getTopLevelName ( pkg ) ;
83
91
84
92
const file = `./dist/${ topLevelName } /${ config . scope } /${ pkg } .js` ;
@@ -98,6 +106,9 @@ export async function downLevelFesmsToES5(config: Config) {
98
106
*/
99
107
export async function createUmdBundles ( config : Config ) {
100
108
await mapAsync ( util . getAllPackages ( config ) , async pkg => {
109
+ if ( ! util . shouldBundle ( config , pkg ) ) {
110
+ return ;
111
+ }
101
112
const topLevelName = util . getTopLevelName ( pkg ) ;
102
113
const destinationName = util . getDestinationName ( pkg ) ;
103
114
@@ -127,14 +138,21 @@ export async function cleanTypeScriptFiles(config: Config) {
127
138
* leaving the bundles and FESM in place
128
139
*/
129
140
export async function cleanJavaScriptFiles ( config : Config ) {
141
+ const packages = util
142
+ . getTopLevelPackages ( config )
143
+ . filter ( pkg => ! util . shouldBundle ( config , pkg ) ) ;
130
144
const jsFilesGlob = './dist/packages/**/*.js' ;
131
145
const jsExcludeFilesFlob = './dist/packages/(bundles|@ngrx)/**/*.js' ;
132
146
const filesToRemove = await util . getListOfFiles (
133
147
jsFilesGlob ,
134
148
jsExcludeFilesFlob
135
149
) ;
136
150
137
- await mapAsync ( filesToRemove , util . remove ) ;
151
+ const filteredFilesToRemove = filesToRemove . filter ( ( file : string ) =>
152
+ packages . some ( pkg => file . indexOf ( pkg ) === - 1 )
153
+ ) ;
154
+
155
+ await mapAsync ( filteredFilesToRemove , util . remove ) ;
138
156
}
139
157
140
158
/**
@@ -143,6 +161,9 @@ export async function cleanJavaScriptFiles(config: Config) {
143
161
*/
144
162
export async function renamePackageEntryFiles ( config : Config ) {
145
163
await mapAsync ( util . getAllPackages ( config ) , async pkg => {
164
+ if ( ! util . shouldBundle ( config , pkg ) ) {
165
+ return ;
166
+ }
146
167
const bottomLevelName = util . getBottomLevelName ( pkg ) ;
147
168
148
169
const files = await util . getListOfFiles ( `./dist/packages/${ pkg } /index.**` ) ;
@@ -192,6 +213,9 @@ export async function minifyUmdBundles(config: Config) {
192
213
const uglifyArgs = [ '-c' , '-m' , '--comments' ] ;
193
214
194
215
await mapAsync ( util . getAllPackages ( config ) , async pkg => {
216
+ if ( ! util . shouldBundle ( config , pkg ) ) {
217
+ return ;
218
+ }
195
219
const topLevelName = util . getTopLevelName ( pkg ) ;
196
220
const destinationName = util . getDestinationName ( pkg ) ;
197
221
const file = `./dist/${ topLevelName } /bundles/${ destinationName } .umd.js` ;
@@ -201,7 +225,9 @@ export async function minifyUmdBundles(config: Config) {
201
225
file ,
202
226
...uglifyArgs ,
203
227
`-o ${ out } ` ,
204
- `--source-map "filename='${ out } .map' includeSources='${ file } ', content='${ file } .map'"` ,
228
+ `--source-map "filename='${ out } .map' includeSources='${ file } ', content='${
229
+ file
230
+ } .map'"`,
205
231
] ) ;
206
232
} ) ;
207
233
}
@@ -288,3 +314,28 @@ export function mapAsync<T>(
288
314
) {
289
315
return Promise . all ( list . map ( mapFn ) ) ;
290
316
}
317
+
318
+ /**
319
+ * Copy schematics files
320
+ */
321
+ export async function copySchematicFiles ( config : Config ) {
322
+ const packages = util
323
+ . getTopLevelPackages ( config )
324
+ . filter ( pkg => ! util . shouldBundle ( config , pkg ) ) ;
325
+
326
+ const collectionFiles = await util . getListOfFiles (
327
+ `./modules/?(${ packages . join ( '|' ) } )/collection.json`
328
+ ) ;
329
+ const schemaFiles = await util . getListOfFiles (
330
+ `./modules/?(${ packages . join ( '|' ) } )/src/*/schema.*`
331
+ ) ;
332
+ const templateFiles = await util . getListOfFiles (
333
+ `./modules/?(${ packages . join ( '|' ) } )/src/*/files/*`
334
+ ) ;
335
+ const files = [ ...collectionFiles , ...schemaFiles , ...templateFiles ] ;
336
+
337
+ await mapAsync ( files , async file => {
338
+ const target = file . replace ( 'modules/' , 'dist/' ) ;
339
+ await util . copy ( file , target ) ;
340
+ } ) ;
341
+ }
0 commit comments