Add back missing package config data

Fixes #156
This commit is contained in:
Michael Jackson 2018-12-20 15:09:06 -08:00
parent 59a5acbe08
commit 961ea49ac4
2 changed files with 2 additions and 17 deletions

View File

@ -9,7 +9,7 @@ const logging = require('./logging');
function fetchNpmPackage(packageConfig) { function fetchNpmPackage(packageConfig) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const tarballURL = packageConfig.tarballURL; const tarballURL = packageConfig.dist.tarball;
logging.debug( logging.debug(
'Fetching package for %s from %s', 'Fetching package for %s from %s',

View File

@ -3,23 +3,10 @@ const fetchNpmPackageInfo = require('./fetchNpmPackageInfo');
const notFound = ''; const notFound = '';
function cleanPackageConfig(packageConfig) {
return {
name: packageConfig.name,
version: packageConfig.version,
dependencies: Object.assign(
{},
packageConfig.dependencies,
packageConfig.peerDependencies
),
tarballURL: packageConfig.dist.tarball
};
}
function cleanPackageInfo(packageInfo) { function cleanPackageInfo(packageInfo) {
return { return {
versions: Object.keys(packageInfo.versions).reduce((memo, key) => { versions: Object.keys(packageInfo.versions).reduce((memo, key) => {
memo[key] = cleanPackageConfig(packageInfo.versions[key]); memo[key] = packageInfo.versions[key];
return memo; return memo;
}, {}), }, {}),
'dist-tags': packageInfo['dist-tags'] 'dist-tags': packageInfo['dist-tags']
@ -32,10 +19,8 @@ function getNpmPackageInfo(packageName) {
const value = cache.get(key); const value = cache.get(key);
if (value != null) { if (value != null) {
console.log('GOT VALUE');
resolve(value === notFound ? null : JSON.parse(value)); resolve(value === notFound ? null : JSON.parse(value));
} else { } else {
console.log('NO VALUE');
fetchNpmPackageInfo(packageName).then(value => { fetchNpmPackageInfo(packageName).then(value => {
if (value == null) { if (value == null) {
// Cache 404s for 5 minutes. This prevents us from making // Cache 404s for 5 minutes. This prevents us from making