fix(mod_commit): Improve commit workflow: detect project type and current branch; add robust version bump helpers for npm/deno

This commit is contained in:
2025-10-23 18:18:08 +00:00
parent 422761806d
commit 8dcaf1c631
4 changed files with 223 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';
import { logger } from '../gitzone.logging.js';
import * as helpers from './mod.helpers.js';
export const run = async (argvArg: any) => {
if (argvArg.format) {
@@ -113,12 +114,18 @@ export const run = async (argvArg: any) => {
logger.log('info', `Staging files for commit:`);
await smartshellInstance.exec(`git add -A`);
await smartshellInstance.exec(`git commit -m "${commitString}"`);
await smartshellInstance.exec(`npm version ${commitVersionType}`);
// Detect project type and bump version accordingly
const projectType = await helpers.detectProjectType();
await helpers.bumpProjectVersion(projectType, commitVersionType);
if (
answerBucket.getAnswerFor('pushToOrigin') &&
!(process.env.CI === 'true')
) {
await smartshellInstance.exec(`git push origin master --follow-tags`);
// Detect current branch instead of hardcoding "master"
const currentBranch = await helpers.detectCurrentBranch();
await smartshellInstance.exec(`git push origin ${currentBranch} --follow-tags`);
}
};