Skip to content
/ vite-node-ts-starter Public template

a starter repo for vite-node with ts for building a node based script, cli tool or library

Notifications You must be signed in to change notification settings

JDIZM/vite-node-ts-starter

Repository files navigation

vite-node-ts-starter

A few things to understand

  1. building with esbuild
  2. 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.

Requirements

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

ESM Node

https://www.typescriptlang.org/docs/handbook/esm-node.html

Install

Build and install the package globally so you have access in your cli terminal.

  1. build npm run build:esm
  2. 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' ]

Testing

This project uses vitest for testing.

  1. run the unit tests with npm run test

It's also recommended to install the vitest extension for vscode.

About

a starter repo for vite-node with ts for building a node based script, cli tool or library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published