import { writeFileSync, readFileSync } from 'fs'; // Get the path to package.json and output location from the command line arguments const packageJsonPath = process.argv[2] || './package.json'; const outputPath = process.argv[3] || './src/version.ts'; // Read the package.json and extract the version const packageJsonContent = readFileSync(packageJsonPath, 'utf-8'); const { version, name } = JSON.parse(packageJsonContent); // Generate the TypeScript content const content = `// This is an auto-generated file. Do not edit.\n\nexport const VERSION = '${name}:${version}';\n`; // Write to the specified output file writeFileSync(outputPath, content);