Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

should-semantic-release

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

should-semantic-release - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

lib/getCommitMeaning.d.ts

2

lib/isReleaseCommit.js

@@ -1,2 +0,2 @@

const tester = /^(?:chore(?:\(.*\))?:?)?\s*release|v?\d+\.\d+\.\d+/;
const tester = /^(?:chore(?:\(.*\))?:?)?\s*release/;
export function isReleaseCommit(message) {

@@ -3,0 +3,0 @@ return tester.test(message);

@@ -1,5 +0,3 @@

import conventionalCommitsParser from "conventional-commits-parser";
import { isReleaseCommit } from "./isReleaseCommit.js";
import { getCommitMeaning } from "./getCommitMeaning.js";
import { execOrThrow } from "./utils.js";
const ignoredTypes = new Set(["chore", "docs"]);
export async function shouldSemanticRelease({ verbose, }) {

@@ -15,14 +13,13 @@ const rawHistory = await execOrThrow(`git log --pretty=format:"%s"`);

log(`Checking commit: ${message}`);
// If we've hit a release commit, we know we don't need to release
if (isReleaseCommit(message)) {
log(`Found a release commit. Returning false.`);
return false;
const meaning = getCommitMeaning(message);
switch (meaning) {
case "release":
log(`Found a release commit. Returning false.`);
return false;
case "meaningful":
log(`Found a meaningful commit. Returning true.`);
return true;
default:
log(`Found type ${meaning.type}. Continuing.`);
}
// Otherwise, we should release if a non-ignored commit type is found
const { type } = conventionalCommitsParser.sync(message);
if (type && !ignoredTypes.has(type)) {
log(`Found a meaningful commit. Returning true.`);
return true;
}
log(`Found type ${type}. Continuing.`);
}

@@ -29,0 +26,0 @@ // If we've seen every commit in the history and none match, don't release

@@ -6,3 +6,3 @@ {

"@pkgjs/parseargs": "^0.11.0",
"conventional-commits-parser": "^3.2.4"
"conventional-commits-parser": "^5.0.0"
},

@@ -15,7 +15,7 @@ "description": "Checks whether a semantic release should be run for a commit.",

"@typescript-eslint/parser": "^5.48.0",
"@vitest/coverage-istanbul": "^0.29.0",
"@vitest/coverage-istanbul": "^0.33.0",
"cspell": "^6.18.1",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-deprecation": "^1.3.3",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",

@@ -28,10 +28,10 @@ "eslint-plugin-jsonc": "^2.6.0",

"eslint-plugin-typescript-sort-keys": "^2.1.0",
"eslint-plugin-vitest": "^0.0.57",
"eslint-plugin-vitest": "^0.2.0",
"husky": "^8.0.3",
"jsonc-eslint-parser": "^2.1.0",
"lint-staged": "^13.1.0",
"markdownlint": "^0.28.0",
"markdownlint-cli": "^0.33.0",
"markdownlint": "^0.31.0",
"markdownlint-cli": "^0.35.0",
"npm-package-json-lint": "^6.4.0",
"npm-package-json-lint-config-default": "^5.0.0",
"npm-package-json-lint-config-default": "^6.0.0",
"pnpm-deduplicate": "^0.4.1",

@@ -54,3 +54,3 @@ "prettier": "^2.8.2",

"name": "should-semantic-release",
"packageManager": "pnpm@7.30.5",
"packageManager": "pnpm@7.33.6",
"repository": {

@@ -73,3 +73,3 @@ "type": "git",

"type": "module",
"version": "0.1.1"
"version": "0.2.0"
}

@@ -9,3 +9,3 @@ <h1 align="center">Should Semantic Release</h1>

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<img alt="All Contributors: 1" src="https://img.shields.io/badge/all_contributors-5-21bb42.svg" />
<img alt="All Contributors: 2" src="https://img.shields.io/badge/all_contributors-2-21bb42.svg" />
<!-- ALL-CONTRIBUTORS-BADGE:END -->

@@ -32,4 +32,4 @@ <!-- prettier-ignore-end -->

This CLI script determines whether a semantic release should occur for a package based on Git history.
Specifically, it returns truthy only if a commit whose type _isn't_ `chore` or `docs` has come since the most recent release commit.
This function determines whether a semantic release should occur for a package based on Git history.
It returns true if a "meaningful" commit has come since the most recent release commit.

@@ -58,2 +58,12 @@ ```shell

### Commit Purposes
Based on a commit's conventional commit message type:
1. If the type is `feat` `fix`, or `perf`, it's considered "meaningful"
2. If the type is `docs`, `refactor`, `style`, or `test`, it's ignored
3. If the message looks like `v1.2.3`, `chore: release 1.2.3`, or similar, it's considered a "release"
See [`getCommitMeaning`](./src/getCommitMeaning.ts) for the exact logic used.
### Node API

@@ -95,7 +105,4 @@

<tr>
<td align="center"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/should-semantic-release/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/should-semantic-release/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#content-JoshuaKGoldberg" title="Content">🖋</a> <a href="#example-JoshuaKGoldberg" title="Examples">💡</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="#platform-JoshuaKGoldberg" title="Packaging/porting to new platform">📦</a> <a href="#projectManagement-JoshuaKGoldberg" title="Project Management">📆</a> <a href="https://github.com/JoshuaKGoldberg/should-semantic-release/pulls?q=is%3Apr+reviewed-by%3AJoshuaKGoldberg" title="Reviewed Pull Requests">👀</a> <a href="#security-JoshuaKGoldberg" title="Security">🛡️</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/should-semantic-release/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a></td>
<td align="center"><a href="https://sinchang.me"><img src="https://avatars.githubusercontent.com/u/3297859?v=4?s=100" width="100px;" alt="Jeff Wen"/><br /><sub><b>Jeff Wen</b></sub></a><br /><a href="#tool-sinchang" title="Tools">🔧</a></td>
<td align="center"><a href="https://paulisaweso.me/"><img src="https://avatars.githubusercontent.com/u/6335792?v=4?s=100" width="100px;" alt="Paul Esch-Laurent"/><br /><sub><b>Paul Esch-Laurent</b></sub></a><br /><a href="#tool-Pinjasaur" title="Tools">🔧</a></td>
<td align="center"><a href="https://github.com/NazCodeland"><img src="https://avatars.githubusercontent.com/u/113494366?v=4?s=100" width="100px;" alt="NazCodeland"/><br /><sub><b>NazCodeland</b></sub></a><br /><a href="#tool-NazCodeland" title="Tools">🔧</a></td>
<td align="center"><a href="https://blog.johnnyreilly.com/"><img src="https://avatars.githubusercontent.com/u/1010525?v=4?s=100" width="100px;" alt="John Reilly"/><br /><sub><b>John Reilly</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/should-semantic-release/issues?q=author%3Ajohnnyreilly" title="Bug reports">🐛</a> <a href="#ideas-johnnyreilly" title="Ideas, Planning, & Feedback">🤔</a> <a href="#promotion-johnnyreilly" title="Promotion">📣</a> <a href="#maintenance-johnnyreilly" title="Maintenance">🚧</a> <a href="https://github.com/JoshuaKGoldberg/should-semantic-release/commits?author=johnnyreilly" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/should-semantic-release/pulls?q=is%3Apr+reviewed-by%3Ajohnnyreilly" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://medium.com/@cakeinpanic/latest"><img src="https://avatars.githubusercontent.com/u/588916?v=4?s=100" width="100px;" alt="Katya Pavlenko"/><br /><sub><b>Katya Pavlenko</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/should-semantic-release/commits?author=cakeinpanic" title="Code">💻</a></td>
</tr>

@@ -102,0 +109,0 @@ </tbody>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc