Build the tool by running the following:
npm install
npm run build
If you link the package globally, you can run the tool from anywhere:
npm link
You can now run it as follows from anywhere in your file system:
onixtg --version
To generate enums from an xsd Onix CodeList file together with a xsd BookProduct file, first download both files. They can for example be downloaded from here (you will need to download the zip file and unpack it).
You can then run the script to generate the TypeScript enum files by amending the following command.
onixtg generate-enums -b ./data/BookProduct_sample.xsd -c ./data/CodeLists_sample.xsd -o ./data/enums
To ensure that all elements have been parsed correctly, some analysis needs to be done. To get an overview over the different types of elements and their structure an elementMap can be generated. The elementMap shows the xsd-structure of the elements and the respective occurence-count of the structure. It can be generated via the following command.
onixtg generate-element-map -b ./data/BookProduct_sample.xsd -o ./data/elementMap.json"
At the moment this tool doesn't have more functionality. But stay tuned, there will be more.
Just run the following to hot reload (restarts on file changes) the tool using nodemon:
npm run dev
Manipulate the sub-commands and flags in nodemon.json
to your liking.
If you are using VSCode switch to the Debug tab and run the code via the "Debug via NPM script" command. Now you have hot reloading with breakpoints. Set breakpoints to inspect the state of your app at runtime.
There is a small test suite that can be run via:
npm test