Skip to content

Commit

Permalink
chore(deps): update dependency prettier to v3 (#665)
Browse files Browse the repository at this point in the history
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
  • Loading branch information
renovate[bot] and gr2m committed Jul 5, 2023
1 parent 95ec83b commit b63747e
Show file tree
Hide file tree
Showing 26 changed files with 763 additions and 763 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Each label name is generated with [Lodash template](https://lodash.com/docs#temp

##### releasedLabels example

The `releasedLabels` `` ['released<%= nextRelease.channel ? ` on @\${nextRelease.channel}` : "" %> from <%= branch.name %>'] `` will generate the label:
The `releasedLabels` ``['released<%= nextRelease.channel ? ` on @\${nextRelease.channel}` : "" %> from <%= branch.name %>']`` will generate the label:

> released on @next from branch next
Expand Down
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ let verified;
export async function verifyConditions(
pluginConfig,
context,
{ Octokit = SemanticReleaseOctokit } = {}
{ Octokit = SemanticReleaseOctokit } = {},
) {
const { options } = context;
// If the GitHub publish plugin is used and has `assets`, `successComment`, `failComment`, `failTitle`, `labels` or `assignees` configured, validate it now in order to prevent any release if the configuration is wrong
if (options.publish) {
const publishPlugin =
castArray(options.publish).find(
(config) => config.path && config.path === "@semantic-release/github"
(config) => config.path && config.path === "@semantic-release/github",
) || {};

pluginConfig.assets = defaultTo(pluginConfig.assets, publishPlugin.assets);
pluginConfig.successComment = defaultTo(
pluginConfig.successComment,
publishPlugin.successComment
publishPlugin.successComment,
);
pluginConfig.failComment = defaultTo(
pluginConfig.failComment,
publishPlugin.failComment
publishPlugin.failComment,
);
pluginConfig.failTitle = defaultTo(
pluginConfig.failTitle,
publishPlugin.failTitle
publishPlugin.failTitle,
);
pluginConfig.labels = defaultTo(pluginConfig.labels, publishPlugin.labels);
pluginConfig.assignees = defaultTo(
pluginConfig.assignees,
publishPlugin.assignees
publishPlugin.assignees,
);
}

Expand All @@ -51,7 +51,7 @@ export async function verifyConditions(
export async function publish(
pluginConfig,
context,
{ Octokit = SemanticReleaseOctokit } = {}
{ Octokit = SemanticReleaseOctokit } = {},
) {
if (!verified) {
await verifyGitHub(pluginConfig, context, { Octokit });
Expand All @@ -64,7 +64,7 @@ export async function publish(
export async function addChannel(
pluginConfig,
context,
{ Octokit = SemanticReleaseOctokit } = {}
{ Octokit = SemanticReleaseOctokit } = {},
) {
if (!verified) {
await verifyGitHub(pluginConfig, context, { Octokit });
Expand All @@ -77,7 +77,7 @@ export async function addChannel(
export async function success(
pluginConfig,
context,
{ Octokit = SemanticReleaseOctokit } = {}
{ Octokit = SemanticReleaseOctokit } = {},
) {
if (!verified) {
await verifyGitHub(pluginConfig, context, { Octokit });
Expand All @@ -90,7 +90,7 @@ export async function success(
export async function fail(
pluginConfig,
context,
{ Octokit = SemanticReleaseOctokit } = {}
{ Octokit = SemanticReleaseOctokit } = {},
) {
if (!verified) {
await verifyGitHub(pluginConfig, context, { Octokit });
Expand Down
6 changes: 3 additions & 3 deletions lib/add-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function addChannel(pluginConfig, context, { Octokit }) {
} = context;
const { githubToken, githubUrl, githubApiPathPrefix, proxy } = resolveConfig(
pluginConfig,
context
context,
);
const { owner, repo } = parseGithubUrl(repositoryUrl);
const octokit = new Octokit(
Expand All @@ -26,7 +26,7 @@ export default async function addChannel(pluginConfig, context, { Octokit }) {
githubUrl,
githubApiPathPrefix,
proxy,
})
}),
);
let releaseId;

Expand Down Expand Up @@ -72,7 +72,7 @@ export default async function addChannel(pluginConfig, context, { Octokit }) {
data: { html_url: url },
} = await octokit.request(
"PATCH /repos/{owner}/{repo}/releases/{release_id}",
{ ...release, release_id: releaseId }
{ ...release, release_id: releaseId },
);

logger.log("Updated GitHub release: %s", url);
Expand Down
42 changes: 21 additions & 21 deletions lib/definitions/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function EINVALIDASSETS({ assets }) {
return {
message: "Invalid `assets` option.",
details: `The [assets option](${linkify(
"README.md#assets"
"README.md#assets",
)}) must be an \`Array\` of \`Strings\` or \`Objects\` with a \`path\` property.
Your configuration for the \`assets\` option is \`${stringify(assets)}\`.`,
Expand All @@ -32,11 +32,11 @@ export function EINVALIDSUCCESSCOMMENT({ successComment }) {
return {
message: "Invalid `successComment` option.",
details: `The [successComment option](${linkify(
"README.md#successcomment"
"README.md#successcomment",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`successComment\` option is \`${stringify(
successComment
successComment,
)}\`.`,
};
}
Expand All @@ -45,11 +45,11 @@ export function EINVALIDFAILTITLE({ failTitle }) {
return {
message: "Invalid `failTitle` option.",
details: `The [failTitle option](${linkify(
"README.md#failtitle"
"README.md#failtitle",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`failTitle\` option is \`${stringify(
failTitle
failTitle,
)}\`.`,
};
}
Expand All @@ -58,11 +58,11 @@ export function EINVALIDFAILCOMMENT({ failComment }) {
return {
message: "Invalid `failComment` option.",
details: `The [failComment option](${linkify(
"README.md#failcomment"
"README.md#failcomment",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`failComment\` option is \`${stringify(
failComment
failComment,
)}\`.`,
};
}
Expand All @@ -71,7 +71,7 @@ export function EINVALIDLABELS({ labels }) {
return {
message: "Invalid `labels` option.",
details: `The [labels option](${linkify(
"README.md#options"
"README.md#options",
)}) if defined, must be an \`Array\` of non empty \`String\`.
Your configuration for the \`labels\` option is \`${stringify(labels)}\`.`,
Expand All @@ -82,11 +82,11 @@ export function EINVALIDASSIGNEES({ assignees }) {
return {
message: "Invalid `assignees` option.",
details: `The [assignees option](${linkify(
"README.md#options"
"README.md#options",
)}) must be an \`Array\` of non empty \`Strings\`.
Your configuration for the \`assignees\` option is \`${stringify(
assignees
assignees,
)}\`.`,
};
}
Expand All @@ -95,11 +95,11 @@ export function EINVALIDRELEASEDLABELS({ releasedLabels }) {
return {
message: "Invalid `releasedLabels` option.",
details: `The [releasedLabels option](${linkify(
"README.md#options"
"README.md#options",
)}) if defined, must be an \`Array\` of non empty \`String\`.
Your configuration for the \`releasedLabels\` option is \`${stringify(
releasedLabels
releasedLabels,
)}\`.`,
};
}
Expand All @@ -108,11 +108,11 @@ export function EINVALIDADDRELEASES({ addReleases }) {
return {
message: "Invalid `addReleases` option.",
details: `The [addReleases option](${linkify(
"README.md#options"
"README.md#options",
)}) if defined, must be one of \`false|top|bottom\`.
Your configuration for the \`addReleases\` option is \`${stringify(
addReleases
addReleases,
)}\`.`,
};
}
Expand All @@ -121,11 +121,11 @@ export function EINVALIDDRAFTRELEASE({ draftRelease }) {
return {
message: "Invalid `draftRelease` option.",
details: `The [draftRelease option](${linkify(
"README.md#options"
"README.md#options",
)}) if defined, must be a \`Boolean\`.
Your configuration for the \`draftRelease\` option is \`${stringify(
draftRelease
draftRelease,
)}\`.`,
};
}
Expand All @@ -143,7 +143,7 @@ export function EINVALIDPROXY({ proxy }) {
return {
message: "Invalid `proxy` option.",
details: `The [proxy option](${linkify(
"README.md#proxy"
"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)}\`.`,
Expand All @@ -158,7 +158,7 @@ export function EMISSINGREPO({ owner, repo }) {
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"
"README.md#options",
)}).`,
};
}
Expand All @@ -167,7 +167,7 @@ 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"
"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 reposotory 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).`,
Expand All @@ -178,7 +178,7 @@ export function EINVALIDGHTOKEN({ owner, repo }) {
return {
message: "Invalid GitHub token.",
details: `The [GitHub token](${linkify(
"README.md#github-authentication"
"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.`,
Expand All @@ -189,7 +189,7 @@ export function ENOGHTOKEN({ owner, repo }) {
return {
message: "No GitHub token specified.",
details: `A [GitHub personal token](${linkify(
"README.md#github-authentication"
"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}.`,
Expand Down
6 changes: 3 additions & 3 deletions lib/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export default async function fail(pluginConfig, context, { Octokit }) {
logger.log("Skip issue creation.");
} else {
const octokit = new Octokit(
toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy })
toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy }),
);
// In case the repo changed name, get the new `repo`/`owner` as the search API will not follow redirects
const { data: repoData } = await octokit.request(
"GET /repos/{owner}/{repo}",
parseGithubUrl(repositoryUrl)
parseGithubUrl(repositoryUrl),
);
const [owner, repo] = repoData.full_name.split("/");
const body = failComment
Expand All @@ -53,7 +53,7 @@ export default async function fail(pluginConfig, context, { Octokit }) {
data: { html_url: url },
} = await octokit.request(
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
comment
comment,
);
logger.log("Added comment to issue #%d: %s.", srIssue.number, url);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/get-release-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const linkify = (releaseInfo) =>

const filterReleases = (releaseInfos) =>
releaseInfos.filter(
(releaseInfo) => releaseInfo.name && releaseInfo.name !== RELEASE_NAME
(releaseInfo) => releaseInfo.name && releaseInfo.name !== RELEASE_NAME,
);

export default function getReleaseLinks(releaseInfos) {
Expand Down
6 changes: 3 additions & 3 deletions lib/glob-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default async function globAssets({ cwd }, assets) {
if (glob.length <= 1 && glob[0].startsWith("!")) {
debug(
"skipping the negated glob %o as its alone in its group and would retrieve a large amount of files",
glob[0]
glob[0],
);
return [];
}
Expand Down Expand Up @@ -62,7 +62,7 @@ export default async function globAssets({ cwd }, assets) {

// If asset is a String definition but no match is found, output the elements of the original glob (each one will be considered as a missing file)
return glob;
})
}),
// Sort with Object first, to prioritize Object definition over Strings in dedup
)
)
Expand All @@ -71,6 +71,6 @@ export default async function globAssets({ cwd }, assets) {
// Compare `path` property if Object definition, value itself if String
(a, b) =>
resolve(cwd, isPlainObject(a) ? a.path : a) ===
resolve(cwd, isPlainObject(b) ? b.path : b)
resolve(cwd, isPlainObject(b) ? b.path : b),
);
}
4 changes: 2 additions & 2 deletions lib/octokit.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const pkg = require("../package.json");

const onRetry = (retryAfter, options, octokit, retryCount) => {
octokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
`Request quota exhausted for request ${options.method} ${options.url}`,
);

if (retryCount <= RETRY_CONF.retries) {
Expand All @@ -36,7 +36,7 @@ const onRetry = (retryAfter, options, octokit, retryCount) => {
export const SemanticReleaseOctokit = Octokit.plugin(
paginateRest,
retry,
throttling
throttling,
).defaults({
userAgent: `@semantic-release/github v${pkg.version}`,
retry: RETRY_CONF,
Expand Down
6 changes: 3 additions & 3 deletions lib/parse-github-url.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export default function parseGitHubUrl(repositoryUrl) {
const [match, auth, host, path] =
/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<path>.*)$/.exec(
repositoryUrl
repositoryUrl,
) || [];
try {
const [, owner, repo] =
/^\/(?<owner>[^/]+)?\/?(?<repo>.+?)(?:\.git)?$/.exec(
new URL(
match
? `ssh://${auth ? `${auth}@` : ""}${host}/${path}`
: repositoryUrl
).pathname
: repositoryUrl,
).pathname,
);
return { owner, repo };
} catch {
Expand Down
Loading

0 comments on commit b63747e

Please sign in to comment.