Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit df5c7f0

Browse files
filipesilvaclydin
authored andcommitted
fix(@schematics/package-update): use https for npm call
Around 26-05-2018 the http call to npm started failing. Using https instead seems to fix it.
1 parent fab766d commit df5c7f0

File tree

1 file changed

+4
-4
lines changed
  • packages/schematics/package_update/utility

1 file changed

+4
-4
lines changed

packages/schematics/package_update/utility/npm.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
chain,
1515
} from '@angular-devkit/schematics';
1616
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
17-
import * as http from 'http';
17+
import * as https from 'https';
1818
import {
1919
EMPTY,
2020
Observable,
@@ -81,14 +81,14 @@ function _getNpmPackageJson(
8181
packageName: string,
8282
logger: logging.LoggerApi,
8383
): Observable<JsonObject> {
84-
const url = `http://registry.npmjs.org/${packageName.replace(/\//g, '%2F')}`;
84+
const url = `https://registry.npmjs.org/${packageName.replace(/\//g, '%2F')}`;
8585
logger.debug(`Getting package.json from ${JSON.stringify(packageName)}...`);
8686

8787
let maybeRequest = npmPackageJsonCache.get(url);
8888
if (!maybeRequest) {
8989
const subject = new ReplaySubject<JsonObject>(1);
9090

91-
const request = http.request(url, response => {
91+
const request = https.request(url, response => {
9292
let data = '';
9393
response.on('data', chunk => data += chunk);
9494
response.on('end', () => {
@@ -211,7 +211,7 @@ function _getRecursiveVersions(
211211

212212
/**
213213
* Use a Rule which can return an observable, but do not actually modify the Tree.
214-
* This rules perform an HTTP request to get the npm registry package.json, then resolve the
214+
* This rules perform an HTTPS request to get the npm registry package.json, then resolve the
215215
* version from the options, and replace the version in the options by an actual version.
216216
* @param supportedPackages A list of packages to update (at the same version).
217217
* @param maybeVersion A version to update those packages to.

0 commit comments

Comments
 (0)