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

hjsx

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hjsx - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

2

package.json
{
"name": "hjsx",
"version": "0.1.10",
"version": "0.1.11",
"module": "hjsx.ts",

@@ -5,0 +5,0 @@ "main": "hjsx.js",

@@ -0,1 +1,9 @@

/**
* This script is used to do the following:
* 1. Build the project
* 2. Update the version in package.json
* 3. Run tests
* 4. Commit and push changes
*/
import { colors } from "./util";

@@ -27,11 +35,15 @@ import { parseArgs } from "node:util";

const [oldVersion, newVersion] = await updateVersion();
await runTests();
await commitAndPush();
const sameVersion = oldVersion === newVersion;
const testsPassed = await runTests();
const updatedReadme = await updateReadmeTestsBadge(testsPassed);
if (updatedReadme || !sameVersion) {
await commitAndPush();
}
if (oldVersion !== newVersion) {
let message = `\n${colors.gray("(not published)")} v${oldVersion} == v${newVersion}`;
if (!sameVersion) {
await publish();
console.log(`\n${colors.green("published!")} v${oldVersion} -> v${newVersion}`);
} else {
console.log(`\n${colors.gray("(not published)")} v${oldVersion} == v${newVersion}`);
message = `\n${colors.green("published!")} v${oldVersion} -> v${newVersion}`;
}
console.log(message);

@@ -100,12 +112,12 @@ async function build() {

async function runTests() {
async function runTests(): Promise<boolean> {
console.log("running tests...");
const { exited } = Bun.spawn("bun test".split(" "), quietSpawnOptions);
const exitCode = await exited;
const text = exitCode === 0 ? "passing" : "failing";
const color = exitCode === 0 ? "green" : "red";
return updateReadmeTestsBadge(text, color);
return exitCode === 0;
}
async function updateReadmeTestsBadge(text: string, color: string) {
async function updateReadmeTestsBadge(testsPassed: boolean): Promise<boolean> {
const color = testsPassed ? "green" : "red";
const text = testsPassed ? "passing" : "failing";
console.log("updating README.md tests badge...");

@@ -116,5 +128,9 @@ const link = `![tests](https://img.shields.io/badge/tests-${text}-${color}?style=for-the-badge)`;

const updated = contents.replace(/!\[tests\].+/, link);
if (contents === updated) {
return false;
}
const writer = file.writer();
writer.write(updated);
await writer.end();
return true;
}

@@ -121,0 +137,0 @@

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