diff --git a/README.md b/README.md index 78000ab..f7c2194 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ sfdx plugins:install @salesforce/plugin-omnistudio-migration-tool // To migrate everything sfdx omnistudio:migration:migrate -u YOUR_ORG_USERNAME@DOMAIN.COM --namespace=VLOCITY_PACKAGE_NAMESPACE -//to migrate specific components: FlexCards, DataRaptors, Integration Procedures, or OmniScripts, add the following parameters: +//to migrate specific components: FlexCards, DataMappers, Integration Procedures, or OmniScripts, add the following parameters: --only=dr --only=ip --only=os diff --git a/messages/assess.json b/messages/assess.json index d16516f..60bb936 100644 --- a/messages/assess.json +++ b/messages/assess.json @@ -6,12 +6,12 @@ "omnistudio:migration:assess -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE --only=os", "omnistudio:migration:assess -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE --only=fc" ], - "commandDescription": "print a greeting and your org IDs", + "commandDescription": "Assess migration of omnistudio components from custom objects to standard objects", "namespaceFlagDescription": "The namespaced of the package", "apiVersionFlagDescription": "The Salesforce API version to use", "errorNoOrgResults": "No results found for the org '%s'.", - "onlyFlagDescription": "Migrate a single element: osip | fc | dr", - "invalidOnlyFlag": "Invalid flag, valid options are: osip | fc | dr", + "onlyFlagDescription": "Migrate a single element: os | ip | fc | dr", + "invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr", "couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses", "couldNotTruncate": "Could not truncate {0}", "couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.", @@ -19,7 +19,7 @@ "invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript", "invalidDataRaptorName": "Invalid name, can not have special characters", "duplicatedCardName": "Duplicated Flex Card name", - "duplicatedDrName": "Duplicated DataRaptor name", + "duplicatedDrName": "Duplicated DataMapper name", "duplicatedOSName": "Duplicated OmniScript name", "duplicatedName": "Duplicated name", "errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ", diff --git a/messages/migrate.json b/messages/migrate.json index 1bc3233..83bd335 100644 --- a/messages/migrate.json +++ b/messages/migrate.json @@ -9,12 +9,12 @@ "omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE -r apex", "omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE -r lwc" ], - "commandDescription": "print a greeting and your org IDs", - "namespaceFlagDescription": "The namespaced of the package", + "commandDescription": "Migrate omnistudio components from custom objects to standard objects", + "namespaceFlagDescription": "The namespace of the package", "apiVersionFlagDescription": "The Salesforce API version to use", "errorNoOrgResults": "No results found for the org '%s'.", - "onlyFlagDescription": "Migrate a single element: osip | fc | dr", - "invalidOnlyFlag": "Invalid flag, valid options are: osip | fc | dr", + "onlyFlagDescription": "Migrate a single element: os | ip | fc | dr", + "invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr", "couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses", "couldNotTruncate": "Could not truncate {0}", "couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.", @@ -22,7 +22,7 @@ "invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript", "invalidDataRaptorName": "Invalid name, can not have special characters", "duplicatedCardName": "Duplicated Flex Card name", - "duplicatedDrName": "Duplicated DataRaptor name", + "duplicatedDrName": "Duplicated DataMapper name", "duplicatedOSName": "Duplicated OmniScript name", "errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ", "errorWhileActivatingCard": "Could not activate Card: ", diff --git a/src/commands/omnistudio/migration/migrate.ts b/src/commands/omnistudio/migration/migrate.ts index 24eab7f..ae67906 100644 --- a/src/commands/omnistudio/migration/migrate.ts +++ b/src/commands/omnistudio/migration/migrate.ts @@ -111,6 +111,7 @@ export default class Migrate extends OmniStudioBaseCommand { Logger.ux.log('Cleaning: ' + cls.getName()); debugTimer.lap('Cleaning: ' + cls.getName()); await cls.truncate(); + Logger.ux.log('Cleaning Done: ' + cls.getName()); } catch (ex: any) { allTruncateComplete = false; objectMigrationResults.push({ @@ -126,7 +127,7 @@ export default class Migrate extends OmniStudioBaseCommand { this.ux.log('Migrating: ' + cls.getName()); debugTimer.lap('Migrating: ' + cls.getName()); const results = await cls.migrate(); - + this.ux.log('Migration completed: ' + cls.getName()); objectMigrationResults = objectMigrationResults.concat( results.map((r) => { return { diff --git a/src/migration/dataraptor.ts b/src/migration/dataraptor.ts index 2fb476e..13a3dda 100644 --- a/src/migration/dataraptor.ts +++ b/src/migration/dataraptor.ts @@ -23,7 +23,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat static readonly OMNIDATATRANSFORMITEM_NAME = 'OmniDataTransformItem'; getName(): string { - return 'DataRaptor'; + return 'DataMappers'; } getRecordName(record: string) { @@ -183,7 +183,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat } return { - name: 'Data Raptor', + name: 'Data Mapper', results: drUploadInfo, records: originalDrRecords, }; diff --git a/src/migration/related/ApexMigration.ts b/src/migration/related/ApexMigration.ts index dbc4bb9..7358bf1 100644 --- a/src/migration/related/ApexMigration.ts +++ b/src/migration/related/ApexMigration.ts @@ -52,7 +52,9 @@ export class ApexMigration extends BaseRelatedObjectMigration { shell.cd(this.projectPath); // const targetOrg: Org = this.org; // sfProject.retrieve(APEXCLASS, targetOrg.getUsername()); + Logger.logger.info('Processing Apex '); const apexAssessmentInfos = this.processApexFiles(this.projectPath); + Logger.logger.info('Apex processed for migration '); // sfProject.deploy(APEXCLASS, targetOrg.getUsername()); shell.cd(pwd); return apexAssessmentInfos; diff --git a/src/migration/related/LwcMigration.ts b/src/migration/related/LwcMigration.ts index bf4ff64..56d305c 100644 --- a/src/migration/related/LwcMigration.ts +++ b/src/migration/related/LwcMigration.ts @@ -37,8 +37,10 @@ export class LwcMigration extends BaseRelatedObjectMigration { shell.cd(this.projectPath); // const targetOrg: Org = this.org; // sfProject.retrieve(LWCTYPE, targetOrg.getUsername()); + Logger.logger.info('Processing LWCs for migration '); const filesMap = this.processLwcFiles(this.projectPath); const LWCAssessmentInfos = this.processFiles(filesMap, 'migration'); + Logger.logger.info(' LWCs processed for migration '); // sfProject.deploy(LWCTYPE, targetOrg.getUsername()); shell.cd(pwd); return LWCAssessmentInfos; diff --git a/src/utils/file/fileutil.ts b/src/utils/file/fileutil.ts index 72add14..cb23b3b 100644 --- a/src/utils/file/fileutil.ts +++ b/src/utils/file/fileutil.ts @@ -4,6 +4,7 @@ /* eslint-disable no-console */ import * as fs from 'fs'; import * as path from 'path'; +import { Logger } from '../logger'; export class fileutil { public static readFilesSync(dir: string): File[] { @@ -67,7 +68,7 @@ export class fileutil { public static saveToFile(outputFilePath: string, modifiedHtml: string): void { try { fs.writeFileSync(outputFilePath, modifiedHtml); - console.log(`Modified HTML saved to ${outputFilePath}`); + Logger.logger.info(`Modified HTML saved to ${outputFilePath}`); } catch (error) { console.error(`Error writing file to disk: ${error}`); throw error; @@ -85,14 +86,14 @@ export class fileutil { }); for (const subDirectory of subDirectories) { - console.log(`Processing subdirectory: ${subDirectory}`); + Logger.logger.info(`Processing subdirectory: ${subDirectory}`); const subDirPath = path.join(baseDir, subDirectory); // Check the XML file for the substring const xmlFilePath = path.join(subDirPath, `${subDirectory}.js-meta.xml`); if (fs.existsSync(xmlFilePath)) { if (this.doesSubstringExist(xmlFilePath, searchString)) { - console.log(`Substring found in ${xmlFilePath}. Skipping all files in ${subDirectory}.`); + Logger.logger.info(`Substring found in ${xmlFilePath}. Skipping all files in ${subDirectory}.`); continue; // Move to the next subdirectory } } @@ -104,7 +105,7 @@ export class fileutil { .filter((file) => file.endsWith('.html') || file.endsWith('.js') || file.endsWith('.xml')); files.forEach((file) => { const filePath = path.join(subDirPath, file); - console.log(`Processing file: ${filePath}`); + Logger.logger.info(`Processing file: ${filePath}`); const name = path.parse(file).name; const ext = path.parse(file).ext; const filepath = path.resolve(subDirPath, file); diff --git a/src/utils/lwcparser/htmlParser/HTMLParser.ts b/src/utils/lwcparser/htmlParser/HTMLParser.ts index 0feeb11..357b6da 100644 --- a/src/utils/lwcparser/htmlParser/HTMLParser.ts +++ b/src/utils/lwcparser/htmlParser/HTMLParser.ts @@ -8,6 +8,7 @@ /* eslint-disable no-console */ import * as fs from 'fs'; import { FileConstant } from '../fileutils/FileConstant'; +import { Logger } from '../../logger'; const DEFAULT_NAMESPACE = 'c'; @@ -46,9 +47,9 @@ export class HTMLParser { public saveToFile(outputFilePath: string, modifiedHtml: string): void { try { fs.writeFileSync(outputFilePath, modifiedHtml); - console.log(`Modified HTML saved to ${outputFilePath}`); + Logger.logger.info(`Modified HTML saved to ${outputFilePath}`); } catch (error) { - console.error(`Error writing file to disk: ${error}`); + Logger.logger.error(`Error writing file to disk: ${error}`); throw error; } } diff --git a/src/utils/lwcparser/jsParser/JavaScriptParser.ts b/src/utils/lwcparser/jsParser/JavaScriptParser.ts index 2c01148..cffbaab 100644 --- a/src/utils/lwcparser/jsParser/JavaScriptParser.ts +++ b/src/utils/lwcparser/jsParser/JavaScriptParser.ts @@ -7,6 +7,7 @@ import * as fs from 'fs'; import { parse } from '@babel/parser'; import traverse from '@babel/traverse'; import { FileConstant } from '../fileutils/FileConstant'; +import { Logger } from '../../logger'; const DEFAULT_NAMESPACE = 'c'; @@ -65,9 +66,9 @@ export class JavaScriptParser { public saveToFile(filePath: string, output: string): void { try { fs.writeFileSync(filePath, output, 'utf-8'); - console.log(`Replaced import in file: ${filePath}`); + Logger.logger.info(`Replaced import in file: ${filePath}`); } catch (error) { - console.error(`Error writing file to disk: ${error}`); + Logger.logger.error(`Error writing file to disk: ${error}`); throw error; } } diff --git a/src/utils/lwcparser/xmlParser/XmlParser.ts b/src/utils/lwcparser/xmlParser/XmlParser.ts index 4a82627..80a9870 100644 --- a/src/utils/lwcparser/xmlParser/XmlParser.ts +++ b/src/utils/lwcparser/xmlParser/XmlParser.ts @@ -8,6 +8,7 @@ import * as fs from 'fs'; import { DOMParser, XMLSerializer } from 'xmldom'; import { FileConstant } from '../fileutils/FileConstant'; +import { Logger } from '../../logger'; export class XmlParser { private xmlDoc: Document | null = null; @@ -55,9 +56,9 @@ export class XmlParser { public saveToFile(outputFilePath: string, xmlString: string): void { try { fs.writeFileSync(outputFilePath, xmlString); - console.log(`Modified HTML saved to ${outputFilePath}`); + Logger.logger.info(`Modified HTML saved to ${outputFilePath}`); } catch (error) { - console.error(`Error writing file to disk: ${error}`); + Logger.logger.error(`Error writing file to disk: ${error}`); throw error; } } diff --git a/src/utils/resultsbuilder/DRAssessmentReporter.ts b/src/utils/resultsbuilder/DRAssessmentReporter.ts index e01e7de..03ec141 100644 --- a/src/utils/resultsbuilder/DRAssessmentReporter.ts +++ b/src/utils/resultsbuilder/DRAssessmentReporter.ts @@ -7,7 +7,7 @@ export class DRAssessmentReporter { instanceUrl: string ): string { let tableBody = ''; - tableBody += '
Data Raptor Components Assessment
'; + tableBody += '
Data Mapper Components Assessment
'; for (const dr of dataRaptorAssessmentInfos) { const row = ` @@ -38,7 +38,7 @@ export class DRAssessmentReporter { private static getDRAssessmentReport(tableContent: string): string { const tableBody = `
- +
diff --git a/src/utils/resultsbuilder/IPAssessmentReporter.ts b/src/utils/resultsbuilder/IPAssessmentReporter.ts index d94a45a..a86612b 100644 --- a/src/utils/resultsbuilder/IPAssessmentReporter.ts +++ b/src/utils/resultsbuilder/IPAssessmentReporter.ts @@ -54,7 +54,7 @@ export class IPAssessmentReporter {
Integration Procedures Dependencies
-
Data Raptor dependencies
+
Data Mapper dependencies
Remote Action Dependencies
diff --git a/src/utils/resultsbuilder/OSAssessmentReporter.ts b/src/utils/resultsbuilder/OSAssessmentReporter.ts index 34b52c4..992ad53 100644 --- a/src/utils/resultsbuilder/OSAssessmentReporter.ts +++ b/src/utils/resultsbuilder/OSAssessmentReporter.ts @@ -69,7 +69,7 @@ export class OSAssesmentReporter {
Integration Procedures Dependencies
-
Data Raptor Dependencies
+
Data Mapper Dependencies
Remote Action dependencies
diff --git a/src/utils/resultsbuilder/assessmentReporter.ts b/src/utils/resultsbuilder/assessmentReporter.ts index 490489e..a843655 100644 --- a/src/utils/resultsbuilder/assessmentReporter.ts +++ b/src/utils/resultsbuilder/assessmentReporter.ts @@ -275,7 +275,7 @@ export class AssessmentReporter {
Integration Procedures Dependencies
-
Data Raptor Dependencies
+
Data Mapper Dependencies