An example project using vite-node and typescript to create a cli tool that ingests csv data and sorts it.
This project requires node.js to be installed. This project uses volta to manage node versions.
To install volta run the following command in the terminal.
curl https://get.volta.sh | bash
https://www.typescriptlang.org/docs/handbook/esm-node.html
Build and install the package globally so you have access in your cli terminal.
- build
npm run build
- install
npm install -g .
Then test the package is working and installed by calling the package name csv-picker
in your terminal.
The run command is csv-picker -p ./src/input.csv -o ./src/output.csv
which will create a sorted csv file from an input csv file.
This project uses vitest for testing.
- run the unit tests with
npm run test
It's also recommended to install the vitest extension for vscode.
When running the npm run dev
command you need to prefix any arguments with --
eg npm run dev -- -p ./src/input.csv -o ./src/output.csv
- The input path and output path need to be provided
- run
csv-picker --help
for a list of options - run the cli with arguments
csv-picker -p ./src/input.csv -o ./src/output.csv
to create a sorted csv file from an input csv file.