Skip to content

Commit 9ea7198

Browse files
authored
Template path fix (#311)
1 parent d4c6955 commit 9ea7198

File tree

13 files changed

+45
-13
lines changed

13 files changed

+45
-13
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@
9696
},
9797
"repository": "salesforcecli/plugin-omnistudio-migration-tool",
9898
"scripts": {
99-
"build": "sf-build",
99+
"build": "sf-build && yarn copy-assets",
100+
"copy-assets": "shx cp -r src/templates lib/ && shx cp -r src/styles lib/ && shx cp -r src/javascripts lib/",
100101
"clean": "sf-clean",
101102
"clean-all": "sf-clean all",
102103
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
103-
"compile": "sf-compile",
104+
"compile": "sf-compile && yarn copy-assets",
104105
"docs": "sf-docs",
105106
"format": "sf-format",
106107
"lint": "sf-lint",

src/migration/omniscript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
386386
const nameVal = `${elemName}`;
387387
const className = propertySet['remoteClass'];
388388
const methodName = propertySet['remoteMethod'];
389-
dependenciesRA.push({ name: className + '.' + methodName, location: nameVal });
389+
if (className && methodName) dependenciesRA.push({ name: className + '.' + methodName, location: nameVal });
390390
}
391391
// To handle radio , multiselect
392392
if (propertySet['optionSource'] && propertySet['optionSource']['type'] === 'Custom') {

src/utils/file/fileUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class File {
158158
* - The source files remain in place after copying.
159159
*/
160160
export function pushAssestUtilites(folderName: string, destDir: string): void {
161-
const sourceDir = path.join(process.cwd(), 'src', folderName);
161+
const sourceDir = path.join(__dirname, '..', '..', folderName);
162162

163163
if (!fs.existsSync(destDir)) {
164164
Logger.warn(`Destination directory does not exist: ${destDir}`);

src/utils/logger.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ export class Logger {
3030
FileLogger.writeLog('VERBOSE', message);
3131
}
3232

33+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
34+
public static captureVerboseData(message: string, data: any): void {
35+
if (Logger.verbose) {
36+
FileLogger.writeLog('VERBOSE DATA', `${message}: ${JSON.stringify(data)}`);
37+
}
38+
}
39+
3340
public static get logger(): SfLogger {
3441
return Logger.sfLogger;
3542
}

src/utils/resultsbuilder/ApexAssessmentReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ApexAssessmentInfo } from '../interfaces';
2+
import { Logger } from '../logger';
23
import { OmnistudioOrgDetails } from '../orgUtils';
34
import {
45
FilterGroupParam,
@@ -16,6 +17,7 @@ export class ApexAssessmentReporter {
1617
apexAssessmentInfos: ApexAssessmentInfo[],
1718
omnistudioOrgDetails: OmnistudioOrgDetails
1819
): ReportParam {
20+
Logger.captureVerboseData('apex data:', apexAssessmentInfos);
1921
return {
2022
title: 'Apex Migration Assessment',
2123
heading: 'Apex',

src/utils/resultsbuilder/DRAssessmentReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DataRaptorAssessmentInfo } from '../interfaces';
2+
import { Logger } from '../logger';
23
import { OmnistudioOrgDetails } from '../orgUtils';
34
import {
45
FilterGroupParam,
@@ -17,6 +18,7 @@ export class DRAssessmentReporter {
1718
instanceUrl: string,
1819
omnistudioOrgDetails: OmnistudioOrgDetails
1920
): ReportParam {
21+
Logger.captureVerboseData('DM data', dataRaptorAssessmentInfos);
2022
return {
2123
title: 'Data Mapper Migration Assessment',
2224
heading: 'Data Mapper',

src/utils/resultsbuilder/FlexcardAssessmentReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FlexCardAssessmentInfo } from '../interfaces';
2+
import { Logger } from '../logger';
23
import { OmnistudioOrgDetails } from '../orgUtils';
34
import {
45
FilterGroupParam,
@@ -17,6 +18,7 @@ export class FlexcardAssessmentReporter {
1718
instanceUrl: string,
1819
omnistudioOrgDetails: OmnistudioOrgDetails
1920
): ReportParam {
21+
Logger.captureVerboseData('fc data:', flexCardAssessmentInfos);
2022
return {
2123
title: 'Flexcard Migration Assessment',
2224
heading: 'Flexcard',

src/utils/resultsbuilder/IPAssessmentReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { IPAssessmentInfo } from '../interfaces';
2+
import { Logger } from '../logger';
23
import { OmnistudioOrgDetails } from '../orgUtils';
34
import {
45
FilterGroupParam,
@@ -17,6 +18,7 @@ export class IPAssessmentReporter {
1718
instanceUrl: string,
1819
omnistudioOrgDetails: OmnistudioOrgDetails
1920
): ReportParam {
21+
Logger.captureVerboseData('IP data', ipAssessmentInfos);
2022
return {
2123
title: 'Integration Procedure Migration Assessment',
2224
heading: 'Integration Procedure',

src/utils/resultsbuilder/OSAssessmentReporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { OSAssessmentInfo } from '../interfaces';
2+
import { Logger } from '../logger';
23
import { OmnistudioOrgDetails } from '../orgUtils';
34
import {
45
FilterGroupParam,
@@ -17,6 +18,7 @@ export class OSAssessmentReporter {
1718
instanceUrl: string,
1819
omnistudioOrgDetails: OmnistudioOrgDetails
1920
): ReportParam {
21+
Logger.captureVerboseData('OS data:', OSAssessmentInfos);
2022
return {
2123
title: 'OmniScript Migration Assessment',
2224
heading: 'OmniScript',

src/utils/resultsbuilder/assessmentReporter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export class AssessmentReporter {
2525
private static dataMapperAssessmentFileName = 'datamapper_assessment.html';
2626
private static apexAssessmentFileName = 'apex_assessment.html';
2727
private static dashboardFileName = 'dashboard.html';
28-
private static dashboardTemplate = path.join(process.cwd(), 'src/templates/dashboard.template');
28+
private static templateDir = 'templates';
29+
private static dashboardTemplateName = 'dashboard.template';
30+
private static reportTemplateName = 'assessmentReport.template';
31+
private static dashboardTemplate = path.join(__dirname, '..', '..', this.templateDir, this.dashboardTemplateName);
2932
// TODO: Uncomment code once MVP for migration is completed
3033
// private static lwcAssessmentFilePath = this.basePath + '/lwc_assessment.html';
3134
public static async generate(
@@ -39,7 +42,7 @@ export class AssessmentReporter {
3942
fs.mkdirSync(this.basePath, { recursive: true });
4043

4144
const assessmentReportTemplate = fs.readFileSync(
42-
process.cwd() + '/src/templates/assessmentReport.template',
45+
path.join(__dirname, '..', '..', this.templateDir, this.reportTemplateName),
4346
'utf8'
4447
);
4548
if (!assessOnly) {

0 commit comments

Comments
 (0)