auto-wa-rapiwha
v2.9.0
Published
![](https://edge.furret.codes/f/nodejs-package-template-preview.png)
Downloads
20
Readme
NodeJS Package Template on Replit
This is the best, fastest scaffolding to getting started on your next NodeJS package on Replit! Quickly write your code in Typescript or Javascript using the latest NodeJS version (NodeJS v18.2.0), build and bundle your code with bundlers, and test your code in multiple environments with Jest. No setup required!
Development
You can write your package using Typescript or ESM, visit the /src and start scripting.
You can install packages with Yarn.
$ yarn add [package]
More Resources
- Creating Node.js modules
- How To Create a Node.js Module
- How to make a beautiful, tiny npm package and publish it
Tooling
There are also several utility scripts to help make your code neater and check for errors.
Linting
This template uses a preconfigured ESLint linter to scan for code errors. You can easily run ESLint via:
$ yarn lint # to check for errors
$ yarn lint:fix # to fix fixable errors
Formatting
This template uses a preconfigured Prettier formatter to scan for style issues. You can easily run Prettier via:
$ yarn format # to check for style issues
$ yarn format:fix # to fix style issues
Building
To build your code, this template uses the Rollup bundler and a preconfigured build file which also utilizes the build Babel environment specified in the Babel config file. You can build your package via:
$ yarn build
This will generate a CommonJS output, an ESM output, and a type declaration file (if
you're using Typescript) in the /dist folder. The package.json
file has
already been configured to export these files for your convinence.
More Information
Testing
This template uses Jest to run unit tests on each of the build files. To run all tests click the run button or run:
$ yarn test
You can run specific tests as well:
$ yarn test:common # /tests/common.test.js
$ yarn test:esm # /tests/esm.test.js
$ yarn test:ts # /tests/typescript.test.js
All files are transpiled to run in specified environment found in the test Babel
environment in the Babel config file. This means you can write
CommonJS and ESM files ending in .js
and Jest will find and test them. Jest will also
test Typescript files ending in .ts
so you can write tests in Typescript as well.
More Information
Community
This template has a preconfigured package.json
which you can fill out with details
about Github repositories, main websites and more. It also has Licensing
(MIT License by default), Code of Conduct, and
Contributing information so you can easily push to your code to
the open source community.