File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
import { resolve } from 'path' ;
19
+ import { existsSync } from 'fs' ;
19
20
import chalk from 'chalk' ;
20
21
import simpleGit from 'simple-git/promise' ;
21
22
import fs from 'mz/fs' ;
@@ -43,11 +44,15 @@ async function getDiffData(): Promise<{
43
44
// Check for changed files inside package dirs.
44
45
const pkgMatch = filename . match ( '^(packages(-exp)?/[a-zA-Z0-9-]+)/.*' ) ;
45
46
if ( pkgMatch && pkgMatch [ 1 ] ) {
46
- const changedPackage = require ( resolve (
47
- root ,
48
- pkgMatch [ 1 ] ,
49
- 'package.json'
50
- ) ) ;
47
+ // skip packages without package.json
48
+ // It could happen when we rename a package or remove a package from the repo
49
+ const pkgJsonPath = resolve ( root , pkgMatch [ 1 ] , 'package.json' ) ;
50
+
51
+ if ( ! existsSync ( pkgJsonPath ) ) {
52
+ continue ;
53
+ }
54
+
55
+ const changedPackage = require ( pkgJsonPath ) ;
51
56
if ( changedPackage ) {
52
57
// Add the package itself.
53
58
changedPackages . add ( changedPackage . name ) ;
You can’t perform that action at this time.
0 commit comments