trello-cli-unofficial 0.12.0 → 0.12.1

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.12.1](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.12.0...v0.12.1) (2025-11-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **cli:** remove hardcoded version fallback in getVersion() ([72c04ef](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/72c04ef59966efada5ba095f7e2c5282540015f6))
7
+
1
8
  # [0.12.0](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.6...v0.12.0) (2025-11-17)
2
9
 
3
10
 
package/dist/main.js CHANGED
@@ -31239,23 +31239,24 @@ class CommandController {
31239
31239
  }
31240
31240
  }
31241
31241
  getVersion() {
31242
- const cwdPackageJson = join(process.cwd(), "package.json");
31243
- if (existsSync(cwdPackageJson)) {
31244
- try {
31245
- const packageJson = JSON.parse(readFileSync2(cwdPackageJson, "utf-8"));
31246
- return packageJson.version;
31247
- } catch {}
31248
- }
31249
31242
  try {
31250
31243
  const currentFilePath = fileURLToPath2(import.meta.url);
31251
31244
  const currentDir = dirname(currentFilePath);
31252
- const installedPackageJson = join(currentDir, "..", "..", "..", "..", "package.json");
31253
- if (existsSync(installedPackageJson)) {
31254
- const packageJson = JSON.parse(readFileSync2(installedPackageJson, "utf-8"));
31255
- return packageJson.version;
31245
+ const possiblePaths = [
31246
+ join(currentDir, "..", "package.json"),
31247
+ join(currentDir, "..", "..", "..", "package.json")
31248
+ ];
31249
+ for (const packagePath of possiblePaths) {
31250
+ if (existsSync(packagePath)) {
31251
+ const packageJson = JSON.parse(readFileSync2(packagePath, "utf-8"));
31252
+ if (packageJson.name === "trello-cli-unofficial") {
31253
+ return packageJson.version;
31254
+ }
31255
+ }
31256
31256
  }
31257
31257
  } catch {}
31258
- return "0.11.10";
31258
+ console.warn("\u26A0\uFE0F Could not determine trello-cli-unofficial version from package.json");
31259
+ return "0.0.0";
31259
31260
  }
31260
31261
  async initializeTrelloControllers() {
31261
31262
  await this.authController.ensureAuthenticated();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trello-cli-unofficial",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.12.1",
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/)",
@@ -38,37 +38,42 @@ export class CommandController {
38
38
  }
39
39
 
40
40
  private getVersion(): string {
41
- // Try multiple approaches to find package.json (robust for different environments)
42
-
43
- // 1. Try relative to current working directory (development)
44
- const cwdPackageJson = join(process.cwd(), 'package.json');
45
- if (existsSync(cwdPackageJson)) {
46
- try {
47
- const packageJson = JSON.parse(readFileSync(cwdPackageJson, 'utf-8'));
48
- return packageJson.version;
49
- }
50
- catch {
51
- // Continue to next approach
52
- }
53
- }
41
+ // CRITICAL: Always get version from the CLI's package.json, not from user's cwd
42
+ // This prevents showing wrong version when running inside other Node projects
54
43
 
55
- // 2. Try relative to this file's directory (when installed globally)
44
+ // Try relative to this file's directory (when installed globally or locally)
56
45
  try {
57
46
  const currentFilePath = fileURLToPath(import.meta.url);
58
47
  const currentDir = dirname(currentFilePath);
59
- const installedPackageJson = join(currentDir, '..', '..', '..', '..', 'package.json');
60
48
 
61
- if (existsSync(installedPackageJson)) {
62
- const packageJson = JSON.parse(readFileSync(installedPackageJson, 'utf-8'));
63
- return packageJson.version;
49
+ // When bundled, dist/main.js is at root level, package.json is one level up
50
+ // When unbundled, we're in src/presentation/cli, package.json is three levels up
51
+ const possiblePaths = [
52
+ join(currentDir, '..', 'package.json'), // dist/main.js -> package.json
53
+ join(currentDir, '..', '..', '..', 'package.json'), // src/presentation/cli -> package.json
54
+ ];
55
+
56
+ for (const packagePath of possiblePaths) {
57
+ if (existsSync(packagePath)) {
58
+ const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
59
+
60
+ // Verify it's the right package.json by checking the name
61
+ if (packageJson.name === 'trello-cli-unofficial') {
62
+ return packageJson.version;
63
+ }
64
+ }
64
65
  }
65
66
  }
66
67
  catch {
67
68
  // Continue to fallback
68
69
  }
69
70
 
70
- // 3. Fallback to hardcoded version
71
- return '0.11.10';
71
+ // Could not determine package version from installed CLI package.json.
72
+ // Remove hardcoded fallback to avoid showing incorrect versions when
73
+ // the CLI is executed inside other Node projects. Return a neutral
74
+ // unknown version string so callers can handle it explicitly.
75
+ console.warn('⚠️ Could not determine trello-cli-unofficial version from package.json');
76
+ return '0.0.0';
72
77
  }
73
78
 
74
79
  private async initializeTrelloControllers(): Promise<void> {