fix fetch-examples script to adjust to changes to the p5.js website

This commit is contained in:
Cassie Tarakajian 2019-01-25 15:11:55 -05:00
parent 31abeb9455
commit 65c1c35d10

View file

@ -49,7 +49,7 @@ mongoose.connection.on('error', () => {
function getCategories() { function getCategories() {
const categories = []; const categories = [];
const options = { const options = {
url: `https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/en?client_id=${ url: `https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/en?client_id=${
clientId}&client_secret=${clientSecret}`, clientId}&client_secret=${clientSecret}`,
method: 'GET', method: 'GET',
headers, headers,
@ -134,7 +134,7 @@ function getSketchContent(projectsInAllCategories) {
function createProjectsInP5user(projectsInAllCategories) { function createProjectsInP5user(projectsInAllCategories) {
const options = { const options = {
url: `https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/assets?client_id=${ url: `https://api.github.com/repos/processing/p5.js-website/contents/src/data/examples/assets?client_id=${
clientId}&client_secret=${clientSecret}`, clientId}&client_secret=${clientSecret}`,
method: 'GET', method: 'GET',
headers, headers,
@ -264,7 +264,7 @@ function createProjectsInP5user(projectsInAllCategories) {
const fileID = objectID().toHexString(); const fileID = objectID().toHexString();
newProject.files.push({ newProject.files.push({
name: assetName, name: assetName,
url: `https://rawgit.com/processing/p5.js-website/master/dist/assets/examples/assets/${assetName}`, url: `https://rawgit.com/processing/p5.js-website/master/src/data/examples/assets/${assetName}`,
id: fileID, id: fileID,
_id: fileID, _id: fileID,
children: [], children: [],