Skip to content

Commit a37503a

Browse files
author
Shailesh Pachbhai
authored
Merge pull request #268 from salesforcecli/u/abhinavkumar2/W-17394503
@W-17394503
2 parents e87fb60 + ac5ea68 commit a37503a

File tree

15 files changed

+37
-28
lines changed

15 files changed

+37
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sfdx plugins:install @salesforce/plugin-omnistudio-migration-tool
2020
// To migrate everything
2121
sfdx omnistudio:migration:migrate -u [email protected] --namespace=VLOCITY_PACKAGE_NAMESPACE
2222
23-
//to migrate specific components: FlexCards, DataRaptors, Integration Procedures, or OmniScripts, add the following parameters:
23+
//to migrate specific components: FlexCards, DataMappers, Integration Procedures, or OmniScripts, add the following parameters:
2424
--only=dr
2525
--only=ip
2626
--only=os

messages/assess.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=os",
77
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=fc"
88
],
9-
"commandDescription": "print a greeting and your org IDs",
9+
"commandDescription": "Assess migration of omnistudio components from custom objects to standard objects",
1010
"namespaceFlagDescription": "The namespaced of the package",
1111
"apiVersionFlagDescription": "The Salesforce API version to use",
1212
"errorNoOrgResults": "No results found for the org '%s'.",
13-
"onlyFlagDescription": "Migrate a single element: osip | fc | dr",
14-
"invalidOnlyFlag": "Invalid flag, valid options are: osip | fc | dr",
13+
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
14+
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
1515
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
1616
"couldNotTruncate": "Could not truncate {0}",
1717
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
1818
"invalidNameTypeSubtypeOrLanguage": "Not a valid Name, Type, SubType or Language",
1919
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript",
2020
"invalidDataRaptorName": "Invalid name, can not have special characters",
2121
"duplicatedCardName": "Duplicated Flex Card name",
22-
"duplicatedDrName": "Duplicated DataRaptor name",
22+
"duplicatedDrName": "Duplicated DataMapper name",
2323
"duplicatedOSName": "Duplicated OmniScript name",
2424
"duplicatedName": "Duplicated name",
2525
"errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ",

messages/migrate.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r apex",
1010
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r lwc"
1111
],
12-
"commandDescription": "print a greeting and your org IDs",
13-
"namespaceFlagDescription": "The namespaced of the package",
12+
"commandDescription": "Migrate omnistudio components from custom objects to standard objects",
13+
"namespaceFlagDescription": "The namespace of the package",
1414
"apiVersionFlagDescription": "The Salesforce API version to use",
1515
"errorNoOrgResults": "No results found for the org '%s'.",
16-
"onlyFlagDescription": "Migrate a single element: osip | fc | dr",
17-
"invalidOnlyFlag": "Invalid flag, valid options are: osip | fc | dr",
16+
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
17+
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
1818
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
1919
"couldNotTruncate": "Could not truncate {0}",
2020
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
2121
"invalidNameTypeSubtypeOrLanguage": "Not a valid Name, Type, SubType or Language",
2222
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript",
2323
"invalidDataRaptorName": "Invalid name, can not have special characters",
2424
"duplicatedCardName": "Duplicated Flex Card name",
25-
"duplicatedDrName": "Duplicated DataRaptor name",
25+
"duplicatedDrName": "Duplicated DataMapper name",
2626
"duplicatedOSName": "Duplicated OmniScript name",
2727
"errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ",
2828
"errorWhileActivatingCard": "Could not activate Card: ",

src/commands/omnistudio/migration/migrate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export default class Migrate extends OmniStudioBaseCommand {
111111
Logger.ux.log('Cleaning: ' + cls.getName());
112112
debugTimer.lap('Cleaning: ' + cls.getName());
113113
await cls.truncate();
114+
Logger.ux.log('Cleaning Done: ' + cls.getName());
114115
} catch (ex: any) {
115116
allTruncateComplete = false;
116117
objectMigrationResults.push({
@@ -126,7 +127,7 @@ export default class Migrate extends OmniStudioBaseCommand {
126127
this.ux.log('Migrating: ' + cls.getName());
127128
debugTimer.lap('Migrating: ' + cls.getName());
128129
const results = await cls.migrate();
129-
130+
this.ux.log('Migration completed: ' + cls.getName());
130131
objectMigrationResults = objectMigrationResults.concat(
131132
results.map((r) => {
132133
return {

src/migration/dataraptor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
2323
static readonly OMNIDATATRANSFORMITEM_NAME = 'OmniDataTransformItem';
2424

2525
getName(): string {
26-
return 'DataRaptor';
26+
return 'DataMappers';
2727
}
2828

2929
getRecordName(record: string) {
@@ -183,7 +183,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
183183
}
184184

185185
return {
186-
name: 'Data Raptor',
186+
name: 'Data Mapper',
187187
results: drUploadInfo,
188188
records: originalDrRecords,
189189
};

src/migration/related/ApexMigration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ export class ApexMigration extends BaseRelatedObjectMigration {
5252
shell.cd(this.projectPath);
5353
// const targetOrg: Org = this.org;
5454
// sfProject.retrieve(APEXCLASS, targetOrg.getUsername());
55+
Logger.logger.info('Processing Apex ');
5556
const apexAssessmentInfos = this.processApexFiles(this.projectPath);
57+
Logger.logger.info('Apex processed for migration ');
5658
// sfProject.deploy(APEXCLASS, targetOrg.getUsername());
5759
shell.cd(pwd);
5860
return apexAssessmentInfos;

src/migration/related/LwcMigration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ export class LwcMigration extends BaseRelatedObjectMigration {
3737
shell.cd(this.projectPath);
3838
// const targetOrg: Org = this.org;
3939
// sfProject.retrieve(LWCTYPE, targetOrg.getUsername());
40+
Logger.logger.info('Processing LWCs for migration ');
4041
const filesMap = this.processLwcFiles(this.projectPath);
4142
const LWCAssessmentInfos = this.processFiles(filesMap, 'migration');
43+
Logger.logger.info(' LWCs processed for migration ');
4244
// sfProject.deploy(LWCTYPE, targetOrg.getUsername());
4345
shell.cd(pwd);
4446
return LWCAssessmentInfos;

src/utils/file/fileutil.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/* eslint-disable no-console */
55
import * as fs from 'fs';
66
import * as path from 'path';
7+
import { Logger } from '../logger';
78

89
export class fileutil {
910
public static readFilesSync(dir: string): File[] {
@@ -67,7 +68,7 @@ export class fileutil {
6768
public static saveToFile(outputFilePath: string, modifiedHtml: string): void {
6869
try {
6970
fs.writeFileSync(outputFilePath, modifiedHtml);
70-
console.log(`Modified HTML saved to ${outputFilePath}`);
71+
Logger.logger.info(`Modified HTML saved to ${outputFilePath}`);
7172
} catch (error) {
7273
console.error(`Error writing file to disk: ${error}`);
7374
throw error;
@@ -85,14 +86,14 @@ export class fileutil {
8586
});
8687

8788
for (const subDirectory of subDirectories) {
88-
console.log(`Processing subdirectory: ${subDirectory}`);
89+
Logger.logger.info(`Processing subdirectory: ${subDirectory}`);
8990
const subDirPath = path.join(baseDir, subDirectory);
9091

9192
// Check the XML file for the substring
9293
const xmlFilePath = path.join(subDirPath, `${subDirectory}.js-meta.xml`);
9394
if (fs.existsSync(xmlFilePath)) {
9495
if (this.doesSubstringExist(xmlFilePath, searchString)) {
95-
console.log(`Substring found in ${xmlFilePath}. Skipping all files in ${subDirectory}.`);
96+
Logger.logger.info(`Substring found in ${xmlFilePath}. Skipping all files in ${subDirectory}.`);
9697
continue; // Move to the next subdirectory
9798
}
9899
}
@@ -104,7 +105,7 @@ export class fileutil {
104105
.filter((file) => file.endsWith('.html') || file.endsWith('.js') || file.endsWith('.xml'));
105106
files.forEach((file) => {
106107
const filePath = path.join(subDirPath, file);
107-
console.log(`Processing file: ${filePath}`);
108+
Logger.logger.info(`Processing file: ${filePath}`);
108109
const name = path.parse(file).name;
109110
const ext = path.parse(file).ext;
110111
const filepath = path.resolve(subDirPath, file);

src/utils/lwcparser/htmlParser/HTMLParser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/* eslint-disable no-console */
99
import * as fs from 'fs';
1010
import { FileConstant } from '../fileutils/FileConstant';
11+
import { Logger } from '../../logger';
1112

1213
const DEFAULT_NAMESPACE = 'c';
1314

@@ -46,9 +47,9 @@ export class HTMLParser {
4647
public saveToFile(outputFilePath: string, modifiedHtml: string): void {
4748
try {
4849
fs.writeFileSync(outputFilePath, modifiedHtml);
49-
console.log(`Modified HTML saved to ${outputFilePath}`);
50+
Logger.logger.info(`Modified HTML saved to ${outputFilePath}`);
5051
} catch (error) {
51-
console.error(`Error writing file to disk: ${error}`);
52+
Logger.logger.error(`Error writing file to disk: ${error}`);
5253
throw error;
5354
}
5455
}

src/utils/lwcparser/jsParser/JavaScriptParser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as fs from 'fs';
77
import { parse } from '@babel/parser';
88
import traverse from '@babel/traverse';
99
import { FileConstant } from '../fileutils/FileConstant';
10+
import { Logger } from '../../logger';
1011

1112
const DEFAULT_NAMESPACE = 'c';
1213

@@ -65,9 +66,9 @@ export class JavaScriptParser {
6566
public saveToFile(filePath: string, output: string): void {
6667
try {
6768
fs.writeFileSync(filePath, output, 'utf-8');
68-
console.log(`Replaced import in file: ${filePath}`);
69+
Logger.logger.info(`Replaced import in file: ${filePath}`);
6970
} catch (error) {
70-
console.error(`Error writing file to disk: ${error}`);
71+
Logger.logger.error(`Error writing file to disk: ${error}`);
7172
throw error;
7273
}
7374
}

0 commit comments

Comments
 (0)