chore: add code formatting config and pre-commit hooks
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const arguments_ = process.argv.slice(2);
|
||||
|
||||
if (args.length < 2) {
|
||||
if (arguments_.length < 2) {
|
||||
console.log('Usage: node update-expansion-version.js <expansion-pack-id> <new-version>');
|
||||
console.log('Example: node update-expansion-version.js bmad-creator-tools 1.1.0');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const [packId, newVersion] = args;
|
||||
const [packId, newVersion] = arguments_;
|
||||
|
||||
// Validate version format
|
||||
if (!/^\d+\.\d+\.\d+$/.test(newVersion)) {
|
||||
@@ -24,31 +22,32 @@ async function updateVersion() {
|
||||
try {
|
||||
// Update in config.yaml
|
||||
const configPath = path.join(__dirname, '..', 'expansion-packs', packId, 'config.yaml');
|
||||
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
console.error(`Error: Expansion pack '${packId}' not found`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
const configContent = fs.readFileSync(configPath, 'utf8');
|
||||
const config = yaml.load(configContent);
|
||||
const oldVersion = config.version || 'unknown';
|
||||
|
||||
|
||||
config.version = newVersion;
|
||||
|
||||
|
||||
const updatedYaml = yaml.dump(config, { indent: 2 });
|
||||
fs.writeFileSync(configPath, updatedYaml);
|
||||
|
||||
|
||||
console.log(`✓ Updated ${packId}/config.yaml: ${oldVersion} → ${newVersion}`);
|
||||
console.log(`\n✓ Successfully updated ${packId} to version ${newVersion}`);
|
||||
console.log('\nNext steps:');
|
||||
console.log('1. Test the changes');
|
||||
console.log('2. Commit: git add -A && git commit -m "chore: bump ' + packId + ' to v' + newVersion + '"');
|
||||
|
||||
console.log(
|
||||
'2. Commit: git add -A && git commit -m "chore: bump ' + packId + ' to v' + newVersion + '"',
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Error updating version:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
updateVersion();
|
||||
updateVersion();
|
||||
|
||||
Reference in New Issue
Block a user