Purge version-less URLs when "latest" tag is used
This commit is contained in:
parent
2d45078761
commit
90fecd39c2
|
@ -37,19 +37,24 @@ getFiles(packageName, version)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return getZone('unpkg.com').then(zone => {
|
let urls = files.map(
|
||||||
let promise = Promise.resolve();
|
|
||||||
|
|
||||||
groupBy(files, 30).forEach(group => {
|
|
||||||
promise = promise.then(() => {
|
|
||||||
const urls = group.map(
|
|
||||||
file => `https://unpkg.com/${packageName}@${version}${file.path}`
|
file => `https://unpkg.com/${packageName}@${version}${file.path}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return purgeFiles(zone.id, urls).then(data => {
|
if (version === 'latest') {
|
||||||
group.forEach(file =>
|
// Purge the URL w/out the "@latest" too.
|
||||||
console.log(chalk.green(`Purged ${file.path}`))
|
urls = urls.concat(
|
||||||
|
files.map(file => `https://unpkg.com/${packageName}${file.path}`)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getZone('unpkg.com').then(zone => {
|
||||||
|
let promise = Promise.resolve();
|
||||||
|
|
||||||
|
groupBy(urls, 30).forEach(group => {
|
||||||
|
promise = promise.then(() => {
|
||||||
|
return purgeFiles(zone.id, group).then(data => {
|
||||||
|
group.forEach(url => console.log(chalk.green(`Purged ${url}`)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue