diff --git a/packages/schematics/update/update/index.ts b/packages/schematics/update/update/index.ts index 2162c500120c..b1b161c47d5e 100644 --- a/packages/schematics/update/update/index.ts +++ b/packages/schematics/update/update/index.ts @@ -845,10 +845,9 @@ export default function(options: UpdateSchema): Rule { try { return isPkgFromRegistry(name, specifier); } catch { - // Abort on failure because package.json is malformed. - throw new SchematicsException( - `Failed to parse dependency "${name}" with specifier "${specifier}"` - + ` from package.json. Is the specifier malformed?`); + logger.warn(`Package ${name} was not found on the registry. Skipping.`); + + return false; } })); const packages = _buildPackageList(options, npmDeps, logger); diff --git a/packages/schematics/update/update/index_spec.ts b/packages/schematics/update/update/index_spec.ts index 205c5238369b..dfa1dd51695d 100644 --- a/packages/schematics/update/update/index_spec.ts +++ b/packages/schematics/update/update/index_spec.ts @@ -72,6 +72,24 @@ describe('@schematics/update', () => { ).toPromise().then(done, done.fail); }, 45000); + it('should not error with yarn 2.0 protocols', async () => { + const tree = new UnitTestTree(new HostTree(new virtualFs.test.TestHost({ + '/package.json': `{ + "name": "blah", + "dependencies": { + "src": "src@link:./src", + "@angular-devkit-tests/update-base": "1.0.0" + } + }`, + }))); + + const newTree = await schematicRunner.runSchematicAsync('update', { + packages: ['@angular-devkit-tests/update-base'], + }, tree).toPromise(); + const { dependencies } = JSON.parse(newTree.readContent('/package.json')); + expect(dependencies['@angular-devkit-tests/update-base']).toBe('1.1.0'); + }); + it('updates Angular as compatible with Angular N-1', done => { // Add the basic migration package. const content = virtualFs.fileBufferToString(host.sync.read(normalize('/package.json')));