-
Notifications
You must be signed in to change notification settings - Fork 1
/
inquirer.ts
62 lines (52 loc) · 1.69 KB
/
inquirer.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
import inquirer from 'inquirer';
export const requireToken = async (defaultToken: string): Promise<string> => {
const { token } = await inquirer.prompt([
{
name: 'token',
message: `Enter your acces token. If empty we'll use env (${defaultToken}) or config. token: `,
type: 'password',
},
]);
return token;
};
export const requireRepo = async (defaultRepo: string): Promise<string> => {
const { repo } = await inquirer.prompt([
{
name: 'repo',
message: 'Repo name in format user/repo: ',
default: defaultRepo,
type: 'input',
},
]);
return repo;
};
const confirmMessage = async (customConfig: { message: string }) => {
const { response } = await inquirer.prompt([
{
name: 'response',
type: 'confirm',
...customConfig,
},
]);
return response;
};
export const confirmPublishPreview = (issue: number): Promise<boolean> => {
return confirmMessage({
message: `Do you want to publish your RELEASE-NOTES Preview in ${issue} ?`,
});
};
export const confirmPublish = (): Promise<boolean> => {
return confirmMessage({
message: 'Do you want to publish your RELEASE-NOTES?',
});
};
export const confirmPublishAssets = (): Promise<boolean> => {
return confirmMessage({
message: 'Do you want to publish your asset files?',
});
};
export const confirmPullRequestLabeling = (): Promise<boolean> => {
return confirmMessage({
message: 'Do you want to label pull requests with in-release-note label?',
});
};