Files
SpineViewer/tests/fetch-legacy-fixtures.js
T

20 lines
1.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'));
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);
}
}