Files
bab-app/generate-version.js
Patrick Toal ea4e848e57
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m4s
fix: make build process work
2024-06-24 09:48:24 -04:00

23 lines
744 B
JavaScript

const fs = require('fs');
const path = require('path');
try {
const version = process.argv[2];
if (!version) throw Error('Must pass version on command line');
// Create version content
const versionContent = `export const APP_VERSION = '${version}';\n`;
const versionTxtFilePath = path.resolve(__dirname, './VERSION');
const versionFilePath = path.resolve(__dirname, 'src/version.js');
// Write version to TXT file
fs.writeFileSync(versionTxtFilePath, version, 'utf8');
// Write version to js file
fs.writeFileSync(versionFilePath, versionContent, 'utf8');
console.log(`Version file generated with version: ${version}`);
} catch (error) {
console.error('Error generating version file:', error);
process.exit(1);
}