mirror of
https://github.com/LukeHagar/skeleton.git
synced 2025-12-06 20:57:44 +00:00
* added scripts and deps * added version script for dev tag release * added action scripts * ignore dist and .temp files * added changeset config * format + lint * dont need that * simple cache * reverting back, this cache was more consistent * changed names * repo check * ignore empty arrow functions * fixed lint errors * added action to lint on PRs * added CSA * lockfile * update tw-settings.json after publish * ignore tw-settings.json in prettier * weird spacing that was breaking the ingore * added ignore path * ignore .vercel dir during formatting/linting * fixed line dupe on format * fix linting errors * fixed svelte check errors * added VERCEL_ENV for svelte-check * run both lint and check in parallel
31 lines
761 B
JavaScript
31 lines
761 B
JavaScript
import fs from "fs";
|
|
import { exec } from "child_process";
|
|
|
|
const pkgJsonPaths = ["packages/skeleton/package.json"];
|
|
|
|
try {
|
|
exec("git rev-parse --short HEAD", (err, stdout) => {
|
|
if (err) {
|
|
console.log(err);
|
|
process.exit(1);
|
|
}
|
|
const commitHash = stdout.trim();
|
|
|
|
for (const pkgJsonPath of pkgJsonPaths) {
|
|
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
const oldVersion = pkg.version;
|
|
const [major, minor, patch] = oldVersion.split(".").map(Number);
|
|
const newVersion = `${major}.${minor}.${patch}-dev.${commitHash}`;
|
|
|
|
pkg.version = newVersion;
|
|
|
|
const content = JSON.stringify(pkg, null, "\t") + "\n";
|
|
|
|
fs.writeFileSync(pkgJsonPath, content);
|
|
}
|
|
});
|
|
} catch (error) {
|
|
console.error(error);
|
|
process.exit(1);
|
|
}
|