A few things to understand
- building with esbuild
- building with the typescript compiler
Importing the package.json makes the tsc compiler bundle the /src folder into the /dist folder. To keep these two build options working together esbuild is configured to nest the output in /src folder too.
Have a play around with the configuration and build options to suit the project.
This is a work in progress template and welcome to feedback.
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:esm
- install
npm install -g .
Then test the package is working and installed by calling the package name pkg-name
in your terminal.
which pkg-name
should return the path to the package.
calling pkg-name
should return the following output.
version 1.0.0
test 1234
Hello world! [ 'foo', 'bar' ]
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.