@@ -173,7 +173,7 @@ function _exec(command: string, args: string[], opts: { cwd?: string }, logger:
173173
174174function _build ( logger : logging . Logger ) {
175175 logger . info ( 'Building...' ) ;
176- _exec ( 'node' , [ require . resolve ( 'typescript/bin/tsc' ) , '-p' , 'tsconfig.json' ] , { } , logger ) ;
176+ _exec ( 'node' , [ require . resolve ( 'typescript/bin/tsc' ) , '-p' , 'tsconfig-build .json' ] , { } , logger ) ;
177177}
178178
179179export default async function (
@@ -214,70 +214,74 @@ export default async function (
214214 resourceLogger . info ( packageName ) ;
215215 const pkg = packages [ packageName ] ;
216216 const pkgJson = pkg . packageJson ;
217- const files = glob . sync ( path . join ( pkg . root , '**/*' ) , { dot : true , nodir : true } ) ;
217+ const files = glob . sync ( '**/*' , {
218+ cwd : pkg . root ,
219+ dot : true ,
220+ nodir : true ,
221+ ignore : [ 'test/**/*' , '**/tests/*' , 'src/testing/*' ] ,
222+ } ) ;
218223 const subSubLogger = resourceLogger . createChild ( packageName ) ;
219224 subSubLogger . info ( `${ files . length } files total...` ) ;
220- const resources = files
221- . map ( ( fileName ) => path . relative ( pkg . root , fileName ) )
222- . filter ( ( fileName ) => {
223- if ( / (?: ^ | [ \/ \\ ] ) n o d e _ m o d u l e s [ \/ \\ ] / . test ( fileName ) ) {
224- return false ;
225- }
225+ const resources = files . filter ( ( fileName ) => {
226+ if ( / (?: ^ | [ \/ \\ ] ) n o d e _ m o d u l e s [ \/ \\ ] / . test ( fileName ) ) {
227+ return false ;
228+ }
226229
227- // Schematics template files.
228- if (
229- pkgJson [ 'schematics' ] &&
230- ( fileName . match ( / ( \/ | \\ ) f i l e s ( \/ | \\ ) / ) || fileName . match ( / ( \/ | \\ ) \w + - f i l e s ( \/ | \\ ) / ) )
231- ) {
232- return true ;
233- }
230+ // Schematics template files.
231+ if (
232+ pkgJson [ 'schematics' ] &&
233+ ( fileName . match ( / ( \/ | \\ ) f i l e s ( \/ | \\ ) / ) || fileName . match ( / ( \/ | \\ ) \w + - f i l e s ( \/ | \\ ) / ) )
234+ ) {
235+ return true ;
236+ }
234237
235- if ( fileName . endsWith ( 'package.json' ) ) {
236- return true ;
237- }
238+ // Skip test files
239+ if ( fileName . endsWith ( '_spec.ts' ) ) {
240+ return false ;
241+ }
238242
239- // Ignore in package test files.
240- if ( fileName . startsWith ( 'test/' ) || fileName . startsWith ( 'test\\' ) ) {
241- return false ;
242- }
243- if ( pkg . name === '@angular-devkit/core' && fileName . startsWith ( 'src/workspace/json/test' ) ) {
244- return false ;
245- }
243+ if ( fileName . endsWith ( 'package.json' ) ) {
244+ return true ;
245+ }
246246
247- // This schema is built and copied later on as schema.json.
248- if ( pkg . name === '@angular/cli' && fileName . endsWith ( 'workspace-schema.json' ) ) {
249- return false ;
250- }
247+ if ( pkg . name === '@angular-devkit/core' && fileName . startsWith ( 'src/workspace/json/test' ) ) {
248+ return false ;
249+ }
251250
252- // Remove Bazel files from NPM .
253- if ( fileName === 'BUILD' || fileName === 'BUILD.bazel' ) {
254- return false ;
255- }
251+ // This schema is built and copied later on as schema.json .
252+ if ( pkg . name === '@angular/cli' && fileName . endsWith ( 'workspace-schema.json' ) ) {
253+ return false ;
254+ }
256255
257- // Skip sources.
258- if ( fileName . endsWith ( '.ts' ) && ! fileName . endsWith ( '.d.ts' ) ) {
259- // Verify that it was actually built.
260- if ( ! fs . existsSync ( path . join ( pkg . dist , fileName ) . replace ( / t s $ / , 'js' ) ) ) {
261- subSubLogger . error ( `\nSource found but compiled file not found: "${ fileName } ".` ) ;
262- process . exit ( 2 ) ;
263- }
256+ // Remove Bazel files from NPM.
257+ if ( fileName === 'BUILD' || fileName === 'BUILD.bazel' ) {
258+ return false ;
259+ }
264260
265- // Skip all sources.
266- return false ;
261+ // Skip sources.
262+ if ( fileName . endsWith ( '.ts' ) && ! fileName . endsWith ( '.d.ts' ) ) {
263+ // Verify that it was actually built.
264+ if ( ! fs . existsSync ( path . join ( pkg . dist , fileName ) . replace ( / t s $ / , 'js' ) ) ) {
265+ subSubLogger . error ( `\nSource found but compiled file not found: "${ fileName } ".` ) ;
266+ process . exit ( 2 ) ;
267267 }
268268
269- // Skip tsconfig only.
270- if ( fileName . endsWith ( 'tsconfig.json' ) ) {
271- return false ;
272- }
269+ // Skip all sources.
270+ return false ;
271+ }
273272
274- // Skip files from gitignore .
275- if ( _gitIgnoreMatch ( fileName ) ) {
276- return false ;
277- }
273+ // Skip tsconfig only .
274+ if ( fileName . endsWith ( 'tsconfig.json' ) ) {
275+ return false ;
276+ }
278277
279- return true ;
280- } ) ;
278+ // Skip files from gitignore.
279+ if ( _gitIgnoreMatch ( fileName ) ) {
280+ return false ;
281+ }
282+
283+ return true ;
284+ } ) ;
281285
282286 subSubLogger . info ( `${ resources . length } resources...` ) ;
283287 resources . forEach ( ( fileName ) => {
0 commit comments