@@ -7,6 +7,7 @@ import * as fs from 'fs'
77import * as https from 'https'
88
99const ghToken = process . env . GH_API_KEY
10+ const destinationFolder = '../../public/livedata-temp' // change "livedata-temp" -> "livedata" to update stuff in local dev env
1011
1112const functionize = ( str ) => `/* eslint-disable */ export default () => (${ str } )`
1213const request = ( url ) => {
@@ -51,7 +52,7 @@ const getMilestones = async() => {
5152
5253 const withIssues = await Promise . all ( [ ...milestonesOpen , ...milestonesClosed ] . map ( async ( milestone ) => await getIssues ( milestone ) ) )
5354
54- fs . writeFileSync ( '../../public/livedata/ milestones.js' , functionize ( JSON . stringify ( withIssues ) ) )
55+ fs . writeFileSync ( ` ${ destinationFolder } / milestones.js` , functionize ( JSON . stringify ( withIssues ) ) )
5556 console . log ( 'milestones-file created succesfully!' )
5657 } catch ( err ) {
5758 throw new Error ( err )
@@ -77,14 +78,14 @@ const getStars = async() => {
7778 stars : repo . stargazers_count
7879 } ) )
7980
80- fs . writeFileSync ( '../../public/livedata/ stars.js' , functionize ( JSON . stringify ( stripped ) ) )
81+ fs . writeFileSync ( ` ${ destinationFolder } / stars.js` , functionize ( JSON . stringify ( stripped ) ) )
8182 console . log ( 'stars-file created succesfully!' )
8283 } catch ( err ) {
8384 throw new Error ( err )
8485 }
8586}
8687
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 ) } )
8889getMilestones ( )
8990 . then ( ( ) => {
9091 getStars ( )
0 commit comments