chore: add code formatting config and pre-commit hooks (#450)

This commit is contained in:
manjaroblack
2025-08-16 19:08:39 -05:00
committed by GitHub
parent 51284d6ecf
commit ed539432fb
130 changed files with 11886 additions and 10939 deletions

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env node
const fs = require('fs');
const { execSync } = require('child_process');
const path = require('path');
const fs = require('node:fs');
const { execSync } = require('node:child_process');
const path = require('node:path');
// Dynamic import for ES module
let chalk;
@@ -26,7 +24,7 @@ function getCurrentVersion() {
async function bumpVersion(type = 'patch') {
await initializeModules();
const validTypes = ['patch', 'minor', 'major'];
if (!validTypes.includes(type)) {
console.error(chalk.red(`Invalid version type: ${type}. Use: ${validTypes.join(', ')}`));
@@ -43,37 +41,37 @@ async function bumpVersion(type = 'patch') {
console.log('');
console.log(chalk.dim('Example: git commit -m "feat: add new installer features"'));
console.log(chalk.dim('Then push to main branch to trigger automatic release.'));
return null;
}
async function main() {
await initializeModules();
const type = process.argv[2] || 'patch';
const currentVersion = getCurrentVersion();
console.log(chalk.blue(`Current version: ${currentVersion}`));
// Check if working directory is clean
try {
execSync('git diff-index --quiet HEAD --');
} catch (error) {
} catch {
console.error(chalk.red('❌ Working directory is not clean. Commit your changes first.'));
process.exit(1);
}
const newVersion = await bumpVersion(type);
console.log(chalk.green(`\n🎉 Version bump complete!`));
console.log(chalk.blue(`📦 ${currentVersion}${newVersion}`));
}
if (require.main === module) {
main().catch(error => {
main().catch((error) => {
console.error('Error:', error);
process.exit(1);
});
}
module.exports = { bumpVersion, getCurrentVersion };
module.exports = { bumpVersion, getCurrentVersion };