mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2025-12-31 17:03:32 +00:00
Add comprehensive tests for shared utility modules to improve code coverage: - Test property name extraction edge cases - Test CSS property priority map with invalid groups - Test order strategy visitor creator edge cases - Test font face property order enforcer early returns - Test style node processor with arrays and null values These tests ensure all code paths in shared utilities are properly exercised, including error handling and edge cases.
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import { execSync } from 'child_process';
|
|
import { promises as fs } from 'fs';
|
|
import path from 'path';
|
|
import { argv, env } from 'process';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
|
const indexTsPath = path.resolve(__dirname, '../src/index.ts');
|
|
|
|
const versionType = argv[2] || env.VERSION_TYPE;
|
|
|
|
if (!['major', 'minor', 'patch'].includes(versionType)) {
|
|
console.error('Invalid version type. Use major, minor, or patch.');
|
|
process.exit(1);
|
|
}
|
|
|
|
execSync(`pnpm version ${versionType} --no-git-tag-version`, { stdio: 'inherit' });
|
|
|
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
|
|
const newVersion = packageJson.version;
|
|
|
|
// Read src/index.ts
|
|
let indexTsContent = await fs.readFile(indexTsPath, 'utf-8');
|
|
|
|
// Replace the version string in src/index.ts
|
|
indexTsContent = indexTsContent.replace(/version: '(\d+\.\d+\.\d+)'/, `version: '${newVersion}'`);
|
|
|
|
// Write the updated content back to src/index.ts
|
|
await fs.writeFile(indexTsPath, indexTsContent);
|
|
|
|
console.log(`Updated package.json and src/index.ts to version ${newVersion}`);
|