RN local-cli: fix saveAsset scales filtering

Reviewed By: fkgozali

Differential Revision: D5688676

fbshipit-source-id: 2cf6d08b626a6e8c55db0b2293e13300f9606332
This commit is contained in:
Jean Lauliac 2017-08-24 06:22:25 -07:00 committed by Facebook Github Bot
parent 6493a85754
commit b6e0f4a12d
1 changed files with 7 additions and 3 deletions

View File

@ -32,13 +32,17 @@ function saveAssets(
const filesToCopy = Object.create(null); // Map src -> dest
assets
.forEach(asset =>
filterPlatformAssetScales(platform, asset.scales).forEach((scale, idx) => {
.forEach(asset => {
const validScales = new Set(filterPlatformAssetScales(platform, asset.scales));
asset.scales.forEach((scale, idx) => {
if (!validScales.has(scale)) {
return;
}
const src = asset.files[idx];
const dest = path.join(assetsDest, getAssetDestPath(asset, scale));
filesToCopy[src] = dest;
})
);
});
return copyAll(filesToCopy);
}