Skip to content

Commit b403892

Browse files
Merge branch 'v2-dev-bugfix' into fix/dx-4439-v2-dev-interactive-mode-messages
2 parents baa8a61 + 6f90ffe commit b403892

File tree

8 files changed

+45
-25
lines changed

8 files changed

+45
-25
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"clean:lock": "rm -f pnpm-lock.yaml",
2020
"clean:all": "pnpm store prune && rm -rf node_modules && pnpm run clean:packages",
2121
"setup": "pnpm run clean:all && pnpm run bootstrap && pnpm run build",
22-
"prepare": "npx husky && chmod +x .husky/pre-commit"
22+
"prepare": "npx husky && chmod +x .husky/pre-commit",
23+
"update:lockfile": "pnpm install --lockfile-only"
2324
},
2425
"license": "MIT",
2526
"packageManager": "pnpm@10.28.0",

packages/contentstack-auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
2323
},
2424
"dependencies": {
25-
"@contentstack/cli-command": "~2.0.0-beta",
26-
"@contentstack/cli-utilities": "~2.0.0-beta.1",
25+
"@contentstack/cli-command": "~2.0.0-beta.2",
26+
"@contentstack/cli-utilities": "~2.0.0-beta.2",
2727
"@oclif/core": "^4.3.0",
2828
"@oclif/plugin-help": "^6.2.28",
2929
"otplib": "^12.0.1"

packages/contentstack-command/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-command",
33
"description": "Contentstack CLI plugin for configuration",
4-
"version": "2.0.0-beta.1",
4+
"version": "2.0.0-beta.2",
55
"author": "Contentstack",
66
"main": "lib/index.js",
77
"types": "lib/index.d.ts",
@@ -20,7 +20,7 @@
2020
"test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\""
2121
},
2222
"dependencies": {
23-
"@contentstack/cli-utilities": "~2.0.0-beta.1",
23+
"@contentstack/cli-utilities": "~2.0.0-beta.2",
2424
"contentstack": "^3.25.3",
2525
"@oclif/core": "^4.3.0",
2626
"@oclif/plugin-help": "^6.2.28"

packages/contentstack-config/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-config",
33
"description": "Contentstack CLI plugin for configuration",
4-
"version": "2.0.0-beta.2",
4+
"version": "2.0.0-beta.3",
55
"author": "Contentstack",
66
"scripts": {
77
"build": "pnpm compile && oclif manifest",
@@ -21,8 +21,8 @@
2121
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
2222
},
2323
"dependencies": {
24-
"@contentstack/cli-command": "~2.0.0-beta",
25-
"@contentstack/cli-utilities": "~2.0.0-beta.1",
24+
"@contentstack/cli-command": "~2.0.0-beta.2",
25+
"@contentstack/cli-utilities": "~2.0.0-beta.2",
2626
"@contentstack/utils": "~1.7.0",
2727
"@oclif/core": "^4.8.1",
2828
"@oclif/plugin-help": "^6.2.28",

packages/contentstack-utilities/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-utilities",
3-
"version": "2.0.0-beta.1",
3+
"version": "2.0.0-beta.2",
44
"description": "Utilities for contentstack projects",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

packages/contentstack-utilities/src/logger/session-path.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,22 @@ function createSessionMetadataFile(sessionPath: string, metadata: Record<string,
6060
}
6161
}
6262

63+
// Cache session path for the process so multiple callers (e.g. Logger's 5 level
64+
// loggers, export/import command at end, completeProgressWithMessage per module)
65+
// get one folder instead of many.
66+
let cachedSessionPath: string | null = null;
67+
6368
/**
6469
* Get the session-based log path for date-organized logging
6570
* Structure: {basePath}/{YYYY-MM-DD}/{command}-{YYYYMMDD-HHMMSS}-{sessionId}/
66-
*
71+
*
6772
* @returns The session-specific log directory path
6873
*/
6974
export function getSessionLogPath(): string {
75+
if (cachedSessionPath) {
76+
return cachedSessionPath;
77+
}
78+
7079
// Get base log path
7180
const basePath = getLogPath();
7281

@@ -115,6 +124,15 @@ export function getSessionLogPath(): string {
115124
createSessionMetadataFile(sessionPath, metadata);
116125
}
117126

127+
cachedSessionPath = sessionPath;
118128
return sessionPath;
119129
}
120130

131+
/**
132+
* Clear the cached session path. Used by tests so each test gets a fresh path.
133+
* Not needed in normal CLI usage (one process = one command = one cache).
134+
*/
135+
export function clearSessionLogPathCache(): void {
136+
cachedSessionPath = null;
137+
}
138+

packages/contentstack-utilities/test/unit/logger.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as fs from 'fs';
55
import * as path from 'path';
66
import * as os from 'os';
77
import Logger from '../../src/logger/logger';
8-
import { getSessionLogPath } from '../../src/logger/session-path';
8+
import { getSessionLogPath, clearSessionLogPathCache } from '../../src/logger/session-path';
99
import configHandler from '../../src/config-handler';
1010

1111
describe('Logger', () => {
@@ -239,6 +239,7 @@ describe('Session Log Path', () => {
239239

240240
beforeEach(() => {
241241
sandbox = sinon.createSandbox();
242+
clearSessionLogPathCache();
242243
// Create a temporary directory for testing
243244
tempDir = path.join(os.tmpdir(), `csdx-log-test-${Date.now()}`);
244245
fs.mkdirSync(tempDir, { recursive: true });

packages/contentstack/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
"prepack": "pnpm compile && oclif manifest && oclif readme"
2323
},
2424
"dependencies": {
25-
"@contentstack/cli-audit": "~2.0.0-beta.5",
26-
"@contentstack/cli-cm-export": "~2.0.0-beta.10",
27-
"@contentstack/cli-cm-import": "~2.0.0-beta.10",
25+
"@contentstack/cli-audit": "~2.0.0-beta.6",
26+
"@contentstack/cli-cm-export": "~2.0.0-beta.11",
27+
"@contentstack/cli-cm-import": "~2.0.0-beta.11",
2828
"@contentstack/cli-auth": "~2.0.0-beta.7",
2929
"@contentstack/cli-bulk-operations": "^1.0.0-beta",
30-
"@contentstack/cli-cm-bootstrap": "~2.0.0-beta.10",
31-
"@contentstack/cli-cm-branches": "~2.0.0-beta.1",
32-
"@contentstack/cli-cm-clone": "~2.0.0-beta.11",
33-
"@contentstack/cli-cm-export-to-csv": "~2.0.0-beta.1",
34-
"@contentstack/cli-cm-import-setup": "~2.0.0-beta.5",
35-
"@contentstack/cli-cm-seed": "~2.0.0-beta.9",
36-
"@contentstack/cli-command": "~2.0.0-beta",
37-
"@contentstack/cli-config": "~2.0.0-beta.2",
30+
"@contentstack/cli-cm-bootstrap": "~2.0.0-beta.11",
31+
"@contentstack/cli-cm-branches": "~2.0.0-beta.2",
32+
"@contentstack/cli-cm-clone": "~2.0.0-beta.12",
33+
"@contentstack/cli-cm-export-to-csv": "~2.0.0-beta.2",
34+
"@contentstack/cli-cm-import-setup": "~2.0.0-beta.6",
35+
"@contentstack/cli-cm-seed": "~2.0.0-beta.10",
36+
"@contentstack/cli-command": "~2.0.0-beta.2",
37+
"@contentstack/cli-config": "~2.0.0-beta.3",
3838
"@contentstack/cli-launch": "^1.9.6",
39-
"@contentstack/cli-migration": "~2.0.0-beta.6",
40-
"@contentstack/cli-utilities": "~2.0.0-beta.1",
41-
"@contentstack/cli-variants": "~2.0.0-beta.7",
39+
"@contentstack/cli-migration": "~2.0.0-beta.7",
40+
"@contentstack/cli-utilities": "~2.0.0-beta.2",
41+
"@contentstack/cli-variants": "~2.0.0-beta.8",
4242
"@contentstack/management": "~1.27.6",
4343
"@contentstack/utils": "~1.7.0",
4444
"@oclif/core": "^4.8.0",

0 commit comments

Comments
 (0)