forked from Matdata-eu/Yasgui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdateVersion.js
More file actions
27 lines (22 loc) · 997 Bytes
/
updateVersion.js
File metadata and controls
27 lines (22 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Updates the version.ts file with the current version from package.json
* This script is automatically run during the build process
*/
import * as fs from "fs";
import * as path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Read the package.json version
const packageJsonPath = path.join(__dirname, "packages", "yasgui", "package.json");
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
const version = packageJson.version;
// Generate the version.ts content
const versionTsContent = `// Version information for YASGUI
// This file is auto-generated during build - do not edit manually
export const VERSION = "${version}";
`;
// Write the version.ts file
const versionTsPath = path.join(__dirname, "packages", "yasgui", "src", "version.ts");
fs.writeFileSync(versionTsPath, versionTsContent, "utf-8");
console.log(`✓ Updated version.ts to v${version}`);