forked from opensumi/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiteration-plan.ts
100 lines (69 loc) · 2.53 KB
/
iteration-plan.ts
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
import fs from 'fs';
import path from 'path';
import { getPrList } from './changelog/github';
import { formatBytes, getChangelog } from './changelog/util';
import { argv } from 'yargs';
import chalk from 'chalk';
if (!process.env.GITHUB_TOKEN) {
console.log(chalk.red('Please export your github persional access token as env `GITHUB_TOKEN`'));
console.log(chalk.green('You can access your own access token by https://github.com/settings/tokens'));
console.log(chalk.yellow('Please keep your github access token carefully'));
process.exit();
} else if (!argv.time || !argv.version) {
console.log(chalk.yellow('Please process a time argv, like `npm run iteration -- --time=2022-2-2 --version=2.18`'));
process.exit();
}
// 当前仅会统计已合并的 PR 用于最初的迭代计划内容初始化,后续内容需要手动调整
(async () => {
const time = argv.time as string;
const version = argv.version as string;
const items = await getPrList(new Date(time).getTime());
const draftLog: string[] = [];
for (const item of items) {
const changelog = getChangelog(item.body);
if (!changelog) {
continue;
}
draftLog.push(`- [x] ${changelog} [#${item.number}](${item.issue_url}). [@${item.user.login}](${item.user.url})`);
}
const plan = `<!-- This plan captures our work in February. This is a 3-week iteration. We will ship in mid-April. -->
# Plan Items
Legend of annotations:
| Mark | Description |
| ---- | ---- |
|🏃| work in progress |
|✋| blocked task |
|💪| stretch goal for this iteration |
|👨🏻💻| a large work item, larger than one iteration |
|🐚| under discussion within the team |
Below is a summary of the top-level plan items.
## [Draft]
<!-- 发布前需要对 PR 进行分类, 标注 emoji 信息,同时移除多余的分类信息,下列部分仅为迭代期间合并的 PR,还有部分信息需要手动补充 -->
${draftLog.join('\n')}
## Editor
## Extension Manager
## FileTree
## Debug
## Webview
## Search
## Terminal
## Preference
## Keymaps
## Theme
## Webview
## StatusBar
## Extension API
## QuickOpen
## Refactor
## Electron
## Storage
## Style Change
## Tabbar
## Others
Release Notes 见:[release-notes/v${version}.md](https://github.com/opensumi/doc/blob/main/release-notes/v${version}.md).
`;
const logFile = path.resolve(__dirname, '../iteration-plan.md');
await fs.promises.writeFile(logFile, plan);
const bytes = Buffer.byteLength(plan, 'utf8');
console.log(`${formatBytes(bytes)} written to ${logFile}\n`);
})();