Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSpencer committed Jan 2, 2024
1 parent 60ff144 commit 8affd65
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions .github/canary-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ import { exec } from "child_process";
import fs from "fs";

try {
exec("git rev-parse --short HEAD", (err, stdout) => {
if (err) {
console.log(err);
process.exit(1);
}
const commitHash = stdout.trim();
exec("git rev-parse --short HEAD", (err, stdout) => {
if (err) {
console.log(err);
process.exit(1);
}
const commitHash = stdout.trim();

const pkg = JSON.parse(fs.readFileSync("package.json", "utf-8"));
const oldVersion = pkg.version;
const [major, minor, patch] = oldVersion.split(".").map(Number);
const newVersion = `${major}.${minor}.${patch + 1}-canary.${commitHash}`;
const pkg = JSON.parse(fs.readFileSync("package.json", "utf-8"));
const oldVersion = pkg.version;
const [major, minor, patch] = oldVersion.split(".").map(Number);
const newVersion = `${major}.${minor}.${patch + 1}-canary.${commitHash}`;

pkg.version = newVersion;
pkg.version = newVersion;

const content = JSON.stringify(pkg, null, "\t") + "\n";
const newContent = content
.replace(
new RegExp(`"@uploadthing/\\*": "${oldVersion}"`, "g"),
`"@uploadthing/*": "${newVersion}"`,
)
.replace(
new RegExp(`"uploadthing": "${oldVersion}"`, "g"),
`"uploadthing": "${newVersion}"`,
);
const content = `${JSON.stringify(pkg, null, "\t")}\n`;
const newContent = content
.replace(
new RegExp(`"@uploadthing/\\*": "${oldVersion}"`, "g"),
`"@uploadthing/*": "${newVersion}"`,
)
.replace(
new RegExp(`"uploadthing": "${oldVersion}"`, "g"),
`"uploadthing": "${newVersion}"`,
);

fs.writeFileSync("package.json", newContent);
});
fs.writeFileSync("package.json", newContent);
});
} catch (error) {
console.error(error);
process.exit(1);
}
console.error(error);
process.exit(1);
}

0 comments on commit 8affd65

Please sign in to comment.