File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,11 @@ export class PackageConfig {
111111 await packageDownloader ( this ) . downloadPackage ( { verbose : verbose } ) ;
112112 } catch ( error ) {
113113 console . error ( error ) ;
114+ // If repo exist but not version we will end up with default-version
115+ // of that repo, and on subsequent runs tooling will say that the missing version
116+ // actually exists! To prevent this we remove the directory of the missing version!
117+ CliFileSystem . removeSync ( this . getPackageDirectoryWithVersion ( ) ) ;
118+ throw new Error ( `Cannot find package ${ this . getPackageName ( ) } :${ this . version } ` ) ;
114119 }
115120 return ;
116121 }
@@ -128,14 +133,21 @@ export class PackageConfig {
128133 }
129134
130135 readPackageManifest ( ) : PackageManifest {
136+ let data ;
131137 try {
132138 const path = this . getManifestFilePath ( ) ;
133- const config : PackageManifest = deserializePackageJSON ( CliFileSystem . readFileSync ( path ) ) ;
134- return config ;
139+ data = CliFileSystem . readFileSync ( path ) ;
135140 } catch ( error ) {
136141 console . log ( `Cannot find package ${ this . getPackageName ( ) } :${ this . version } . Please upgrade or init first!` ) ;
137142 throw new Error ( `Cannot find package ${ this . getPackageName ( ) } :${ this . version } ` ) ;
138143 }
144+ try {
145+ const config : PackageManifest = deserializePackageJSON ( data ) ;
146+ return config ;
147+ } catch ( error : any ) {
148+ const errorMessage = error ?. message || 'Unknown error occurred' ;
149+ throw new Error ( `Cannot parse manifest file for ${ this . getPackageName ( ) } :${ this . version } .\n${ errorMessage } ` ) ;
150+ }
139151 }
140152}
141153
You can’t perform that action at this time.
0 commit comments