@@ -3,13 +3,12 @@ import rp from 'request-promise';
3
3
import Q from 'q' ;
4
4
import { ok } from 'assert' ;
5
5
6
- // TODO: Change branchName if necessary
7
- const branchName = 'release' ;
6
+ const branchName = 'main' ;
8
7
const 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' ;
10
9
const clientId = process . env . GITHUB_ID ;
11
10
const clientSecret = process . env . GITHUB_SECRET ;
12
- const editorUsername = process . env . ML5_EXAMPLES_USERNAME ;
11
+ const editorUsername = process . env . ML5_LIBRARY_USERNAME ;
13
12
const personalAccessToken = process . env . EDITOR_API_ACCESS_TOKEN ;
14
13
const editorApiUrl = process . env . EDITOR_API_URL ;
15
14
const headers = {
@@ -18,7 +17,7 @@ const headers = {
18
17
19
18
ok ( clientId , 'GITHUB_ID is required' ) ;
20
19
ok ( clientSecret , 'GITHUB_SECRET is required' ) ;
21
- ok ( editorUsername , 'ML5_EXAMPLES_USERNAME is required' ) ;
20
+ ok ( editorUsername , 'ML5_LIBRARY_USERNAME is required' ) ;
22
21
ok ( personalAccessToken , 'EDITOR_API_ACCESS_TOKEN is required' ) ;
23
22
ok ( editorApiUrl , 'EDITOR_API_URL is required' ) ;
24
23
@@ -89,7 +88,7 @@ async function fetchFileContent(item) {
89
88
}
90
89
91
90
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 } ${
93
92
file . url . split ( branchName ) [ 1 ]
94
93
} `;
95
94
file . url = cdnRef ;
@@ -104,7 +103,7 @@ async function fetchFileContent(item) {
104
103
async function getCategories ( ) {
105
104
try {
106
105
const options = Object . assign ( { } , githubRequestOptions ) ;
107
- options . url = `${ options . url } /p5js${ branchRef } ` ;
106
+ options . url = `${ options . url } /examples/ p5js${ branchRef } ` ;
108
107
const results = await rp ( options ) ;
109
108
110
109
return results ;
@@ -158,7 +157,7 @@ async function traverseSketchTree(parentObject) {
158
157
if ( parentObject . type !== 'dir' ) {
159
158
return output ;
160
159
}
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}`
162
161
const options = Object . assign ( { } , githubRequestOptions ) ;
163
162
options . url = `${ options . url } ${ parentObject . path } ${ branchRef } ` ;
164
163
@@ -353,7 +352,7 @@ async function createProjectsInP5User(filledProjectList, user) {
353
352
354
353
/**
355
354
* MAKE
356
- * Get all the sketches from the ml5-examples repo
355
+ * Get all the sketches from the ml5-library repo
357
356
* Get the p5 examples
358
357
* Dive down into each sketch and get all the files
359
358
* Format the sketch files to be save to the db
@@ -378,7 +377,7 @@ async function make() {
378
377
379
378
/**
380
379
* 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
382
381
* Get the p5 examples
383
382
* Dive down into each sketch and get all the files
384
383
* Format the sketch files to be save to the db
@@ -414,7 +413,7 @@ async function test() {
414
413
*/
415
414
416
415
if ( process . env . NODE_ENV === 'development' ) {
417
- // test()
416
+ // test();
418
417
make ( ) ; // replace with test() if you don't want to run all the fetch functions over and over
419
418
} else {
420
419
make ( ) ;
0 commit comments