Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS - 44008 - fixed the issue of logger path not setting up from env variable and version bump #1372

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
16,841 changes: 2,442 additions & 14,399 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@colors/colors": "^1.5.0",
"@contentstack/cli-cm-export": "~1.11.1",
"@contentstack/cli-cm-import": "~1.15.1",
"@contentstack/cli-cm-export": "~1.11.2",
"@contentstack/cli-cm-import": "~1.15.2",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.6.0",
"async": "^3.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export-to-csv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
4 changes: 2 additions & 2 deletions packages/contentstack-export/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-export",
"description": "Contentstack CLI plugin to export content from stack",
"version": "1.11.1",
"version": "1.11.2",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down Expand Up @@ -98,4 +98,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
3 changes: 2 additions & 1 deletion packages/contentstack-export/src/types/export-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Modules } from '.';
import DefaultConfig from './default-config';

export default interface ExportConfig extends DefaultConfig {
importExportLogPath: string;
exportDir: string;
data: string;
management_token?: string;
Expand All @@ -27,7 +28,7 @@ export default interface ExportConfig extends DefaultConfig {
access_token?: string;
org_uid?: string;
source_stack?: string;
sourceStackName?:string;
sourceStackName?: string;
}

type branch = {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function init(_logPath: string) {
}

export const log = async (config: ExportConfig, message: any, type: string) => {
const logsPath = config.data;
const logsPath = config.importExportLogPath || config.data;
// ignoring the type argument, as we are not using it to create a logfile anymore
if (type !== 'error') {
// removed type argument from init method
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.15.1",
"version": "1.15.2",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ModuleImporter {
* fix available and the user confirms to proceed with the fix, otherwise it returns `false`.
*/
async auditImportData(logger: Logger) {
const basePath = resolve(this.importConfig.backupDir, 'logs', 'audit');
const basePath = resolve(this.importConfig.importExportLogPath || this.importConfig.backupDir, 'logs', 'audit');
const auditConfig = this.importConfig.auditConfig;
auditConfig.config.basePath = basePath;
auditConfig.config.branch = this.importConfig.branchName;
Expand Down
1 change: 1 addition & 0 deletions packages/contentstack-import/src/types/import-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface ExternalConfig {
}

export default interface ImportConfig extends DefaultConfig, ExternalConfig {
importExportLogPath: string;
cs-raj marked this conversation as resolved.
Show resolved Hide resolved
canCreatePrivateApp: boolean;
contentDir: string;
data: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/src/utils/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function log(entryOrMessage: MessageType, logType?: LogsType, hidden?: bo

export function initLogger(config?: ImportConfig | undefined) {
if (!logger) {
const basePath = pathValidator(join(config?.data ?? process.cwd(), 'logs', 'import'));
const basePath = pathValidator(join(config?.importExportLogPath ?? process.cwd(), 'logs', 'import'));
logger = new Logger(Object.assign(config ?? {}, { basePath }));
}

Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-import/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ function init(_logPath: string) {
}

export const log = async (config: ImportConfig, message: any, type: string) => {
config.data = config.data || path.join(__dirname, 'logs');
config.importExportLogPath = config.importExportLogPath || config.data || path.join(__dirname, 'logs');
cs-raj marked this conversation as resolved.
Show resolved Hide resolved
// ignoring the type argument, as we are not using it to create a logfile anymore
if (type !== 'error') {
// removed type argument from init method
if (type === 'warn') init(config.data).warn(message); //logged warning message in log file
else init(config.data).log(message);
if (type === 'warn') init(config.importExportLogPath).warn(message); //logged warning message in log file
else init(config.importExportLogPath).log(message);
} else {
init(config.data).error(message);
init(config.importExportLogPath).error(message);
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-seed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-cm-import": "~1.15.1",
"@contentstack/cli-cm-import": "~1.15.2",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.6.0",
"inquirer": "8.2.4",
Expand Down
8 changes: 4 additions & 4 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": "1.17.2",
"version": "1.17.3",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run"
Expand All @@ -10,7 +10,7 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "npm run clean && npm run compile",
"clean": "rm -rf ./lib ./node_modules tsconfig.build.tsbuildinfo",
"clean": "rm -rf ./li b ./node_modules tsconfig.build.tsbuildinfo",
cs-raj marked this conversation as resolved.
Show resolved Hide resolved
"compile": "tsc -b tsconfig.json",
"postpack": "rm -f oclif.manifest.json",
"version": "oclif readme && git add README.md",
Expand All @@ -27,10 +27,10 @@
"@contentstack/cli-cm-bootstrap": "~1.9.0",
"@contentstack/cli-cm-branches": "~1.0.24",
"@contentstack/cli-cm-bulk-publish": "~1.4.4",
"@contentstack/cli-cm-export": "~1.11.1",
"@contentstack/cli-cm-export": "~1.11.2",
"@contentstack/cli-cm-clone": "~1.10.3",
"@contentstack/cli-cm-export-to-csv": "~1.7.0",
"@contentstack/cli-cm-import": "~1.15.1",
"@contentstack/cli-cm-import": "~1.15.2",
"@contentstack/cli-cm-migrate-rte": "~1.4.15",
"@contentstack/cli-cm-seed": "~1.7.3",
"@contentstack/cli-command": "~1.2.17",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading