-
Notifications
You must be signed in to change notification settings - Fork 576
/
generateReleasePlan.cjs
executable file
·43 lines (30 loc) · 1.34 KB
/
generateReleasePlan.cjs
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
#!/usr/bin/env node
'use strict';
// Generate Release Plan table for a given release line.
// Usage:
// node --harmony-temporal generateReleasePlan.cjs vxx
const schedule = require('./schedule.json');
const [,, version] = process.argv;
if (!Object.hasOwn(schedule, version)) {
throw new Error(`Unknown version ${version}, accepted values are ${Object.keys(schedule)}`);
}
console.log(`_Draft schedule - all dates subject to change_
Version | Release Date | Releaser
--------|--------------| -------------`);
const { start, maintenance, lts } = schedule[version];
const ltsDateTime = lts && Temporal.PlainDate.from(lts);
const maintenanceDateTime = Temporal.PlainDate.from(maintenance);
const isNowDuringLTS = lts && Temporal.PlainDate.compare(Temporal.Now.plainDateTimeISO(), ltsDateTime) > 0;
const startOfCycle = isNowDuringLTS ? ltsDateTime : Temporal.PlainDate.from(start);
const endOfCycle = isNowDuringLTS ? maintenanceDateTime : ltsDateTime || maintenanceDateTime;
const weeks = isNowDuringLTS ? 4 : 2;
for (let i = startOfCycle; Temporal.PlainDate.compare(i, endOfCycle) === -1; i = i.add({ weeks })) {
console.log(`${version}.x.x | ${i} | `);
}
if (lts) {
console.log(
`${version}.x.x (${isNowDuringLTS ? 'Maintenance' : 'LTS'} transition) | ${
isNowDuringLTS ? maintenance : lts
} | ${isNowDuringLTS ? '_No release_' : ''}`,
);
}