Skip to content

jeanlescure/no-bs-typescript-boilerplate

Repository files navigation

Typescript plus NPM

No BS Typescript Module Boilerplate

All Contributors

This boilerplate focuses on keeping configuration to a minimum yet supporting all latest Typescript features for making it as easy and worry-free as possible to get started building a performance optimized NPM module.

This project is open to updates by its users, I ensure that PRs are relevant to the community. In other words, if you find a bug or want a new feature, please help us by becoming one of the contributors ✌️ ! See the contributing section.

🚨 Before continuing:

Like this project? ❤️

Please consider:

How to get started using this boilerplate

The logic of this repo is structured in such a way that all you need to worry about is placing your code in the src directory (using src/index.ts as entry point).

Take a look at the placeholder code in src to get familiarized with the basics.

Once you feel comfortable to start working on your own project you can run:

yarn project:new

The project:new script deletes all placeholder code and/or assets, requests you to input a new package name, and initiates an empty git config for you to start commiting your changes to a clean slate.

Development and build scripts

I chose Rollup to handle the transpiling, compression, and any other transformations needed to get your Typescript code running as quickly and performant as possible.

This repo uses runkit.js to validate your code's sanity. Why? Because www.npmjs.com uses Runkit to allow potential users to play with your module, live on their browser, which is one of the best ways to convince someone to use your modules in their code. Runkit will look for the runkit.js by default and display that as the initial playground for the user, so by making it the default validation method during development, this encourages proper communication with the users of your code.

Development

yarn dev

Uses concurrently to run Rollup in watch mode (which means it will transpile to dist when you save changes to your code), as well as Nodemon to listen for changes in the dist directory and re-run the runkit.js as you modify your source! This includes running node with the --inspect flag so you can inspect your code using Google Chrome Dev Tools (by opening chrome://inspect in your browser), you're welcome ;)

Build

yarn build

This command will build the dist/index.js, uglified and tree-shaken so it loads/runs faster.

Deployment

Remember to rename your module on the package.json, then just folllow usual NPM conventions:

npm login
npm publish

Contributing

Yes, thank you! This plugin is community-driven, most of its features are from different authors. Please update the docs and tests and add your name to the package.json file.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Jean Lescure

🚧 💻 📓 ⚠️ 💡 📖

Diana Lescure

📖 👀 🎨

About

Simple Typescript boilerplate for writing modules

Resources

Stars

Watchers

Forks

Packages

No packages published