File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -96,11 +96,13 @@ async function main() {
96
96
// Check the package.json for 'link:' and 'file:' dependencies.
97
97
const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' )
98
98
. toString ( 'utf8' ) ) as { dependencies : Record < string , string> } ;
99
- for ( let [ dep , depVersion ] of Object . entries ( packageJson . dependencies ) ) {
100
- const start = depVersion . slice ( 0 , 5 ) ;
101
- if ( start === 'link:' || start === 'file:' ) {
102
- throw new Error ( `${ pkg } has a '${ start } ' dependency on ${ dep } . `
103
- + 'Refusing to publish.' ) ;
99
+ if ( packageJson . dependencies ) {
100
+ for ( let [ dep , depVersion ] of Object . entries ( packageJson . dependencies ) ) {
101
+ const start = depVersion . slice ( 0 , 5 ) ;
102
+ if ( start === 'link:' || start === 'file:' ) {
103
+ throw new Error ( `${ pkg } has a '${ start } ' dependency on ${ dep } . `
104
+ + 'Refusing to publish.' ) ;
105
+ }
104
106
}
105
107
}
106
108
You can’t perform that action at this time.
0 commit comments