1
- import { updateTsConfig } from '../../utils/project ' ;
2
- import { writeMultipleFiles , appendToFile , createDir , replaceInFile } from '../../utils/fs' ;
3
- import { ng } from '../../utils/process' ;
4
- import { stripIndents } from 'common-tags ' ;
1
+ import { stripIndents } from 'common-tags ' ;
2
+ import { appendToFile , createDir , replaceInFile , rimraf , writeMultipleFiles } from '../../utils/fs' ;
3
+ import { ng } from '../../utils/process' ;
4
+ import { updateTsConfig } from '../../utils/project ' ;
5
5
6
-
7
- export default function ( ) {
8
- // TODO(architect): Delete this test. It is now in devkit/build-angular.
9
-
10
- return updateTsConfig ( json => {
6
+ export default async function ( ) {
7
+ await updateTsConfig ( json => {
11
8
json [ 'compilerOptions' ] [ 'baseUrl' ] = './src' ;
12
9
json [ 'compilerOptions' ] [ 'paths' ] = {
13
10
'@shared' : [
14
- 'app/shared'
11
+ 'app/shared' ,
15
12
] ,
16
13
'@shared/*' : [
17
- 'app/shared/*'
14
+ 'app/shared/*' ,
18
15
] ,
19
16
'@root/*' : [
20
- './*'
21
- ]
17
+ './*' ,
18
+ ] ,
22
19
} ;
23
- } )
24
- . then ( ( ) => createDir ( 'src/app/shared' ) )
25
- . then ( ( ) => writeMultipleFiles ( {
20
+ } ) ;
21
+
22
+ await createDir ( 'src/app/shared' ) ;
23
+ await writeMultipleFiles ( {
26
24
'src/meaning-too.ts' : 'export var meaning = 42;' ,
27
25
'src/app/shared/meaning.ts' : 'export var meaning = 42;' ,
28
26
'src/app/shared/index.ts' : `export * from './meaning'` ,
29
- } ) )
30
- . then ( ( ) => replaceInFile ( 'src/app/app.module.ts' , './app.component' , '@root/app/app.component' ) )
31
- . then ( ( ) => ng ( 'build' ) )
32
- . then ( ( ) => updateTsConfig ( json => {
27
+ } ) ;
28
+
29
+ await replaceInFile ( 'src/app/app.module.ts' , './app.component' , '@root/app/app.component' ) ;
30
+ await ng ( 'build' ) ;
31
+
32
+ await updateTsConfig ( json => {
33
33
json [ 'compilerOptions' ] [ 'paths' ] [ '*' ] = [
34
34
'*' ,
35
- 'app/shared/*'
35
+ 'app/shared/*' ,
36
36
] ;
37
- } ) )
38
- . then ( ( ) => appendToFile ( 'src/app/app.component.ts' , stripIndents `
37
+ } ) ;
38
+
39
+ await appendToFile ( 'src/app/app.component.ts' , stripIndents `
39
40
import { meaning } from 'app/shared/meaning';
40
41
import { meaning as meaning2 } from '@shared';
41
42
import { meaning as meaning3 } from '@shared/meaning';
@@ -49,6 +50,11 @@ export default function() {
49
50
console.log(meaning3)
50
51
console.log(meaning4)
51
52
console.log(meaning5)
52
- ` ) )
53
- . then ( ( ) => ng ( 'build' ) ) ;
53
+ ` ) ;
54
+
55
+ await ng ( 'build' ) ;
56
+
57
+ // Simulate no package.json file which causes Webpack to have an undefined 'descriptionFileData'.
58
+ await rimraf ( 'package.json' ) ;
59
+ await ng ( 'build' ) ;
54
60
}
0 commit comments