forked from donmccurdy/three-gltf-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_test.js
19 lines (17 loc) · 868 Bytes
/
gen_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const fetch = require('node-fetch');
const chalk = require('chalk');
const VERSION = '2.0';
const CONTENT_URL = `https://api.github.com/repos/KhronosGroup/glTF-Sample-Models/contents/${VERSION}/`;
const RAW_BASE_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/';
const VIEWER_BASE_URL = `http://localhost:3000/#model=${RAW_BASE_URL}${VERSION}/`;
fetch(CONTENT_URL)
.then((response) => response.json())
.then((directories) => {
console.log(chalk.green('Samples:'));
directories.forEach((entry) => {
const basename = entry.path.split('/').pop();
const prettyBasename = chalk.yellow(`${basename}.gltf:`);
console.log(` - ${prettyBasename} ${VIEWER_BASE_URL}${basename}/glTF/${basename}.gltf`);
});
console.log(chalk.black.bgGreen(`\n 🍺 Found ${directories.length} sample models. \n\n`));
});