Skip to content

Commit

Permalink
0.0.258 - fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
nahoc committed Dec 19, 2024
1 parent 94c1f6f commit 07778be
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
10 changes: 10 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

VERSION=$(grep -o '"version": "[^"]*"' package.json | cut -d'"' -f4)
COMMIT_MSG_FILE=$1
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")

# Only prepend version if it's not already there
if [[ ! $COMMIT_MSG =~ ^$VERSION ]]; then
echo "$VERSION - $COMMIT_MSG" > "$COMMIT_MSG_FILE"
fi
13 changes: 0 additions & 13 deletions .husky/prepare-commit-msg

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ https://www.npmjs.com/package/@risc0/ui

| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](https://img.shields.io/badge/statements-41.79%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-79.71%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-73.8%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-41.79%25-red.svg?style=flat) |
| ![Statements](https://img.shields.io/badge/statements-41.01%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-78.57%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-72.09%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-41.01%25-red.svg?style=flat) |
23 changes: 23 additions & 0 deletions commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { execSync } from "child_process";
import { readFileSync } from "fs";

const packageJson = JSON.parse(readFileSync("./package.json", "utf8"));
const version = packageJson.version;

// Get the commit message from command line arguments
const commitMessage = process.argv.slice(2).join(" ");

if (!commitMessage) {
console.error("Please provide a commit message");
process.exit(1);
}

// Create the versioned commit message
const versionedMessage = `${version} - ${commitMessage}`;

// Execute the git commit command
try {
execSync(`git commit -m "${versionedMessage}"`, { stdio: "inherit" });
} catch (_error) {
process.exit(1);
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@risc0/ui",
"version": "0.0.257",
"version": "0.0.258",
"private": false,
"sideEffects": false,
"type": "module",
Expand All @@ -9,6 +9,7 @@
"check:test": "vitest run --silent --coverage && istanbul-badges-readme",
"check:types": "tsc",
"check:version": "bunx changelogen --bump --no-output",
"commit": "node scripts/commit.js",
"pre-commit": "run-p check:*",
"prepare": "npx husky",
"sort-package": "bunx sort-package-json 'package.json'",
Expand Down

0 comments on commit 07778be

Please sign in to comment.