forked from nodejs/create-node-meeting-artifacts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-node-meeting-artifacts.mjs
More file actions
141 lines (114 loc) · 3.55 KB
/
Copy pathcreate-node-meeting-artifacts.mjs
File metadata and controls
141 lines (114 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env node
/**
* Node.js Meeting Artifacts Creator
*
* Usage:
* node create-node-meeting-artifacts.mjs [meetingGroup]
* npm run tsc-meeting
* npm run dev -- tsc
*/
import { Command } from 'commander';
import environmentConfig from './src/config.mjs';
import * as github from './src/github.mjs';
import * as google from './src/google.mjs';
import * as hackmd from './src/hackmd.mjs';
import * as meetings from './src/meeting.mjs';
const program = new Command();
program
.argument('<group>', 'Meeting group')
.option('--dry-run', 'Show output without creating/updating anything', false)
.option('--verbose', 'Show debug output')
.parse(process.argv);
// Step 1: Application configuration
/** @type {import('./src/types').AppConfig} */
const config = {
...environmentConfig,
...program.opts(),
meetingGroup: program.args[0],
};
// Step 2: Initialize Google Calendar client with API Key
const calendarClient = google.createCalendarClient(config.google);
// Step 3: Initialize GitHub client
const githubClient = github.createGitHubClient(config);
// Step 4: Read meeting configuration from templates
const meetingConfig = await meetings.readMeetingConfig(config);
// Step 5: Initialize HackMD client with meeting configuration
const hackmdClient = hackmd.createHackMDClient(config, meetingConfig);
if (config.dryRun) {
const meetingDate = new Date();
const gitHubAgendaIssues = await github.getAgendaIssues(
githubClient,
config,
meetingConfig
);
const meetingAgenda = meetings.generateMeetingAgenda(gitHubAgendaIssues);
const issueContent = await meetings.generateMeetingIssue(
config,
meetingConfig,
meetingDate,
meetingAgenda,
''
);
console.log(issueContent);
process.exit(0);
}
// Step 6: Find next meeting event in calendar
const event = await google.findNextMeetingEvent(calendarClient, meetingConfig);
// Step 7: Extract meeting date from event
const meetingDate = new Date(event.start.dateTime);
// Step 8: Get Meeting Title
const meetingTitle = meetings.generateMeetingTitle(
config,
meetingConfig,
meetingDate
);
// Step 9: Get agenda information using native implementation
const gitHubAgendaIssues = await github.getAgendaIssues(
githubClient,
config,
meetingConfig
);
// Step 10: Parse meeting agenda from GitHub issues
const meetingAgenda = meetings.generateMeetingAgenda(gitHubAgendaIssues);
// Step 11: Create HackMD document with meeting notes and tags
const hackmdNote = await hackmd.createMeetingNotesDocument(
hackmdClient,
meetingTitle,
''
);
// Step 12: Get the HackMD document link
const minutesDocLink =
hackmdNote.publishLink || `https://hackmd.io/${hackmdNote.id}`;
// Step 13: Generate meeting issue content using native implementation
const issueContent = await meetings.generateMeetingIssue(
config,
meetingConfig,
meetingDate,
meetingAgenda,
minutesDocLink
);
// Step 14: Create GitHub issue with HackMD link
const githubIssue = await github.createGitHubIssue(
githubClient,
meetingConfig,
meetingTitle,
issueContent
);
// Step 15: Update the minutes content with the HackMD link
const minutesContent = await meetings.generateMeetingMinutes(
config,
meetingConfig,
meetingTitle,
meetingAgenda,
minutesDocLink,
githubIssue.html_url
);
// Step 16: Update the HackMD document with the self-referencing link
await hackmd.updateMeetingNotesDocument(
hackmdClient,
hackmdNote.id,
minutesContent
);
// Output success information with links
console.log(`Created GitHub issue: ${githubIssue.html_url}`);
console.log(`Created HackMD document: ${minutesDocLink}`);