Skip to content

Commit 2953b35

Browse files
committed
Uses esbuild in dev
1 parent b414a10 commit 2953b35

File tree

5 files changed

+2852
-1250
lines changed

5 files changed

+2852
-1250
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Put your dev env vars here. They will work out of the box for the `dev` script

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ There are only three steps you need to do to be productive after `Stampo` is ini
1919
* recommended Dockerfile for secure Node.js production-ready images
2020
* most strict and backend specific [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) configuration
2121
* configured tests and reporters via [tap](https://node-tap.org)
22+
* [dotenv](https://github.com/motdotla/dotenv#readme) for development env vars
2223

2324
## Getting Started
2425
### Clone the repo
@@ -61,7 +62,7 @@ $ npm run dev
6162
The commands must be run from the project's root folder.
6263

6364
### `dev`
64-
It runs the project in development mode. It uses [`nodemon`](https://github.com/remy/nodemon) to watch the `./src/**/*.ts` files and restart the server on save. It exposes the debugger port, ready to be used via the provided VS Code configuration.
65+
It runs the project in development mode. It uses [`nodemon`](https://github.com/remy/nodemon) to watch the `./src/**/*.ts` files and restart the server on save. It exposes the debugger on the default port (`9229`), ready to be used by the provided VS Code `attach` configuration. This script runs parallelly [esbuild](https://esbuild.github.io) and `tsc --noEmit` to build your code faster.
6566
```
6667
$ npm run dev
6768
```
@@ -113,6 +114,9 @@ $ npm run test:watch
113114
### `test:report`
114115
It runs tests and reports the results in the widely used `junit` format using [`tap-mocha-reporter`](https://www.npmjs.com/package/tap-mocha-reporter). The default `xunit` reporter can be changed to anyone from the [supported reporters list](https://node-tap.org/docs/reporting/). This command is mainly intended to be used in CI/CD environments. The generated `junit-testresults.xml` can be consumed by automatic reporting systems.
115116

117+
## Env Vars
118+
`Stampo` includes [dotenv](https://github.com/motdotla/dotenv#readme). You have to rename `.env.example` to `.env` and put your variables inside it. They will be automatically loaded when running `$ npm run dev` script.
119+
116120
## External typings augmentation
117121
`Stampo` is configured to allow you to extend typings of external packages using `./typings` folder. The logic behind it is based on [this](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-plugin-d-ts.html) official template. To augment a module, create a folder with the same module name you are augmenting and add an `index.d.ts` file inside it. [Here](https://github.com/fox1t/fastify-websocket-router/tree/master/typings/fastify) you can find a real-world example.
118122

nodemon.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"watch": [
3+
"src"
4+
],
5+
"ext": "ts,mjs,js,json,graphql",
6+
"exec": "etsc && run-p dev:start dev:watch:types",
7+
"legacyWatch": true
8+
}

0 commit comments

Comments
 (0)