initial commit
This commit is contained in:
21
scripts/generate-version.js
Normal file
21
scripts/generate-version.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved.
|
||||
*/
|
||||
import {writeFileSync} from 'fs';
|
||||
import {join} from 'path';
|
||||
import {program} from 'commander';
|
||||
import packageJson from './../package.json' with {type: 'json'};
|
||||
|
||||
program.option('-e --environment <environment>', 'Specific environment (optional)');
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
const {environment} = program.opts();
|
||||
const prefix = environment ? `${environment}-` : 'local-';
|
||||
const version = `${prefix}${new Date().toISOString()} (${packageJson.version})`;
|
||||
const fileLocation = join(process.cwd(), 'src', 'config', 'version.json');
|
||||
const controlVersion = {version};
|
||||
|
||||
writeFileSync(fileLocation, JSON.stringify(controlVersion, null, 2));
|
||||
|
||||
console.log(`Generated control center version [${version}]`);
|
||||
Reference in New Issue
Block a user