-
Notifications
You must be signed in to change notification settings - Fork 128
/
errors.js
249 lines (205 loc) · 9.49 KB
/
errors.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import { inspect } from "node:util";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
import { isString } from "lodash-es";
const pkg = require("../../package.json");
const HOMEPAGE = pkg.homepage;
const stringify = (object) =>
isString(object)
? object
: inspect(object, {
breakLength: Number.POSITIVE_INFINITY,
depth: 2,
maxArrayLength: 5,
});
const linkify = (file) => `${HOMEPAGE}/blob/master/${file}`;
export function EINVALIDASSETS({ assets }) {
return {
message: "Invalid `assets` option.",
details: `The [assets option](${linkify(
"README.md#assets",
)}) must be an \`Array\` of \`Strings\` or \`Objects\` with a \`path\` property.
Your configuration for the \`assets\` option is \`${stringify(assets)}\`.`,
};
}
export function EINVALIDSUCCESSCOMMENT({ successComment }) {
return {
message: "Invalid `successComment` option.",
details: `The [successComment option](${linkify(
"README.md#successcomment",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`successComment\` option is \`${stringify(
successComment,
)}\`.`,
};
}
export function EINVALIDFAILTITLE({ failTitle }) {
return {
message: "Invalid `failTitle` option.",
details: `The [failTitle option](${linkify(
"README.md#failtitle",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`failTitle\` option is \`${stringify(
failTitle,
)}\`.`,
};
}
export function EINVALIDFAILCOMMENT({ failComment }) {
return {
message: "Invalid `failComment` option.",
details: `The [failComment option](${linkify(
"README.md#failcomment",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`failComment\` option is \`${stringify(
failComment,
)}\`.`,
};
}
export function EINVALIDLABELS({ labels }) {
return {
message: "Invalid `labels` option.",
details: `The [labels option](${linkify(
"README.md#options",
)}) if defined, must be an \`Array\` of non empty \`String\`.
Your configuration for the \`labels\` option is \`${stringify(labels)}\`.`,
};
}
export function EINVALIDASSIGNEES({ assignees }) {
return {
message: "Invalid `assignees` option.",
details: `The [assignees option](${linkify(
"README.md#options",
)}) must be an \`Array\` of non empty \`Strings\`.
Your configuration for the \`assignees\` option is \`${stringify(
assignees,
)}\`.`,
};
}
export function EINVALIDRELEASEDLABELS({ releasedLabels }) {
return {
message: "Invalid `releasedLabels` option.",
details: `The [releasedLabels option](${linkify(
"README.md#options",
)}) if defined, must be an \`Array\` of non empty \`String\`.
Your configuration for the \`releasedLabels\` option is \`${stringify(
releasedLabels,
)}\`.`,
};
}
export function EINVALIDADDRELEASES({ addReleases }) {
return {
message: "Invalid `addReleases` option.",
details: `The [addReleases option](${linkify(
"README.md#options",
)}) if defined, must be one of \`false|top|bottom\`.
Your configuration for the \`addReleases\` option is \`${stringify(
addReleases,
)}\`.`,
};
}
export function EINVALIDDRAFTRELEASE({ draftRelease }) {
return {
message: "Invalid `draftRelease` option.",
details: `The [draftRelease option](${linkify(
"README.md#options",
)}) if defined, must be a \`Boolean\`.
Your configuration for the \`draftRelease\` option is \`${stringify(
draftRelease,
)}\`.`,
};
}
export function EINVALIDGITHUBURL() {
return {
message: "The git repository URL is not a valid GitHub URL.",
details: `The **semantic-release** \`repositoryUrl\` option must a valid GitHub URL with the format \`<GitHub_or_GHE_URL>/<owner>/<repo>.git\`.
By default the \`repositoryUrl\` option is retrieved from the \`repository\` property of your \`package.json\` or the [git origin url](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) of the repository cloned by your CI environment.`,
};
}
export function EMISMATCHGITHUBURL({ repositoryUrl, clone_url }) {
return {
message: "The git repository URL mismatches the GitHub URL.",
details: `The **semantic-release** \`repositoryUrl\` option must have the same repository name and owner as the GitHub repo.
Your configuration for the \`repositoryUrl\` option is \`${stringify(repositoryUrl)}\` and the \`clone_url\` of your GitHub repo is \`${stringify(clone_url)}\`.
By default the \`repositoryUrl\` option is retrieved from the \`repository\` property of your \`package.json\` or the [git origin url](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) of the repository cloned by your CI environment.
Note: If you have recently changed your GitHub repository name or owner, update the value in **semantic-release** \`repositoryUrl\` option and the \`repository\` property of your \`package.json\` respectively to match the new GitHub URL.`,
};
}
export function EINVALIDPROXY({ proxy }) {
return {
message: "Invalid `proxy` option.",
details: `The [proxy option](${linkify(
"README.md#proxy",
)}) must be a \`String\` or an \`Objects\` with a \`host\` and a \`port\` property.
Your configuration for the \`proxy\` option is \`${stringify(proxy)}\`.`,
};
}
export function EMISSINGREPO({ owner, repo }) {
return {
message: `The repository ${owner}/${repo} doesn't exist.`,
details: `The **semantic-release** \`repositoryUrl\` option must refer to your GitHub repository. The repository must be accessible with the [GitHub API](https://developer.github.com/v3).
By default the \`repositoryUrl\` option is retrieved from the \`repository\` property of your \`package.json\` or the [git origin url](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) of the repository cloned by your CI environment.
If you are using [GitHub Enterprise](https://enterprise.github.com) please make sure to configure the \`githubUrl\` and \`githubApiPathPrefix\` [options](${linkify(
"README.md#options",
)}).`,
};
}
export function EGHNOPERMISSION({ owner, repo }) {
return {
message: `The GitHub token doesn't allow to push on the repository ${owner}/${repo}.`,
details: `The user associated with the [GitHub token](${linkify(
"README.md#github-authentication",
)}) configured in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable must allows to push to the repository ${owner}/${repo}.
Please make sure the GitHub user associated with the token is an [owner](https://help.github.com/articles/permission-levels-for-a-user-account-repository/#owner-access-on-a-repository-owned-by-a-user-account) or a [collaborator](https://help.github.com/articles/permission-levels-for-a-user-account-repository/#collaborator-access-on-a-repository-owned-by-a-user-account) if the repository belong to a user account or has [write permissions](https://help.github.com/articles/managing-team-access-to-an-organization-repository) if the repository [belongs to an organization](https://help.github.com/articles/repository-permission-levels-for-an-organization).`,
};
}
export function EINVALIDGHTOKEN({ owner, repo }) {
return {
message: "Invalid GitHub token.",
details: `The [GitHub token](${linkify(
"README.md#github-authentication",
)}) configured in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable must be a valid [personal token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line) allowing to push to the repository ${owner}/${repo}.
Please make sure to set the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable in your CI with the exact value of the GitHub personal token.`,
};
}
export function ENOGHTOKEN({ owner, repo }) {
return {
message: "No GitHub token specified.",
details: `A [GitHub personal token](${linkify(
"README.md#github-authentication",
)}) must be created and set in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable on your CI environment.
Please make sure to create a [GitHub personal token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line) and to set it in the \`GH_TOKEN\` or \`GITHUB_TOKEN\` environment variable on your CI environment. The token must allow to push to the repository ${owner}/${repo}.`,
};
}
export function EINVALIDRELEASEBODYTEMPLATE({ releaseBodyTemplate }) {
return {
message: "Invalid `releaseBodyTemplate` option.",
details: `The [releaseBodyTemplate option](${linkify(
"README.md#releaseBodyTemplate",
)}) must be a non empty \`String\`.
Your configuration for the \`releaseBodyTemplate\` option is \`${stringify(
releaseBodyTemplate,
)}\`.`,
};
}
export function EINVALIDRELEASENAMETEMPLATE({ releaseNameTemplate }) {
return {
message: "Invalid `releaseNameTemplate` option.",
details: `The [releaseNameTemplate option](${linkify(
"README.md#releaseNameTemplate",
)}) must be a non empty \`String\`.
Your configuration for the \`releaseNameTemplate\` option is \`${stringify(
releaseNameTemplate,
)}\`.`,
};
}
export function EINVALIDDISCUSSIONCATEGORYNAME({ discussionCategoryName }) {
return {
message: "Invalid `discussionCategoryName` option.",
details: `The [discussionCategoryName option](${linkify(
"README.md#discussionCategoryName",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`discussionCategoryName\` option is \`${stringify(
discussionCategoryName,
)}\`.`,
};
}