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.11 to 0.1.12

2

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

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

@@ -35,15 +35,19 @@ /**

const [oldVersion, newVersion] = await updateVersion();
const sameVersion = oldVersion === newVersion;
const testsPassed = await runTests();
const updatedReadme = await updateReadmeTestsBadge(testsPassed);
if (updatedReadme || !sameVersion) {
await commitAndPush();
}
const readmeUpdated = await updateReadmeTestsBadge(testsPassed);
const changedFiles = await getChangedFiles();
await commitAndPush(changedFiles);
await publish(oldVersion, newVersion);
let message = `\n${colors.gray("(not published)")} v${oldVersion} == v${newVersion}`;
if (!sameVersion) {
await publish();
message = `\n${colors.green("published!")} v${oldVersion} -> v${newVersion}`;
async function getChangedFiles(): Promise<string[]> {
console.log("getting changed files...");
const process = Bun.spawn(["git", "diff", "--name-only"], quietSpawnOptions);
const stdout = await Bun.readableStreamToText(process.stdout);
const changed = stdout.split("\n").filter(Boolean);
if (changed.length) {
console.log("changed files:");
changed.forEach((file) => console.log(`- ${file}`));
}
return changed;
}
console.log(message);

@@ -59,19 +63,35 @@ async function build() {

async function publish() {
async function publish(oldVersion: SemVer, newVersion: SemVer) {
if (oldVersion === newVersion) {
console.log(`not publishing to npm because version is still ${newVersion}`);
return;
}
console.log("publishing to npm...");
const { exited } = Bun.spawn(["npm", "publish"], quietSpawnOptions);
const exitCode = await exited;
const process = Bun.spawn(["npm", "publish"], quietSpawnOptions);
const exitCode = await process.exited;
if (exitCode !== 0) {
throw new Error("publish failed");
const stderr = await Bun.readableStreamToText(process.stderr);
throw new Error(`npm publish failed: ${stderr}`);
}
console.log(
`${colors.green("published to npm!")} 🎉 ${colors.gray(oldVersion)} → ${colors.gray(
newVersion,
)}`,
);
}
async function commitAndPush(): Promise<void> {
let process = Bun.spawn(["git", "add", "-A"], quietSpawnOptions);
async function commitAndPush(changedFiles: string[]): Promise<void> {
if (!changedFiles.length) {
console.log("no changes to commit");
return;
}
console.log("committing and pushing...");
let process = Bun.spawn(["git", "add", "."], quietSpawnOptions);
let exitCode = await process.exited;
if (exitCode !== 0) {
throw new Error("git add failed");
const stderr = await Bun.readableStreamToText(process.stderr);
throw new Error(`git add failed: ${stderr}`);
}
process = Bun.spawn(
["git", "commit", "-m", "'update version and test results badge'"],
["git", "commit", "-m", "'updated, tested'"],
quietSpawnOptions,

@@ -87,4 +107,6 @@ );

if (exitCode !== 0) {
throw new Error("git push failed");
const stderr = await Bun.readableStreamToText(process.stderr);
throw new Error(`git push failed: ${stderr}`);
}
console.log("committed and pushed to github");
}

@@ -116,5 +138,8 @@

console.log("running tests...");
const { exited } = Bun.spawn("bun test".split(" "), quietSpawnOptions);
const exitCode = await exited;
return exitCode === 0;
const process = Bun.spawn("bun test".split(" "), quietSpawnOptions);
const exitCode = await process.exited;
const passed = exitCode === 0;
let message = passed ? colors.green("tests passed!") : colors.red("tests failed!");
console.log(message);
return passed;
}

@@ -131,2 +156,3 @@

if (contents === updated) {
console.log("README.md tests badge is already up to date");
return false;

@@ -133,0 +159,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