feat(scripts): 2 new scripts for the build process
This commit is contained in:
24
scripts/read-build-number.js
Normal file
24
scripts/read-build-number.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* This is for release-it to be able to post the new build number in the releases
|
||||
*/
|
||||
|
||||
import fs from "fs-extra";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
async function readBuildNumber() {
|
||||
try {
|
||||
const buildNumberPath = path.resolve(__dirname, "../BUILD_NUMBER");
|
||||
const buildNumber = (await fs.readFile(buildNumberPath, "utf8")).trim();
|
||||
process.env.BUILD_NUMBER = buildNumber;
|
||||
console.log(`Build number: ${buildNumber}`);
|
||||
} catch (error) {
|
||||
console.error("Error reading BUILD_NUMBER:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
readBuildNumber();
|
||||
Reference in New Issue
Block a user