File tree 2 files changed +21
-4
lines changed
packages/schematics/update/update
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -865,10 +865,9 @@ export default function(options: UpdateSchema): Rule {
865
865
try {
866
866
return isPkgFromRegistry ( name , specifier ) ;
867
867
} catch {
868
- // Abort on failure because package.json is malformed.
869
- throw new SchematicsException (
870
- `Failed to parse dependency "${ name } " with specifier "${ specifier } "`
871
- + ` from package.json. Is the specifier malformed?` ) ;
868
+ logger . warn ( `Package ${ name } was not found on the registry. Skipping.` ) ;
869
+
870
+ return false ;
872
871
}
873
872
} ) ) ;
874
873
const packages = _buildPackageList ( options , npmDeps , logger ) ;
Original file line number Diff line number Diff line change @@ -173,6 +173,24 @@ describe('@schematics/update', () => {
173
173
) . toPromise ( ) . then ( done , done . fail ) ;
174
174
} , 45000 ) ;
175
175
176
+ it ( 'should not error with yarn 2.0 protocols' , async ( ) => {
177
+ const tree = new UnitTestTree ( new HostTree ( new virtualFs . test . TestHost ( {
178
+ '/package.json' : `{
179
+ "name": "blah",
180
+ "dependencies": {
181
+ "src": "src@link:./src",
182
+ "@angular-devkit-tests/update-base": "1.0.0"
183
+ }
184
+ }` ,
185
+ } ) ) ) ;
186
+
187
+ const newTree = await schematicRunner . runSchematicAsync ( 'update' , {
188
+ packages : [ '@angular-devkit-tests/update-base' ] ,
189
+ } , tree ) . toPromise ( ) ;
190
+ const { dependencies } = JSON . parse ( newTree . readContent ( '/package.json' ) ) ;
191
+ expect ( dependencies [ '@angular-devkit-tests/update-base' ] ) . toBe ( '1.1.0' ) ;
192
+ } ) ;
193
+
176
194
it ( 'updates Angular as compatible with Angular N-1' , done => {
177
195
// Add the basic migration package.
178
196
const content = virtualFs . fileBufferToString ( host . sync . read ( normalize ( '/package.json' ) ) ) ;
You can’t perform that action at this time.
0 commit comments