
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
@reliverse/bleregex
Advanced tools
@reliverse/bleregex is a collection of various useful regexes for javascript and typescript
@reliverse/bleregex: a collection of various useful regexes for javascript and typescript
bun add @reliverse/bleregex
import { VERSION_PATTERNS } from "@reliverse/bleregex";
/**
* Updates version strings in a file's content.
*/
async function updateVersionInContent(
filePath: string,
content: string,
oldVersion: string,
newVersion: string,
): Promise<boolean> {
let updatedContent = content;
let changed = false;
// Debug: Log which file is being checked and what patterns are being used
relinka("verbose", `[updateVersionInContent] Checking file: ${filePath}`);
if (/\.(json|jsonc|json5)$/.test(filePath)) {
const jsonPattern = VERSION_PATTERNS.find((p) => p.id === "json-version");
if (jsonPattern && content.includes(`"version": "${oldVersion}"`)) {
relinka(
"verbose",
`[updateVersionInContent] JSON pattern matched in: ${filePath}`,
);
updatedContent = content.replace(
jsonPattern.pattern(oldVersion),
`"version": "${newVersion}"`,
);
changed = true;
}
} else if (filePath.endsWith(".ts")) {
const tsPatterns = VERSION_PATTERNS.filter((p) => p.id.startsWith("ts-"));
for (const { id, pattern } of tsPatterns) {
const regex = pattern(oldVersion);
if (regex.test(updatedContent)) {
relinka(
"verbose",
`[updateVersionInContent] Pattern '${id}' matched in: ${filePath}`,
);
updatedContent = updatedContent.replace(regex, `$1${newVersion}$2`);
changed = true;
} else {
relinka(
"verbose",
`[updateVersionInContent] Pattern '${id}' did NOT match in: ${filePath}`,
);
}
}
}
if (changed) {
relinka(
"verbose",
`[updateVersionInContent] Version updated in: ${filePath}`,
);
await writeFileSafe(filePath, updatedContent, "version update");
} else {
relinka(
"verbose",
`[updateVersionInContent] No version updated in: ${filePath}`,
);
}
return changed;
}
MIT © Nazar Kornienko (blefnk), Reliverse
FAQs
@reliverse/bleregex is a collection of various useful regexes for javascript and typescript
We found that @reliverse/bleregex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.