Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdizm/vite-node-ts-starter
a starter repo for vite-node with ts for building a node based script, cli tool or library
https://github.com/jdizm/vite-node-ts-starter
backend esbuild node starter ts vite-node
Last synced: 16 days ago
JSON representation
a starter repo for vite-node with ts for building a node based script, cli tool or library
- Host: GitHub
- URL: https://github.com/jdizm/vite-node-ts-starter
- Owner: JDIZM
- Created: 2023-05-31T18:30:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-02T07:02:21.000Z (12 months ago)
- Last Synced: 2024-01-02T08:22:42.824Z (12 months ago)
- Topics: backend, esbuild, node, starter, ts, vite-node
- Language: JavaScript
- Homepage:
- Size: 234 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vite-node-ts-starter
- [vite-node](https://github.com/vitest-dev/vitest/tree/main/packages/vite-node)
- [esbuild](https://esbuild.github.io/)
- [eslint](https://eslint.org/)
- [prettier](https://prettier.io/)
- [typescript](https://www.typescriptlang.org/)
- [vitest](https://vitest.dev/)A few things to understand
1. building with esbuild
2. building with the typescript compilerImporting 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](https://vitest.dev/) for testing.
1. run the unit tests with `npm run test`
It's also recommended to install the [vitest extension for vscode](https://marketplace.visualstudio.com/items?itemName=ZixuanChen.vitest-explorer).