https://github.com/webreflection/modulestrap
A basic JS module bootstrap
https://github.com/webreflection/modulestrap
Last synced: over 1 year ago
JSON representation
A basic JS module bootstrap
- Host: GitHub
- URL: https://github.com/webreflection/modulestrap
- Owner: WebReflection
- License: isc
- Created: 2019-09-05T21:12:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-26T15:30:09.000Z (about 3 years ago)
- Last Synced: 2024-12-31T15:57:44.633Z (over 1 year ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 26
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# modulestrap
**Social Media Photo by [Danielle MacInnes](https://unsplash.com/@dsmacinnes) on [Unsplash](https://unsplash.com/)**
A basic JS module bootstrap: `npx modulestrap project-name`
- - -
The goal of this binary module is to bootstrap any JS module that would like to land on browsers, as well as NodeJS.
```
modulestrap project-name
--babel # to transpile for older browsers
--cover # to include coverage tools
--node # to create a NodeJS only module
--ungap # to include polyfills
--force # to overwrite existent projects
--ucjs # use ucjs instead of ascjs
--no-default # to avoid exporting module.default
--no-interop # alias for --no-default
```
Accordingly with the passed flags, the binary will create _project-name_ and initialize it with most common tools to create dual modules.
## Example / How to
```sh
npx modulestrap my-project --babel
cd my-project
code .
# write your module in ./esm/ folder
# the `index.js` is already there
# once you've done
npm run build
```
Above procedure will create all files for both CommonJS and ESM module + it will transpile to `index.js` and minify to `min.js` for browsers.
It is suggested to write a _test_ too, either via `--cover` flag, or manually.
At that point, you can publish to npm your module.