Skip to content

Commit 9c732e8

Browse files
committed
fix: update detect error
1 parent 7274011 commit 9c732e8

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tukuyomil032/broom",
33
"private": false,
4-
"version": "1.0.5",
4+
"version": "1.0.51",
55
"description": "🧹 macOS Disk Cleanup CLI - Clean up caches, logs, trash, browser data, dev artifacts, and more",
66
"type": "module",
77
"main": "./dist/index.js",

src/commands/update.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
*/
44
import { Command } from 'commander';
55
import { execSync } from 'child_process';
6+
import { readFileSync } from 'fs';
7+
import { fileURLToPath } from 'url';
8+
import { dirname, join } from 'path';
69
import chalk from 'chalk';
710
import ora from 'ora';
811
import { confirm } from '@inquirer/prompts';
912
import { enhanceCommandHelp } from '../utils/help.js';
1013

11-
const PACKAGE_NAME = 'broom-cli';
14+
const PACKAGE_NAME = '@tukuyomil032/broom';
15+
const __dirname = dirname(fileURLToPath(import.meta.url));
1216

1317
interface UpdateOptions {
1418
check: boolean;
@@ -20,7 +24,8 @@ interface UpdateOptions {
2024
*/
2125
function getCurrentVersion(): string {
2226
try {
23-
const packageJson = require('../../package.json');
27+
const packagePath = join(__dirname, '../../package.json');
28+
const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
2429
return packageJson.version;
2530
} catch {
2631
return 'unknown';

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
import { enableDebug, debug } from './utils/debug.js';
3434
import { getGlobalOptionsTable } from './utils/help.js';
3535

36-
const VERSION = '1.0.5';
36+
const VERSION = '1.0.51';
3737

3838
// ASCII art logo
3939
const logo = chalk.cyan(`

0 commit comments

Comments
 (0)