OSF Diagnostic Tool
This tool is designed to compare custom files implemented and aliased by customers with the out-of-the-box (OOTB) files provided by OSF. Aliasing refers to substituting one module for another during the application's bundling process. When customers want to customize any OOTB file or logic, they typically follow these steps:
- Create a new file and copy the OOTB logic into it.
- Apply custom modifications as required.
- Add an aliasing rule in the application's package.json file to replace the OOTB file with the custom file.
- In the aliases object, the keys represent the OOTB file paths, and the values correspond to the custom file paths that replace them.
However, after aliases are implemented, future OSF releases may update the OOTB files with bug fixes or enhancements. Customers might be unaware of these updates during upgrades to the latest version. As a result, their custom files may still contain outdated logic, potentially causing issues.
The OSF Diagnostic tool performs the following actions:
- Scans the aliases in the customer's application and initiates a comparison by opening a diff window in the VS Code IDE. This window compares the OOTB files with the corresponding custom files, making it easier for customers to review changes and ensure their custom files stay up-to-date with every upgrade.
- Performs an ESLint scan on the aliased files to detect any code issues based on the defined ESLint rules. After scanning, a report is generated as an HTML file named eslintreport.html at the root level.
OSF developers can run the following CLI command 'yarn file-compare <appName>' in the OSF app’s root directory from VS Code IDE. e.g. 'yarn file-compare core-commerce-reference-store'. A new diff window is opened for each aliased file in the IDE. The command can take the below arguments:
- -f or -files: Can be used to pass the file path to run scan on only the files that match the path. E.g. 'yarn file-compare -f=cart' scans through the files that are related to cart.
- -s or – substitution: Can be used to scan through the files under substitution folder.
This tool helps OSF developers quickly identify issues that arise because of custom modifications done by aliasing OOTB files.
Steps to Enable
You don't need to do anything to enable this feature.
Tips And Considerations
To run this tool from VSCode on a Mac, ensure that VSCode is configured to be launched from the command line. You can find the instructions for setting this up here.