Skip to content

Commit 55bdcc2

Browse files
committed
Merge pull request #1169 from NativeScript/totev/skip-sha-check
Skip sha verification when a package is not on npmjs.org
2 parents d0aacc5 + c4645d1 commit 55bdcc2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/npm-installation-manager.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,21 @@ export class NpmInstallationManager implements INpmInstallationManager {
137137
return ((): boolean => {
138138
let shasumProperty = "dist.shasum";
139139
let cachedPackagePath = this.getCachedPackagePath(packageName, version);
140-
let realShasum = this.$npm.view(`${packageName}@${version}`, shasumProperty).wait()[version][shasumProperty];
140+
let packageInfo = this.$npm.view(`${packageName}@${version}`, shasumProperty).wait();
141+
142+
if (_.isEmpty(packageInfo)) {
143+
// this package has not been published to npmjs.org yet - perhaps manually added via --framework-path
144+
this.$logger.trace(`Checking shasum of package ${packageName}@${version}: skipped because the package was not found in npmjs.org`);
145+
return true;
146+
}
147+
148+
let realShasum = packageInfo[version][shasumProperty];
141149
let packageTgz = cachedPackagePath + ".tgz";
142150
let currentShasum = "";
143151
if(this.$fs.exists(packageTgz).wait()) {
144152
currentShasum = this.$fs.getFileShasum(packageTgz).wait();
145153
}
146-
this.$logger.trace(`Checking shasum of package: ${packageName}@${version}: expected ${realShasum}, actual ${currentShasum}.`);
154+
this.$logger.trace(`Checking shasum of package ${packageName}@${version}: expected ${realShasum}, actual ${currentShasum}.`);
147155
return realShasum === currentShasum;
148156
}).future<boolean>()();
149157
}

0 commit comments

Comments
 (0)