trello-cli-unofficial 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.11.5](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.4...v0.11.5) (2025-11-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Make version reading robust for Windows compatibility ([5af0780](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/5af07803c4bd074fa28a4a77de24790aa1bda666))
7
+
1
8
  ## [0.11.4](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.3...v0.11.4) (2025-11-14)
2
9
 
3
10
 
package/dist/main.js CHANGED
@@ -31130,8 +31130,9 @@ var init_TrelloCliController = __esm(() => {
31130
31130
  });
31131
31131
 
31132
31132
  // src/presentation/cli/CommandController.ts
31133
- import { readFileSync as readFileSync2 } from "fs";
31134
- import { join } from "path";
31133
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
31134
+ import { dirname, join } from "path";
31135
+ import { fileURLToPath as fileURLToPath2 } from "url";
31135
31136
 
31136
31137
  class CommandController {
31137
31138
  authController;
@@ -31145,6 +31146,25 @@ class CommandController {
31145
31146
  this.outputFormatter = new OutputFormatter;
31146
31147
  this.program = new Command;
31147
31148
  }
31149
+ getVersion() {
31150
+ const cwdPackageJson = join(process.cwd(), "package.json");
31151
+ if (existsSync(cwdPackageJson)) {
31152
+ try {
31153
+ const packageJson = JSON.parse(readFileSync2(cwdPackageJson, "utf-8"));
31154
+ return packageJson.version;
31155
+ } catch {}
31156
+ }
31157
+ try {
31158
+ const currentFilePath = fileURLToPath2(import.meta.url);
31159
+ const currentDir = dirname(currentFilePath);
31160
+ const installedPackageJson = join(currentDir, "..", "..", "package.json");
31161
+ if (existsSync(installedPackageJson)) {
31162
+ const packageJson = JSON.parse(readFileSync2(installedPackageJson, "utf-8"));
31163
+ return packageJson.version;
31164
+ }
31165
+ } catch {}
31166
+ return "0.11.3";
31167
+ }
31148
31168
  async initializeTrelloControllers() {
31149
31169
  await this.authController.ensureAuthenticated();
31150
31170
  const authService = new AuthenticationService(new FileConfigRepository);
@@ -31157,9 +31177,7 @@ class CommandController {
31157
31177
  if (!this.program) {
31158
31178
  throw new Error(t2("errors.programNotInitialized"));
31159
31179
  }
31160
- const packageJsonPath = join(process.cwd(), "package.json");
31161
- const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
31162
- const version = packageJson.version;
31180
+ const version = this.getVersion();
31163
31181
  this.program.name("trello-cli-unofficial").description(t2("commands.description")).version(version).option("-f, --format <format>", t2("commands.formatOption"), "table").option("-v", t2("commands.versionOption")).option("--verbose", t2("commands.verboseOption")).on("option:format", (format) => {
31164
31182
  this.outputFormatter.setFormat(format);
31165
31183
  }).on("option:v", () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trello-cli-unofficial",
3
3
  "type": "module",
4
- "version": "0.11.4",
4
+ "version": "0.11.5",
5
5
  "private": false,
6
6
  "description": "Unofficial Trello CLI using Power-Up authentication, built with Bun for maximum performance",
7
7
  "author": "Matheus Caiser <matheus.kaiser@gmail.com> (https://www.mrdeveloper.com.br/)",
@@ -1,6 +1,7 @@
1
1
  import type { OutputFormat } from '@/shared';
2
- import { readFileSync } from 'node:fs';
3
- import { join } from 'node:path';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
4
5
 
5
6
  import { AuthenticationService } from '@domain/services';
6
7
  import {
@@ -29,6 +30,38 @@ export class CommandController {
29
30
  this.program = new Command();
30
31
  }
31
32
 
33
+ private getVersion(): string {
34
+ // Try multiple approaches to find package.json (robust for different environments)
35
+
36
+ // 1. Try relative to current working directory (development)
37
+ const cwdPackageJson = join(process.cwd(), 'package.json');
38
+ if (existsSync(cwdPackageJson)) {
39
+ try {
40
+ const packageJson = JSON.parse(readFileSync(cwdPackageJson, 'utf-8'));
41
+ return packageJson.version;
42
+ } catch {
43
+ // Continue to next approach
44
+ }
45
+ }
46
+
47
+ // 2. Try relative to this file's directory (when installed globally)
48
+ try {
49
+ const currentFilePath = fileURLToPath(import.meta.url);
50
+ const currentDir = dirname(currentFilePath);
51
+ const installedPackageJson = join(currentDir, '..', '..', 'package.json');
52
+
53
+ if (existsSync(installedPackageJson)) {
54
+ const packageJson = JSON.parse(readFileSync(installedPackageJson, 'utf-8'));
55
+ return packageJson.version;
56
+ }
57
+ } catch {
58
+ // Continue to fallback
59
+ }
60
+
61
+ // 3. Fallback to hardcoded version from package.json
62
+ return '0.11.3';
63
+ }
64
+
32
65
  private async initializeTrelloControllers(): Promise<void> {
33
66
  await this.authController.ensureAuthenticated();
34
67
 
@@ -56,10 +89,8 @@ export class CommandController {
56
89
  throw new Error(t('errors.programNotInitialized'));
57
90
  }
58
91
 
59
- // Get version from package.json
60
- const packageJsonPath = join(process.cwd(), 'package.json');
61
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
62
- const version = packageJson.version;
92
+ // Get version using robust method
93
+ const version = this.getVersion();
63
94
 
64
95
  this.program
65
96
  .name('trello-cli-unofficial')