@@ -37,28 +37,29 @@ if (month < 1 || month > 12) {
37
37
process . exit ( 1 ) ;
38
38
}
39
39
40
+ // Repository root assuming this script is in a subdirectory.
41
+ const repoRoot = path . resolve ( __dirname , "../" ) ;
42
+
43
+ // Get JoiningAMeeting contents
44
+ const howToJoin = fs
45
+ . readFileSync ( path . join ( repoRoot , "JoiningAMeeting.md" ) , "utf8" )
46
+ . split ( "\n## How to join\n\n" ) [ 1 ] ;
47
+
40
48
// For all three meetings in a month, fill and write the template
41
49
for ( num = 0 ; num < 3 ; num ++ ) {
42
50
const meeting = getMeeting ( year , month , num ) ;
43
51
const contents = fillMeetingTemplate ( meeting ) ;
44
52
45
- // Create missing directories recursively
46
- fs . mkdirSync ( path . dirname ( meeting . filePath ) , { recursive : true } ) ;
47
-
48
- // Write file
49
- fs . writeFileSync ( meeting . filePath , contents ) ;
50
-
51
- console . log ( `Wrote file: ${ meeting . repoPath } ` ) ;
53
+ // Create missing directories recursively and write file.
54
+ const absPath = path . join ( repoRoot , meeting . filePath ) ;
55
+ fs . mkdirSync ( path . dirname ( absPath ) , { recursive : true } ) ;
56
+ fs . writeFileSync ( absPath , contents ) ;
57
+ console . log ( `Wrote file: ${ meeting . filePath } ` ) ;
52
58
}
53
59
54
60
// --------------------------------------------------------------------------
55
61
56
62
function fillMeetingTemplate ( meeting ) {
57
- // Get JoiningAMeeting contents
58
- const howToJoin = fs
59
- . readFileSync ( path . resolve ( __dirname , "../JoiningAMeeting.md" ) , "utf8" )
60
- . split ( "\n## How to join\n\n" ) [ 1 ] ;
61
-
62
63
const prior1Meeting = getPriorMeeting ( meeting ) ;
63
64
const prior2Meeting = getPriorMeeting ( prior1Meeting ) ;
64
65
@@ -206,10 +207,8 @@ function getMeeting(year, month, num) {
206
207
} ) ;
207
208
208
209
const fileName = [ "wg-primary" , "wg-secondary-apac" , "wg-secondary-eu" ] [ num ] ;
209
- const repoPath = `agendas/${ year } /${ month2D } -${ monthShort } /${ day2D } -${ fileName } .md` ;
210
-
211
- const filePath = path . resolve ( __dirname , "../" , repoPath ) ;
212
- const url = `https://github.com/graphql/graphql-wg/blob/main/${ repoPath } ` ;
210
+ const filePath = `agendas/${ year } /${ month2D } -${ monthShort } /${ day2D } -${ fileName } .md` ;
211
+ const url = `https://github.com/graphql/graphql-wg/blob/main/${ filePath } ` ;
213
212
214
213
return {
215
214
num,
@@ -220,7 +219,6 @@ function getMeeting(year, month, num) {
220
219
monthName,
221
220
dateTimeRange,
222
221
timeLink,
223
- repoPath,
224
222
filePath,
225
223
url,
226
224
} ;
0 commit comments