semantic-release
Advanced tools
Comparing version 22.0.12 to 23.0.0
# Node version requirement | ||
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which **requires Node version 18.0.0 or higher**. | ||
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which **requires Node version 20.8.1 or higher**. | ||
@@ -5,0 +5,0 @@ **semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency. |
11
index.js
@@ -126,3 +126,3 @@ import { createRequire } from "node:module"; | ||
} else { | ||
await addNote({ channels: [...currentRelease.channels, nextRelease.channel] }, nextRelease.gitHead, { | ||
await addNote({ channels: [...currentRelease.channels, nextRelease.channel] }, nextRelease.gitTag, { | ||
cwd, | ||
@@ -132,3 +132,6 @@ env, | ||
await push(options.repositoryUrl, { cwd, env }); | ||
await pushNotes(options.repositoryUrl, { cwd, env }); | ||
await pushNotes(options.repositoryUrl, nextRelease.gitTag, { | ||
cwd, | ||
env, | ||
}); | ||
logger.success( | ||
@@ -208,5 +211,5 @@ `Add ${nextRelease.channel ? `channel ${nextRelease.channel}` : "default channel"} to tag ${ | ||
await tag(nextRelease.gitTag, nextRelease.gitHead, { cwd, env }); | ||
await addNote({ channels: [nextRelease.channel] }, nextRelease.gitHead, { cwd, env }); | ||
await addNote({ channels: [nextRelease.channel] }, nextRelease.gitTag, { cwd, env }); | ||
await push(options.repositoryUrl, { cwd, env }); | ||
await pushNotes(options.repositoryUrl, { cwd, env }); | ||
await pushNotes(options.repositoryUrl, nextRelease.gitTag, { cwd, env }); | ||
logger.success(`Created tag ${nextRelease.gitTag}`); | ||
@@ -213,0 +216,0 @@ } |
@@ -5,2 +5,3 @@ import gitLogParser from "git-log-parser"; | ||
import debugGit from "debug"; | ||
import { merge } from "lodash-es"; | ||
import { GIT_NOTE_REF } from "./definitions/constants.js"; | ||
@@ -145,9 +146,5 @@ | ||
try { | ||
await execa( | ||
"git", | ||
["fetch", "--unshallow", repositoryUrl, `+refs/notes/${GIT_NOTE_REF}:refs/notes/${GIT_NOTE_REF}`], | ||
execaOptions | ||
); | ||
await execa("git", ["fetch", "--unshallow", repositoryUrl, `+refs/notes/*:refs/notes/*`], execaOptions); | ||
} catch { | ||
await execa("git", ["fetch", repositoryUrl, `+refs/notes/${GIT_NOTE_REF}:refs/notes/${GIT_NOTE_REF}`], { | ||
await execa("git", ["fetch", repositoryUrl, `+refs/notes/*:refs/notes/*`], { | ||
...execaOptions, | ||
@@ -251,4 +248,4 @@ reject: false, | ||
*/ | ||
export async function pushNotes(repositoryUrl, execaOptions) { | ||
await execa("git", ["push", repositoryUrl, `refs/notes/${GIT_NOTE_REF}`], execaOptions); | ||
export async function pushNotes(repositoryUrl, ref, execaOptions) { | ||
await execa("git", ["push", repositoryUrl, `refs/notes/${GIT_NOTE_REF}-${ref}`], execaOptions); | ||
} | ||
@@ -313,4 +310,22 @@ | ||
export async function getNote(ref, execaOptions) { | ||
const handleError = (error) => { | ||
if (error.exitCode === 1) { | ||
return { stdout: "{}" }; | ||
} | ||
debug(error); | ||
throw error; | ||
}; | ||
try { | ||
return JSON.parse((await execa("git", ["notes", "--ref", GIT_NOTE_REF, "show", ref], execaOptions)).stdout); | ||
return merge( | ||
JSON.parse( | ||
// Used for retro-compatibility | ||
(await execa("git", ["notes", "--ref", GIT_NOTE_REF, "show", ref], execaOptions).catch(handleError)).stdout | ||
), | ||
JSON.parse( | ||
(await execa("git", ["notes", "--ref", `${GIT_NOTE_REF}-${ref}`, "show", ref], execaOptions).catch(handleError)) | ||
.stdout | ||
) | ||
); | ||
} catch (error) { | ||
@@ -334,3 +349,17 @@ if (error.exitCode === 1) { | ||
export async function addNote(note, ref, execaOptions) { | ||
await execa("git", ["notes", "--ref", GIT_NOTE_REF, "add", "-f", "-m", JSON.stringify(note), ref], execaOptions); | ||
await execa( | ||
"git", | ||
["notes", "--ref", `${GIT_NOTE_REF}-${ref}`, "add", "-f", "-m", JSON.stringify(note), ref], | ||
execaOptions | ||
); | ||
} | ||
/** | ||
* Get the reference of a tag | ||
* | ||
* @param {String} tag The tag name to get the reference of. | ||
* @param {Object} [execaOpts] Options to pass to `execa`. | ||
**/ | ||
export async function getTagRef(tag, execaOptions) { | ||
return (await execa("git", ["show-ref", tag, "--hash"], execaOptions)).stdout; | ||
} |
{ | ||
"name": "semantic-release", | ||
"description": "Automated semver compliant package publishing", | ||
"version": "22.0.12", | ||
"version": "23.0.0", | ||
"type": "module", | ||
@@ -36,5 +36,5 @@ "author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)", | ||
"aggregate-error": "^5.0.0", | ||
"cosmiconfig": "^8.0.0", | ||
"cosmiconfig": "^9.0.0", | ||
"debug": "^4.0.0", | ||
"env-ci": "^10.0.0", | ||
"env-ci": "^11.0.0", | ||
"execa": "^8.0.0", | ||
@@ -49,3 +49,3 @@ "figures": "^6.0.0", | ||
"lodash-es": "^4.17.21", | ||
"marked": "^9.0.0", | ||
"marked": "^11.0.0", | ||
"marked-terminal": "^6.0.0", | ||
@@ -64,7 +64,7 @@ "micromatch": "^4.0.2", | ||
"ava": "6.0.1", | ||
"c8": "8.0.1", | ||
"c8": "9.0.0", | ||
"clear-module": "4.1.2", | ||
"codecov": "3.8.3", | ||
"cz-conventional-changelog": "3.3.0", | ||
"dockerode": "4.0.0", | ||
"dockerode": "4.0.2", | ||
"file-url": "4.0.0", | ||
@@ -79,5 +79,5 @@ "fs-extra": "11.2.0", | ||
"npm-run-all2": "6.1.1", | ||
"p-retry": "6.1.0", | ||
"p-retry": "6.2.0", | ||
"prettier": "3.1.1", | ||
"publint": "0.2.6", | ||
"publint": "0.2.7", | ||
"sinon": "17.0.1", | ||
@@ -89,3 +89,3 @@ "stream-buffers": "3.0.2", | ||
"engines": { | ||
"node": "^18.17 || >=20.6.1" | ||
"node": ">=20.8.1" | ||
}, | ||
@@ -167,5 +167,5 @@ "files": [ | ||
"extends": [ | ||
"github>semantic-release/.github" | ||
"github>semantic-release/.github:renovate-config" | ||
] | ||
} | ||
} |
@@ -113,5 +113,5 @@ <h1 align="center" style="border-bottom: none;">📦🚀 semantic-release</h1> | ||
- Usage | ||
- [Getting started](docs/usage/getting-started.md#getting-started) | ||
- [Installation](docs/usage/installation.md#installation) | ||
- [CI Configuration](docs/usage/ci-configuration.md#ci-configuration) | ||
- [Getting started](docs/usage/getting-started.md) | ||
- [Installation](docs/usage/installation.md) | ||
- [CI Configuration](docs/usage/ci-configuration.md) | ||
- [Configuration](docs/usage/configuration.md#configuration) | ||
@@ -118,0 +118,0 @@ - [Plugins](docs/usage/plugins.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
283919
2648
+ Addedcosmiconfig@9.0.0(transitive)
+ Addedenv-ci@11.1.0(transitive)
+ Addedenv-paths@2.2.1(transitive)
+ Addedmarked@11.2.0(transitive)
- Removedcosmiconfig@8.3.6(transitive)
- Removedenv-ci@10.0.0(transitive)
- Removedmarked@9.1.6(transitive)
Updatedcosmiconfig@^9.0.0
Updatedenv-ci@^11.0.0
Updatedmarked@^11.0.0