@@ -3,13 +3,12 @@ import rp from 'request-promise';
33import Q from 'q' ;
44import { ok } from 'assert' ;
55
6- // TODO: Change branchName if necessary
7- const branchName = 'release' ;
6+ const branchName = 'main' ;
87const branchRef = `?ref=${ branchName } ` ;
9- const baseUrl = 'https://api.github.com/repos/ml5js/ml5-examples /contents' ;
8+ const baseUrl = 'https://api.github.com/repos/ml5js/ml5-library /contents' ;
109const clientId = process . env . GITHUB_ID ;
1110const clientSecret = process . env . GITHUB_SECRET ;
12- const editorUsername = process . env . ML5_EXAMPLES_USERNAME ;
11+ const editorUsername = process . env . ML5_LIBRARY_USERNAME ;
1312const personalAccessToken = process . env . EDITOR_API_ACCESS_TOKEN ;
1413const editorApiUrl = process . env . EDITOR_API_URL ;
1514const headers = {
@@ -18,7 +17,7 @@ const headers = {
1817
1918ok ( clientId , 'GITHUB_ID is required' ) ;
2019ok ( clientSecret , 'GITHUB_SECRET is required' ) ;
21- ok ( editorUsername , 'ML5_EXAMPLES_USERNAME is required' ) ;
20+ ok ( editorUsername , 'ML5_LIBRARY_USERNAME is required' ) ;
2221ok ( personalAccessToken , 'EDITOR_API_ACCESS_TOKEN is required' ) ;
2322ok ( editorApiUrl , 'EDITOR_API_URL is required' ) ;
2423
@@ -89,7 +88,7 @@ async function fetchFileContent(item) {
8988 }
9089
9190 if ( file . url ) {
92- const cdnRef = `https://cdn.jsdelivr.net/gh/ml5js/ml5-examples @${ branchName } ${
91+ const cdnRef = `https://cdn.jsdelivr.net/gh/ml5js/ml5-library @${ branchName } ${
9392 file . url . split ( branchName ) [ 1 ]
9493 } `;
9594 file . url = cdnRef ;
@@ -104,7 +103,7 @@ async function fetchFileContent(item) {
104103async function getCategories ( ) {
105104 try {
106105 const options = Object . assign ( { } , githubRequestOptions ) ;
107- options . url = `${ options . url } /p5js${ branchRef } ` ;
106+ options . url = `${ options . url } /examples/ p5js${ branchRef } ` ;
108107 const results = await rp ( options ) ;
109108
110109 return results ;
@@ -158,7 +157,7 @@ async function traverseSketchTree(parentObject) {
158157 if ( parentObject . type !== 'dir' ) {
159158 return output ;
160159 }
161- // let options = `https://api.github.com/repos/ml5js/ml5-examples /contents/${sketches.path}${branchRef}`
160+ // let options = `https://api.github.com/repos/ml5js/ml5-library /contents/examples/p5js /${sketches.path}${branchRef}`
162161 const options = Object . assign ( { } , githubRequestOptions ) ;
163162 options . url = `${ options . url } ${ parentObject . path } ${ branchRef } ` ;
164163
@@ -353,7 +352,7 @@ async function createProjectsInP5User(filledProjectList, user) {
353352
354353/**
355354 * MAKE
356- * Get all the sketches from the ml5-examples repo
355+ * Get all the sketches from the ml5-library repo
357356 * Get the p5 examples
358357 * Dive down into each sketch and get all the files
359358 * Format the sketch files to be save to the db
@@ -378,7 +377,7 @@ async function make() {
378377
379378/**
380379 * TEST - same as make except reads from file for testing purposes
381- * Get all the sketches from the ml5-examples repo
380+ * Get all the sketches from the ml5-library repo
382381 * Get the p5 examples
383382 * Dive down into each sketch and get all the files
384383 * Format the sketch files to be save to the db
@@ -414,7 +413,7 @@ async function test() {
414413 */
415414
416415if ( process . env . NODE_ENV === 'development' ) {
417- // test()
416+ // test();
418417 make ( ) ; // replace with test() if you don't want to run all the fetch functions over and over
419418} else {
420419 make ( ) ;
0 commit comments