34 lines
2.0 KiB
JavaScript
34 lines
2.0 KiB
JavaScript
'use strict';
|
|
// Download only test assets, pinned to the official 3.6 and 3.7 branch commits.
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { execFileSync } = require('child_process');
|
|
const destination = path.resolve(process.argv[2] || path.join(__dirname, '.fixtures'));
|
|
if (['3.4', '3.5'].includes(process.argv[3])) {
|
|
const version = process.argv[3];
|
|
const revision = version === '3.4' ? 'ef5013143178918ddfc7cabfbddeae7aec7cf84e' : '2cd9467d2736b7f3a0b81382f117c73823bfb44b';
|
|
for (const name of ['spineboy', 'goblins', 'vine', 'stretchyman', 'tank', 'raptor']) {
|
|
const directory = path.join(destination, version, name);
|
|
fs.mkdirSync(directory, { recursive: true });
|
|
const variants = name === 'spineboy' ? [name, name + '-mesh', name + '-hover'] : name === 'goblins' ? [name, name + '-mesh'] : [name];
|
|
for (const file of [...variants.flatMap(v => [v + '.json', v + '.skel']), name + '.atlas', name + '.png']) {
|
|
const url = `https://raw.githubusercontent.com/EsotericSoftware/spine-runtimes/${revision}/examples/${name}/export/${file}`;
|
|
execFileSync('curl', ['--http1.1', '-LfsS', '--retry', '2', '--max-time', '60', url, '-o', path.join(directory, file)]);
|
|
}
|
|
console.log(version + ' / ' + name);
|
|
}
|
|
process.exit(0);
|
|
}
|
|
const revisions = { '3.6': '654c20e5b0e523040b6366bbd1042510d2645134', '3.7': '9639bcc81722d7178fd9d1cdc1a3d55a4c91f989' };
|
|
for (const [version, revision] of Object.entries(revisions)) {
|
|
for (const name of ['spineboy', 'goblins', 'vine', 'stretchyman', 'tank', 'coin', 'raptor']) {
|
|
const directory = path.join(destination, version, name);
|
|
fs.mkdirSync(directory, { recursive: true });
|
|
for (const file of [name + '-pro.json', name + '-pro.skel', name + '.atlas']) {
|
|
const url = `https://raw.githubusercontent.com/EsotericSoftware/spine-runtimes/${revision}/examples/${name}/export/${file}`;
|
|
execFileSync('curl', ['-LfsS', '--retry', '2', '--max-time', '60', url, '-o', path.join(directory, file)]);
|
|
}
|
|
console.log(version + ' / ' + name);
|
|
}
|
|
}
|