alamion_obsidian-jira-sync/check-version.js
Alamion 67d19a5b34
Small feats
- Changed default filename template from "{summary} [{key}]" to "{summary} ({key})", so there should be less problems with inline md links
- Took the filename option to fetch settings section so you can configure it yourself
- Added husky precommit check, so I won't forget to bump versions of plugin anymore
2025-12-12 22:45:39 +03:00

44 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
const { execSync } = require('child_process');
const stagedFiles = execSync('git diff --cached --name-only', { encoding: 'utf-8' })
.trim()
.split('\n')
.filter(Boolean);
const hasCodeChanges = stagedFiles.some(file =>
file.endsWith('.ts') ||
file.endsWith('.tsx')
);
const manifestChanged = stagedFiles.includes('manifest.json');
if (hasCodeChanges && !manifestChanged) {
console.error('\x1b[33m⚠ You have changed the code but have not updated manifest.json.\x1b[0m');
console.error('\x1b[33m Have you forgotten to update the plugin version?\x1b[0m');
console.error('');
console.error('If you are sure that the version does not need to be changed, use:');
console.error(' git commit --no-verify');
console.error('');
process.exit(1);
}
if (manifestChanged && hasCodeChanges) {
try {
const manifestDiff = execSync('git diff --cached manifest.json', { encoding: 'utf-8' });
if (!manifestDiff.includes('"version"')) {
console.error('\x1b[33m⚠ manifest.json has been modified, but the version has not been updated!\x1b[0m');
console.error('');
console.error('If this is intentional, use:');
console.error(' git commit --no-verify');
console.error('');
process.exit(1);
}
} catch (error) {
}
}
console.log('\x1b[32m✓ Version check passed\x1b[0m');
process.exit(0);