@@ -7,6 +7,7 @@ import * as fs from 'fs'
7
7
import * as https from 'https'
8
8
9
9
const ghToken = process . env . GH_API_KEY
10
+ const destinationFolder = '../../public/livedata-temp' // change "livedata-temp" -> "livedata" to update stuff in local dev env
10
11
11
12
const functionize = ( str ) => `/* eslint-disable */ export default () => (${ str } )`
12
13
const request = ( url ) => {
@@ -51,7 +52,7 @@ const getMilestones = async() => {
51
52
52
53
const withIssues = await Promise . all ( [ ...milestonesOpen , ...milestonesClosed ] . map ( async ( milestone ) => await getIssues ( milestone ) ) )
53
54
54
- fs . writeFileSync ( '../../public/livedata/ milestones.js' , functionize ( JSON . stringify ( withIssues ) ) )
55
+ fs . writeFileSync ( ` ${ destinationFolder } / milestones.js` , functionize ( JSON . stringify ( withIssues ) ) )
55
56
console . log ( 'milestones-file created succesfully!' )
56
57
} catch ( err ) {
57
58
throw new Error ( err )
@@ -77,14 +78,14 @@ const getStars = async() => {
77
78
stars : repo . stargazers_count
78
79
} ) )
79
80
80
- fs . writeFileSync ( '../../public/livedata/ stars.js' , functionize ( JSON . stringify ( stripped ) ) )
81
+ fs . writeFileSync ( ` ${ destinationFolder } / stars.js` , functionize ( JSON . stringify ( stripped ) ) )
81
82
console . log ( 'stars-file created succesfully!' )
82
83
} catch ( err ) {
83
84
throw new Error ( err )
84
85
}
85
86
}
86
87
87
- if ( ! fs . existsSync ( '../../public/livedata' ) ) fs . mkdirSync ( '../../public/livedata' , { recursive : true } , ( err ) => { throw new Error ( err ) } )
88
+ if ( ! fs . existsSync ( destinationFolder ) ) fs . mkdirSync ( destinationFolder , { recursive : true } , ( err ) => { throw new Error ( err ) } )
88
89
getMilestones ( )
89
90
. then ( ( ) => {
90
91
getStars ( )
0 commit comments