From 77368f83c4b94da9a2be70824f0298f4b10b33cf Mon Sep 17 00:00:00 2001 From: leotrinh Date: Thu, 5 Mar 2026 21:35:59 +0700 Subject: [PATCH 1/2] chore: fix inconsistent version --- test/lib/ApiMigrationTests.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/lib/ApiMigrationTests.js b/test/lib/ApiMigrationTests.js index fcad1c9..840f6a7 100644 --- a/test/lib/ApiMigrationTests.js +++ b/test/lib/ApiMigrationTests.js @@ -10,7 +10,11 @@ const CloudController = require('../../lib/model/cloudcontroller/CloudController const ApiConfig = require('../../lib/config/ApiConfig'); const ApiVersionManager = require('../../lib/config/ApiVersionManager'); -describe('cf-node-client v1.0.6 - API v3 Migration', function () { +// Dynamically read version from package.json to avoid manual updates +const pkg = require('../../package.json'); +const expectedVersion = pkg.version; + +describe(`cf-node-client v${expectedVersion} - API v3 Migration`, function () { this.timeout(5000); describe('Package Configuration', function () { @@ -20,14 +24,14 @@ describe('cf-node-client v1.0.6 - API v3 Migration', function () { expect(pkg.name).to.equal('cf-node-client'); }); - it('should have version 1.0.6', function () { + it('should have version 1.0.7', function () { const pkg = require('../../package.json'); - expect(pkg.version).to.equal('1.0.6'); + expect(pkg.version).to.equal('1.0.7'); }); - it('should have index.js export version 1.0.6', function () { + it('should have index.js export version 1.0.7', function () { const lib = require('../../index.js'); - expect(lib.version).to.equal('1.0.6'); + expect(lib.version).to.equal('1.0.7'); }); it('should export all 16 Cloud Foundry models', function () { From 959e2a4a1b7149520f789d55d743f26dd33a3e63 Mon Sep 17 00:00:00 2001 From: leotrinh Date: Thu, 5 Mar 2026 21:43:58 +0700 Subject: [PATCH 2/2] feat: version base on pkg --- index.js | 4 ++-- test/lib/ApiMigrationTests.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 1372b97..ec7ba2c 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ "use strict"; -/** Library Version */ -module.exports.version = "1.0.7"; +/** Library Version — read dynamically from package.json */ +module.exports.version = require("./package.json").version; // ── Cloud Controller models ──────────────────────────────────────────── const Apps = require("./lib/model/cloudcontroller/Apps"); diff --git a/test/lib/ApiMigrationTests.js b/test/lib/ApiMigrationTests.js index 840f6a7..a54f811 100644 --- a/test/lib/ApiMigrationTests.js +++ b/test/lib/ApiMigrationTests.js @@ -24,14 +24,14 @@ describe(`cf-node-client v${expectedVersion} - API v3 Migration`, function () { expect(pkg.name).to.equal('cf-node-client'); }); - it('should have version 1.0.7', function () { + it('should have version from package.json', function () { const pkg = require('../../package.json'); - expect(pkg.version).to.equal('1.0.7'); + expect(pkg.version).to.equal(expectedVersion); }); - it('should have index.js export version 1.0.7', function () { + it('should have index.js export version from package.json', function () { const lib = require('../../index.js'); - expect(lib.version).to.equal('1.0.7'); + expect(lib.version).to.equal(expectedVersion); }); it('should export all 16 Cloud Foundry models', function () {