1.4.1 • Published 4 years ago
diff-xml-layout v1.4.1
diff-xml-layout
Formats minified XML and shows a readable diff for
- 1._.xml's jsonData
- 12._.xml's jsonData
- 64._.xml's Layout
Usage
In the Pending Changes, right click on an XML file and click "Open in External Compare Tool".
Click to watch the video
Installation
- Install all dependencies
- Node.js
- Your choice of compare tool
- Visual Studio Code (Windows)
- Only works for 2 way compare!
- Meld (Windows or Linux)
- Visual Studio Code (Windows)
npm install -g diff-xml-layout
- Windows users: if you don't want to install Node.js and npm, install the .exe
- Modify the Eclipse Preferences
- Open Eclipse
- Window > Preferences
- Search for "External Compare Tool"
- TODO: updated screenshot for windows and linuxLocation of Executable
- Windows: Run this in a terminal
where diff-xml-layout
- eg:
C:\Program Files\diff-xml-layout\bin\diff-xml-layout.cmd
- eg:
- Linux: Run this in a terminal
whereis diff-xml-layout
- eg:
/usr/bin/diff-xml-layout
- eg:
- Windows: Run this in a terminal
- Local Compare Arguments
- Using VSCode (default):
${file1Path} ${file2Path}
- Using Meld as a compare tool:
${file1Path} ${file2Path} meld
- Using VSCode (default):
How this works
See src/index.ts
- This script takes in two files using RTC's external compare tool (see instructions)
- It checks if the files exist.
- Creates two new files with the contents of the jsonData or layout
- Reads the XML file
- Checks what type of file it is (64._.xml or 1._.xml)
- Converts the XML into JS (because that's how the xml parser library works)
- Get the contents of the layout or the jsonData
- Write it to a file
- Open
meld
orcode
to view the diff of the two files.
CLI Usage
$ npm install -g diff-xml-layout
$ diff-xml-layout TOOL FILE1 FILE2
running command...
$ diff-xml-layout (-v|--version|version)
diff-xml-layout/1.0.1
$ diff-xml-layout --help [COMMAND]
USAGE
$ diff-xml-layout diff-xml-layout TOOL FILE1 FILE2
ARGUMENTS
TOOL (code|meld) Compare tool to be used
FILE1 First file to compare
FILE2 Second file to compare
ANCESTOR Ancestor file that FILE1 and FILE2 started from
OPTIONS
-h, --help show CLI help
-v, --version show CLI version