@@ -39,29 +39,7 @@ parentDirs.forEach(curParentDir => {
39
39
dirs . push ( ...curDirs . map ( curDir => join ( curParentDir , curDir ) ) ) ;
40
40
} )
41
41
42
- // TODO(mattsoulanille): Packages are not sorted based on dependencies. There
43
- // are a few ways to fix this:
44
- // 1. Use only npm versions of packages, so they don't depend on each other.
45
- // 2. Parse package.json and implement topological sort here.
46
- // 3. Use something like Lerna or TurboRepo.
47
- // The current approach is just to enforce order in a subset of the packages.
48
- // It's not a scalabe approach.
49
- const dependenciesInOrder = new Set ( [
50
- 'tfjs-tflite-node' , 'coral-tflite-delegate' ] ) ;
51
- const dirsSet = new Set ( dirs ) ;
52
- for ( const dep of dependenciesInOrder ) {
53
- if ( ! dirsSet . has ( dep ) ) {
54
- throw new Error ( `Directory missing for manually added dependency ${ dep } ` ) ;
55
- }
56
- }
57
- for ( const dir of dirsSet ) {
58
- if ( dependenciesInOrder . has ( dir ) ) {
59
- dirsSet . delete ( dir ) ;
60
- }
61
- }
62
- const sortedDirs = [ ...dirsSet , ...dependenciesInOrder ] ;
63
-
64
- sortedDirs . forEach ( dir => {
42
+ dirs . forEach ( dir => {
65
43
shell . cd ( dir ) ;
66
44
67
45
if ( ! fs . existsSync ( './package.json' ) ) {
@@ -71,21 +49,27 @@ sortedDirs.forEach(dir => {
71
49
72
50
const packageJSON : { 'scripts' : { [ key : string ] : string } } =
73
51
JSON . parse ( fs . readFileSync ( './package.json' , { encoding : 'utf-8' } ) ) ;
52
+ console . log ( `~~~~~~~~~~~~ Running yarn in ${ dir } ~~~~~~~~~~~~` ) ;
53
+ shell . exec ( 'yarn' ) ;
54
+
55
+ if ( packageJSON [ 'scripts' ] [ 'build-deps' ] != null ) {
56
+ console . log ( `~~~~~~~~~~~~ Building deps for ${ dir } ~~~~~~~~~~~~` ) ;
57
+ shell . exec ( 'yarn build-deps' ) ;
58
+ console . log ( '\n' ) ;
59
+ }
60
+
74
61
if ( packageJSON [ 'scripts' ] [ 'test-ci' ] != null ) {
75
62
console . log ( `~~~~~~~~~~~~ Testing ${ dir } ~~~~~~~~~~~~` ) ;
76
- shell . exec ( 'yarn' ) ;
77
63
shell . exec ( 'yarn test-ci' ) ;
78
64
console . log ( '\n' ) ;
79
65
} else if ( packageJSON [ 'scripts' ] [ 'test' ] != null ) {
80
66
console . log ( `~~~~~~~~~~~~ Testing ${ dir } ~~~~~~~~~~~~` ) ;
81
- shell . exec ( 'yarn' ) ;
82
67
shell . exec ( 'yarn test' ) ;
83
68
console . log ( '\n' ) ;
84
69
}
85
70
86
71
if ( packageJSON [ 'scripts' ] [ 'lint' ] != null ) {
87
72
console . log ( `~~~~~~~~~~~~ Linting ${ dir } ~~~~~~~~~~~~` ) ;
88
- shell . exec ( 'yarn' ) ;
89
73
shell . exec ( 'yarn lint' ) ;
90
74
console . log ( '\n' ) ;
91
75
}
0 commit comments