-
Notifications
You must be signed in to change notification settings - Fork 0
/
createIssues.js
144 lines (138 loc) · 3.43 KB
/
createIssues.js
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
142
143
144
import { nanoid } from "nanoid";
export const names = [
"John",
"Jane",
"Sam",
"Anna",
"Michael",
"Sarah",
"Chris",
"Jessica",
];
export const projects = [
"Website Redesign",
"App Development",
"Marketing Strategy",
"Customer Outreach",
];
export const labels = [
"frontend",
"backend",
"ux",
"research",
"design",
"bug",
"feature",
];
export const priorities = ["none", "low", "medium", "high", "urgent"];
export const statuses = ["backlog", "todo", "in_progress", "done", "canceled"];
let issueId = 0;
export function* createIssues(numTasks) {
const actionPhrases = [
"Implement",
"Develop",
"Design",
"Test",
"Review",
"Refactor",
"Redesign",
"Enhance",
"Optimize",
"Fix",
"Remove",
"Mock",
"Update",
"Document",
"Deploy",
"Revert",
"Add",
"Destroy",
];
const featurePhrases = [
"the login mechanism",
"the user dashboard",
"the settings page",
"database queries",
"UI/UX components",
"API endpoints",
"the checkout process",
"responsive layouts",
"error handling logic",
"the navigation menu",
"the search functionality",
"the onboarding flow",
"the user profile page",
"the admin dashboard",
"the billing system",
"the payment gateway",
"the user permissions",
"the user roles",
"the user management",
];
const purposePhrases = [
"to improve user experience",
"to speed up load times",
"to enhance security",
"to prepare for the next release",
"following the latest design mockups",
"to address reported issues",
"for better mobile responsiveness",
"to comply with new regulations",
"to reflect customer feedback",
"to keep up with platform changes",
"to improve overall performance",
"to fix a critical bug",
"to add a new feature",
"to remove deprecated code",
"to improve code readability",
"to fix a security vulnerability",
"to improve SEO",
"to improve accessibility",
"to improve the codebase",
];
const contextPhrases = [
"Based on the latest UX research",
"To ensure seamless user experience",
"To cater to increasing user demands",
"Keeping scalability in mind",
"As outlined in the last meeting",
"Following the latest design specifications",
"To adhere to the updated requirements",
"While ensuring backward compatibility",
"To improve overall performance",
"And ensure proper error feedback to the user",
];
const getRandomItem = (items) =>
items[Math.floor(Math.random() * items.length)];
const generateText = () => {
const action = getRandomItem(actionPhrases);
const feature = getRandomItem(featurePhrases);
const purpose = getRandomItem(purposePhrases);
const context = getRandomItem(contextPhrases);
return [
`${action} ${feature}`,
`${action} ${feature} ${purpose}. ${context}.`,
];
};
for (let i = 0; i < numTasks; i++) {
const [title, description] = generateText();
const task = {
id: nanoid(),
// id: ++issueId,
creator: getRandomItem(names),
title,
created: Date.now() - i * 5 * 24 * 60 * 60 * 1000,
modified: Date.now() - i * 2 * 24 * 60 * 60 * 1000,
status: getRandomItem(statuses),
priority: getRandomItem(priorities),
kanbanorder: 1,
};
yield [
task,
{
id: task.id,
body: description,
},
];
}
}