Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a41e3d5d2c | |||
| c45cff89de |
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-10-23 - 1.18.9 - fix(mod_commit)
|
||||||
|
Stage and commit deno.json when bumping/syncing versions and create/update git tags
|
||||||
|
|
||||||
|
- bumpDenoVersion now creates a Smartshell instance and runs git add deno.json, git commit -m "v<newVersion>", and git tag v<newVersion> to persist the version bump
|
||||||
|
- syncVersionToDenoJson now stages deno.json, amends the npm version commit with --no-edit, and recreates the tag with -fa to keep package.json and deno.json in sync
|
||||||
|
- Added informative logger messages after creating commits and tags
|
||||||
|
|
||||||
## 2025-10-23 - 1.18.8 - fix(mod_commit)
|
## 2025-10-23 - 1.18.8 - fix(mod_commit)
|
||||||
Improve commit workflow: detect project type and current branch; add robust version bump helpers for npm/deno
|
Improve commit workflow: detect project type and current branch; add robust version bump helpers for npm/deno
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/cli",
|
"name": "@git.zone/cli",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "1.18.8",
|
"version": "1.18.9",
|
||||||
"description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
|
"description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
|
||||||
"main": "dist_ts/index.ts",
|
"main": "dist_ts/index.ts",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/cli',
|
name: '@git.zone/cli',
|
||||||
version: '1.18.8',
|
version: '1.18.9',
|
||||||
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,12 +90,16 @@ function calculateNewVersion(currentVersion: string, versionType: VersionType):
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bumps the version in deno.json
|
* Bumps the version in deno.json, commits the change, and creates a tag
|
||||||
* @param versionType Type of version bump
|
* @param versionType Type of version bump
|
||||||
* @returns The new version string
|
* @returns The new version string
|
||||||
*/
|
*/
|
||||||
export async function bumpDenoVersion(versionType: VersionType): Promise<string> {
|
export async function bumpDenoVersion(versionType: VersionType): Promise<string> {
|
||||||
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
|
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
|
||||||
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
|
executor: 'bash',
|
||||||
|
sourceFilePaths: [],
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Read deno.json
|
// Read deno.json
|
||||||
@@ -121,6 +125,17 @@ export async function bumpDenoVersion(versionType: VersionType): Promise<string>
|
|||||||
denoJsonPath
|
denoJsonPath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Stage the deno.json file
|
||||||
|
await smartshellInstance.exec('git add deno.json');
|
||||||
|
|
||||||
|
// Commit the version bump
|
||||||
|
await smartshellInstance.exec(`git commit -m "v${newVersion}"`);
|
||||||
|
|
||||||
|
// Create the version tag
|
||||||
|
await smartshellInstance.exec(`git tag v${newVersion} -m "v${newVersion}"`);
|
||||||
|
|
||||||
|
logger.log('info', `Created commit and tag v${newVersion}`);
|
||||||
|
|
||||||
return newVersion;
|
return newVersion;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(`Failed to bump deno.json version: ${error.message}`);
|
throw new Error(`Failed to bump deno.json version: ${error.message}`);
|
||||||
@@ -147,11 +162,15 @@ async function bumpNpmVersion(versionType: VersionType): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syncs the version from package.json to deno.json
|
* Syncs the version from package.json to deno.json and amends the npm commit
|
||||||
* @param version The version to sync
|
* @param version The version to sync
|
||||||
*/
|
*/
|
||||||
async function syncVersionToDenoJson(version: string): Promise<void> {
|
async function syncVersionToDenoJson(version: string): Promise<void> {
|
||||||
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
|
const denoJsonPath = plugins.path.join(paths.cwd, 'deno.json');
|
||||||
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
|
executor: 'bash',
|
||||||
|
sourceFilePaths: [],
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const denoConfig = plugins.smartfile.fs.toObjectSync(
|
const denoConfig = plugins.smartfile.fs.toObjectSync(
|
||||||
@@ -165,6 +184,17 @@ async function syncVersionToDenoJson(version: string): Promise<void> {
|
|||||||
JSON.stringify(denoConfig, null, 2) + '\n',
|
JSON.stringify(denoConfig, null, 2) + '\n',
|
||||||
denoJsonPath
|
denoJsonPath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Stage the deno.json file
|
||||||
|
await smartshellInstance.exec('git add deno.json');
|
||||||
|
|
||||||
|
// Amend the npm version commit to include deno.json
|
||||||
|
await smartshellInstance.exec('git commit --amend --no-edit');
|
||||||
|
|
||||||
|
// Re-create the tag with force to update it
|
||||||
|
await smartshellInstance.exec(`git tag -fa v${version} -m "v${version}"`);
|
||||||
|
|
||||||
|
logger.log('info', `Amended commit to include deno.json and updated tag v${version}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(`Failed to sync version to deno.json: ${error.message}`);
|
throw new Error(`Failed to sync version to deno.json: ${error.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user