Skip to content

Commit 91e16c2

Browse files
author
Christopher Willis-Ford
committed
fix scripts/fetchMediaLibraryAssets.js missing some sprite assets
Assets which are referenced by a sprite but not referenced by the sound, costume, or backdrop libraries were being missed by previous versions. I also removed the default parameter to several methods in order to reduce the likelihood of similar mistakes in the future.
1 parent 7b13482 commit 91e16c2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"clean": "rimraf ./dist/ ./static/assets/",
1212
"compile": "rimraf ./dist/ && electron-webpack --bail --display-error-details --env.minify=false",
1313
"fetch": "rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js",
14-
"dist": "npm run fetch && npm run compile -p && electron-builder",
14+
"dist": "npm run build-gui && npm run fetch && npm run compile -p && electron-builder",
1515
"dist:dir": "npm run dist -- --dir -c.compression=store -c.mac.identity=null",
1616
"lint": "eslint --cache --color --ext .jsx,.js ."
1717
},

scripts/fetchMediaLibraryAssets.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const describe = function (object) {
1616
return util.inspect(object, false, Infinity, true);
1717
};
1818

19-
const collectSimple = function (library, debugLabel = 'Item', dest = new Set()) {
19+
const collectSimple = function (library, dest, debugLabel = 'Item') {
2020
library.forEach(item => {
2121
let md5Count = 0;
2222
if (item.md5) {
@@ -37,21 +37,21 @@ const collectSimple = function (library, debugLabel = 'Item', dest = new Set())
3737
return dest;
3838
};
3939

40-
const collectAssets = function (dest = new Set()) {
41-
collectSimple(libraries.backdrops, 'Backdrop', dest);
42-
collectSimple(libraries.costumes, 'Costume', dest);
43-
collectSimple(libraries.sounds, 'Sound', dest);
40+
const collectAssets = function (dest) {
41+
collectSimple(libraries.backdrops, dest, 'Backdrop');
42+
collectSimple(libraries.costumes, dest, 'Costume');
43+
collectSimple(libraries.sounds, dest, 'Sound');
4444
libraries.sprites.forEach(sprite => {
4545
if (sprite.md5) {
4646
dest.add(sprite.md5);
4747
} else {
4848
console.warn(`Sprite has no MD5 property:\n${describe(sprite)}`);
4949
}
5050
if (sprite.json.costumes) {
51-
collectSimple(sprite.json.costumes, `Costume for sprite ${sprite.name}`);
51+
collectSimple(sprite.json.costumes, dest, `Costume for sprite ${sprite.name}`);
5252
}
5353
if (sprite.json.sounds) {
54-
collectSimple(sprite.json.sounds, `Sound for sprite ${sprite.name}`);
54+
collectSimple(sprite.json.sounds, dest, `Sound for sprite ${sprite.name}`);
5555
}
5656
});
5757
return dest;
@@ -88,7 +88,7 @@ const fetchAsset = function (md5, callback) {
8888
};
8989

9090
const fetchAllAssets = function () {
91-
const allAssets = collectAssets();
91+
const allAssets = collectAssets(new Set());
9292
console.log(`Total library assets: ${allAssets.size}`);
9393

9494
async.forEachLimit(allAssets, NUM_SIMULTANEOUS_DOWNLOADS, fetchAsset, err => {

0 commit comments

Comments
 (0)