Skip to content

Commit 3a2adf6

Browse files
committed
fix: addressed comments
1 parent e094484 commit 3a2adf6

File tree

13 files changed

+350
-158
lines changed

13 files changed

+350
-158
lines changed

src/commands/omnistudio/migration/assess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { DebugTimer } from '../../../utils';
1111
import { Logger } from '../../../utils/logger';
1212
import OmnistudioRelatedObjectMigrationFacade from '../../../migration/related/OmnistudioRelatedObjectMigrationFacade';
1313
import { OmnistudioOrgDetails, OrgUtils } from '../../../utils/orgUtils';
14-
import { OrgPreferences } from '../../../utils/orgpreferences';
14+
import { OrgPreferences } from '../../../utils/orgPreferences';
1515
import { Constants } from '../../../utils/constants/stringContants';
1616

1717
Messages.importMessagesDirectory(__dirname);

src/commands/omnistudio/migration/migrate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import OmnistudioRelatedObjectMigrationFacade from '../../../migration/related/O
2323
import { generatePackageXml } from '../../../utils/generatePackageXml';
2424
import { OmnistudioOrgDetails, OrgUtils } from '../../../utils/orgUtils';
2525
import { Constants } from '../../../utils/constants/stringContants';
26-
import { OrgPreferences } from '../../../utils/orgpreferences';
26+
import { OrgPreferences } from '../../../utils/orgPreferences';
2727

2828
// Initialize Messages with the current plugin directory
2929
Messages.importMessagesDirectory(__dirname);

src/migration/dataraptor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
8383
} catch (ex) {
8484
Logger.error(JSON.stringify(ex));
8585
Logger.error(ex.stack);
86-
console.log(this.messages.getMessage('formulaSyntaxError', [drItem[this.namespacePrefix + 'Formula__c']]));
86+
Logger.logVerbose(
87+
this.messages.getMessage('formulaSyntaxError', [drItem[this.namespacePrefix + 'Formula__c']])
88+
);
8789
}
8890
}
8991
}
@@ -283,7 +285,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
283285
} catch (ex) {
284286
Logger.error(JSON.stringify(ex));
285287
Logger.error(ex.stack);
286-
console.log(this.messages.getMessage('formulaSyntaxError', [formula]));
288+
Logger.logVerbose(this.messages.getMessage('formulaSyntaxError', [formula]));
287289
}
288290
}
289291
}

src/migration/omniscript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
460460
} catch (ex) {
461461
Logger.error(JSON.stringify(ex));
462462
Logger.error(ex.stack);
463-
console.log(
463+
Logger.logVerbose(
464464
this.messages.getMessage('formulaSyntaxError', [ipElement[`${this.namespacePrefix}PropertySet__c`]])
465465
);
466466
}

src/templates/AssessmentHomePage.template.html

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/utils/file/fileUtil.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class FileUtil {
2626
fileMap: Map<string, File[]> = new Map<string, File[]>()
2727
): Map<string, File[]> {
2828
if (!fs.existsSync(dirPath)) {
29-
console.error(`Directory does not exist: ${dirPath}`);
29+
Logger.error(`Directory does not exist: ${dirPath}`);
3030
return fileMap; // Return the map as is
3131
}
3232
// Read the directory contents
@@ -70,7 +70,7 @@ export class FileUtil {
7070
fs.writeFileSync(outputFilePath, modifiedHtml);
7171
Logger.info(`Modified HTML saved to ${outputFilePath}`);
7272
} catch (error) {
73-
console.error(`Error writing file to disk: ${error}`);
73+
Logger.error(`Error writing file to disk: ${error}`);
7474
throw error;
7575
}
7676
}
@@ -128,7 +128,7 @@ export class FileUtil {
128128
const fileContent = fs.readFileSync(filePath, 'utf-8');
129129
return fileContent.includes(searchString);
130130
} catch (error) {
131-
console.error(`Error reading file ${filePath}:`, error);
131+
Logger.error(`Error reading file ${filePath}: ${error}`);
132132
return false;
133133
}
134134
};

src/utils/reportGenerator/reportInterfaces.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,9 @@
1-
import { oldNew } from '../interfaces';
2-
3-
/* eslint-disable @typescript-eslint/no-explicit-any */
4-
export interface TableColumn<T> {
5-
key: string;
6-
cell: (row: T, arg1?: number) => string;
7-
filterValue?: (row: T, arg1?: number) => string | string[] | oldNew[];
8-
title?: (row: T, arg1?: number) => string;
9-
styles?: (row: T, arg1?: number) => string;
10-
icon?: (row: T, arg1?: number) => string;
11-
rowspan?: (arg0: T, arg1?: number) => number;
12-
skip?: (arg0: T, arg1?: number) => boolean;
13-
}
14-
15-
export interface Filter {
16-
label: string;
17-
filterOptions: string[];
18-
key: string;
19-
}
20-
21-
export interface ReportHeader {
22-
key: string;
23-
value: string;
24-
}
25-
26-
export interface ReportHeaderFormat {
27-
key: string;
28-
value: string;
29-
}
30-
31-
export interface HeaderColumn {
32-
label: string;
33-
colspan?: number;
34-
rowspan?: number;
35-
key?: string;
36-
styles?: string;
37-
subColumn?: SubColumn[];
38-
}
39-
40-
export interface TableHeaderCell {
41-
label: string;
42-
colspan?: number;
43-
rowspan?: number;
44-
key?: string;
45-
width?: string;
46-
styles?: string;
47-
}
48-
491
export type CTASummary = {
502
name: string;
513
message: string;
524
link: string;
535
};
546

55-
export interface SubColumn {
56-
label: string;
57-
key?: string;
58-
}
59-
60-
export interface ComponentDetail {
61-
name: string;
62-
title: string;
63-
count: number;
64-
complete?: number;
65-
error?: number;
66-
skip?: number;
67-
}
68-
69-
export interface ReportFrameworkParameters<T> {
70-
headerColumns: HeaderColumn[];
71-
columns: Array<TableColumn<T>>;
72-
rows: T[];
73-
orgDetails: ReportHeader[];
74-
filters: Filter[];
75-
ctaSummary: CTASummary[];
76-
reportHeaderLabel: string;
77-
indexedKey?: string;
78-
showMigrationBanner: boolean;
79-
rollbackFlags?: string[];
80-
rollbackFlagName?: string;
81-
commandType?: 'assess' | 'migrate';
82-
}
83-
847
export interface OrgParam {
858
name: string;
869
id: string;

src/utils/resultsbuilder/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs';
2+
import path from 'path';
23
import open from 'open';
34
import { Logger } from '@salesforce/core';
45
import { pushAssestUtilites } from '../file/fileUtil';
@@ -8,11 +9,11 @@ import { OmnistudioOrgDetails } from '../orgUtils';
89
import { TemplateParser } from '../templateParser/generate';
910
import { createFilterGroupParam, createRowDataParam } from '../reportGenerator/reportUtil';
1011

11-
const resultsDir = process.cwd() + '/migration_report';
12+
const resultsDir = path.join(process.cwd(), 'migration_report');
1213
// const lwcConstants = { componentName: 'lwc', title: 'LWC Components Migration Result' };
1314
const migrationReportHTMLfileName = 'dashboard.html';
14-
const reportTemplateFilePath = process.cwd() + '/src/templates/report.template';
15-
const dashboardTemplateFilePath = process.cwd() + '/src/templates/dashboard.template';
15+
const reportTemplateFilePath = path.join(process.cwd(), 'src', 'templates', 'migrationReport.template');
16+
const dashboardTemplateFilePath = path.join(process.cwd(), 'src', 'templates', 'dashboard.template');
1617
const apexFileName = 'apex.html';
1718

1819
export class ResultsBuilder {
@@ -162,7 +163,7 @@ export class ResultsBuilder {
162163

163164
const reportTemplate = fs.readFileSync(reportTemplateFilePath, 'utf8');
164165
const html = TemplateParser.generate(reportTemplate, data);
165-
fs.writeFileSync(resultsDir + '/' + result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html', html);
166+
fs.writeFileSync(path.join(resultsDir, result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html'), html);
166167
}
167168

168169
private static generateReportForRelatedObject(
@@ -256,7 +257,7 @@ export class ResultsBuilder {
256257

257258
const reportTemplate = fs.readFileSync(reportTemplateFilePath, 'utf8');
258259
const html = TemplateParser.generate(reportTemplate, data);
259-
fs.writeFileSync(resultsDir + '/' + apexFileName, html);
260+
fs.writeFileSync(path.join(resultsDir, apexFileName), html);
260261

261262
// call generate html from template
262263
}
@@ -294,7 +295,7 @@ export class ResultsBuilder {
294295

295296
const dashboardTemplate = fs.readFileSync(dashboardTemplateFilePath, 'utf8');
296297
const html = TemplateParser.generate(dashboardTemplate, data);
297-
fs.writeFileSync(resultsDir + '/' + 'dashboard.html', html);
298+
fs.writeFileSync(path.join(resultsDir, 'dashboard.html'), html);
298299
}
299300

300301
private static getDifferentStatusDataForResult(

0 commit comments

Comments
 (0)