Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-auth",
"description": "Contentstack CLI plugin for authentication activities",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -22,8 +22,8 @@
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-command": "~2.0.0-beta",
"@contentstack/cli-utilities": "~2.0.0-beta.1",
"@contentstack/cli-command": "~2.0.0-beta.2",
"@contentstack/cli-utilities": "~2.0.0-beta.2",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"otplib": "^12.0.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-command",
"description": "Contentstack CLI plugin for configuration",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"author": "Contentstack",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -20,7 +20,7 @@
"test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-utilities": "~2.0.0-beta.1",
"@contentstack/cli-utilities": "~2.0.0-beta.2",
"contentstack": "^3.25.3",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28"
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-config",
"description": "Contentstack CLI plugin for configuration",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"author": "Contentstack",
"scripts": {
"build": "pnpm compile && oclif manifest",
Expand All @@ -21,8 +21,8 @@
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-command": "~2.0.0-beta",
"@contentstack/cli-utilities": "~2.0.0-beta.1",
"@contentstack/cli-command": "~2.0.0-beta.2",
"@contentstack/cli-utilities": "~2.0.0-beta.2",
"@contentstack/utils": "~1.7.0",
"@oclif/core": "^4.8.1",
"@oclif/plugin-help": "^6.2.28",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-utilities/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-utilities",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Utilities for contentstack projects",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
20 changes: 19 additions & 1 deletion packages/contentstack-utilities/src/logger/session-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,22 @@ function createSessionMetadataFile(sessionPath: string, metadata: Record<string,
}
}

// Cache session path for the process so multiple callers (e.g. Logger's 5 level
// loggers, export/import command at end, completeProgressWithMessage per module)
// get one folder instead of many.
let cachedSessionPath: string | null = null;

/**
* Get the session-based log path for date-organized logging
* Structure: {basePath}/{YYYY-MM-DD}/{command}-{YYYYMMDD-HHMMSS}-{sessionId}/
*
*
* @returns The session-specific log directory path
*/
export function getSessionLogPath(): string {
if (cachedSessionPath) {
return cachedSessionPath;
}

// Get base log path
const basePath = getLogPath();

Expand Down Expand Up @@ -115,6 +124,15 @@ export function getSessionLogPath(): string {
createSessionMetadataFile(sessionPath, metadata);
}

cachedSessionPath = sessionPath;
return sessionPath;
}

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

3 changes: 2 additions & 1 deletion packages/contentstack-utilities/test/unit/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import Logger from '../../src/logger/logger';
import { getSessionLogPath } from '../../src/logger/session-path';
import { getSessionLogPath, clearSessionLogPathCache } from '../../src/logger/session-path';
import configHandler from '../../src/config-handler';

describe('Logger', () => {
Expand Down Expand Up @@ -239,6 +239,7 @@ describe('Session Log Path', () => {

beforeEach(() => {
sandbox = sinon.createSandbox();
clearSessionLogPathCache();
// Create a temporary directory for testing
tempDir = path.join(os.tmpdir(), `csdx-log-test-${Date.now()}`);
fs.mkdirSync(tempDir, { recursive: true });
Expand Down
32 changes: 16 additions & 16 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli",
"description": "Command-line tool (CLI) to interact with Contentstack",
"version": "2.0.0-beta.13",
"version": "2.0.0-beta.14",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run.js"
Expand All @@ -22,23 +22,23 @@
"prepack": "pnpm compile && oclif manifest && oclif readme"
},
"dependencies": {
"@contentstack/cli-audit": "~2.0.0-beta.5",
"@contentstack/cli-cm-export": "~2.0.0-beta.10",
"@contentstack/cli-cm-import": "~2.0.0-beta.10",
"@contentstack/cli-auth": "~2.0.0-beta.6",
"@contentstack/cli-audit": "~2.0.0-beta.6",
"@contentstack/cli-cm-export": "~2.0.0-beta.11",
"@contentstack/cli-cm-import": "~2.0.0-beta.11",
"@contentstack/cli-auth": "~2.0.0-beta.7",
"@contentstack/cli-bulk-operations": "^1.0.0-beta",
"@contentstack/cli-cm-bootstrap": "~2.0.0-beta.10",
"@contentstack/cli-cm-branches": "~2.0.0-beta.1",
"@contentstack/cli-cm-clone": "~2.0.0-beta.11",
"@contentstack/cli-cm-export-to-csv": "~2.0.0-beta.1",
"@contentstack/cli-cm-import-setup": "~2.0.0-beta.5",
"@contentstack/cli-cm-seed": "~2.0.0-beta.9",
"@contentstack/cli-command": "~2.0.0-beta",
"@contentstack/cli-config": "~2.0.0-beta.2",
"@contentstack/cli-cm-bootstrap": "~2.0.0-beta.11",
"@contentstack/cli-cm-branches": "~2.0.0-beta.2",
"@contentstack/cli-cm-clone": "~2.0.0-beta.12",
"@contentstack/cli-cm-export-to-csv": "~2.0.0-beta.2",
"@contentstack/cli-cm-import-setup": "~2.0.0-beta.6",
"@contentstack/cli-cm-seed": "~2.0.0-beta.10",
"@contentstack/cli-command": "~2.0.0-beta.2",
"@contentstack/cli-config": "~2.0.0-beta.3",
"@contentstack/cli-launch": "^1.9.6",
"@contentstack/cli-migration": "~2.0.0-beta.6",
"@contentstack/cli-utilities": "~2.0.0-beta.1",
"@contentstack/cli-variants": "~2.0.0-beta.7",
"@contentstack/cli-migration": "~2.0.0-beta.7",
"@contentstack/cli-utilities": "~2.0.0-beta.2",
"@contentstack/cli-variants": "~2.0.0-beta.8",
"@contentstack/management": "~1.27.6",
"@contentstack/utils": "~1.7.0",
"@oclif/core": "^4.8.0",
Expand Down
Loading