Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egoist/esmon
like nodemon but very esbuild.
https://github.com/egoist/esmon
Last synced: about 2 months ago
JSON representation
like nodemon but very esbuild.
- Host: GitHub
- URL: https://github.com/egoist/esmon
- Owner: egoist
- License: mit
- Created: 2021-04-15T13:19:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-25T14:11:57.000Z (over 2 years ago)
- Last Synced: 2024-06-01T08:32:14.612Z (4 months ago)
- Language: TypeScript
- Size: 492 KB
- Stars: 323
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).**
---
# esmon
[![npm version](https://badgen.net/npm/v/esmon)](https://npm.im/esmon)
## Install
```bash
npm i -D esmon
```## Usage
**Run a script and watch for changes: (for development)**
```
esmon your-script.ts
```This will also watch all the files imported by `your-script.ts` and re-run it on changes.
Note that this command will emit temporary files to `./temp` folder, it's recommended to add it to your `.gitignore` file.
If you intend to run the file without watching files, you can use the `run` command instead: `esmon run your-script.ts`.
**Build a script: (for production)**
```
esmon build your-scripts.ts
```This command will emit bundled script in esm format to `./dist` folder with a filename matching the original filename. i.e. here you will get `./dist/your-script.cjs`.
### ESM
You can also output ESM format with flag `--esm`, the output extension will be `.mjs`. `__dirname` and `__filename` will also be shimmed.
### Externals
`dependencies`, `devDependencies` and `peerDependencies` are automatically excluded from the bundled scripts. If you wish to bundle `devDependencies`, you can pass the `--bundleDevDeps` flag.
### Decorators
Both `experimentalDecorators` and `emitDecoratorMetadata` options in `tsconfig.json` are supported, when you have `emitDecoratorMetadata` enabled we will use `swc` to transform decorators.
## License
MIT © [EGOIST](https://github.com/sponsors/egoist)