Fix outline icon caching

Summary:
The build-release script was using different logic to construct the local url, than the lookup file.
Changed so they both use the same function.
And unit tests added.

Reviewed By: passy

Differential Revision: D17602476

fbshipit-source-id: 6aaedd58eafb2cc59adcdc0ebb4dd329bf99c33a
This commit is contained in:
John Knox
2019-09-27 02:59:28 -07:00
committed by Facebook Github Bot
parent 74b9ba5c40
commit 9d4cc64bc9
3 changed files with 72 additions and 17 deletions

View File

@@ -18,7 +18,11 @@ const {
genMercurialRevision,
} = require('./build-utils.js');
const fetch = require('node-fetch');
const {ICONS, getIconURL} = require('../src/utils/icons.js');
const {
ICONS,
buildLocalIconPath,
getIconURL,
} = require('../src/utils/icons.js');
function generateManifest(versionNumber) {
const filePath = path.join(__dirname, '..', 'dist');
@@ -137,11 +141,7 @@ function downloadIcons(buildFolder) {
res =>
new Promise((resolve, reject) => {
const fileStream = fs.createWriteStream(
path.join(
buildFolder,
'icons',
`${name}-${size}@${density}x.png`,
),
path.join(buildFolder, buildLocalIconPath(name, size, density)),
);
res.body.pipe(fileStream);
res.body.on('error', reject);