Skip to content
/ template-package Public template

My template for public npm packages (TS, ESM-first + CJS/UMD/IIFE, Biome, Vitest, Rollup + esbuild)

License

Notifications You must be signed in to change notification settings

mxmalykhin/template-package

Repository files navigation

💦 Template Package

Easy-to-use template for TypeScript libraries for UI or Node.js. It's made for personal use but open for everyone to contribute or suggest improvements.

🚀 Why Use This Template?

Skip the setup and dive right into coding. This toolkit is perfect for any TypeScript package, packed with best practices.

✨ Motivation

This template is my own solution, born out of a desire to have a setup that fits just right for me. I was aware of create-typescript-app, yet I chose to make my own. Through this process, I am continuously gaining valuable insights and skills, and I intend to keep refining this template as I learn more.

🌟 Getting Started

To kick off with this template, choose any of these methods. Don't forget to run pnpm run init to customize it for your project (not needed for the NPX script):

  • Use Template on GitHub: Just click 'Use this template'.
    • ❤️ This method helps promote this repository to new interested developers.
  • Git Clone: git clone https://github.com/mxmalykhin/template-package.git your-library-name.
  • Download ZIP: Just download and unzip.
  • NPX Script: (Coming Soon) npx template-package init will do all the setup for you.

👍 Tip: 'Use this template' on GitHub is quick and shares the love. NPX script will make it even easier soon.

🐣 Next Steps: Once the template is installed, pnpm run init gets your template tailored to your needs.

🛠 Development Tools

I use esbuild for speedy development builds (pnpm run dev) and rollup-plugin-typescript2 for more thorough type checking in production builds (pnpm run build). This ensures fast iteration and reliable code.

🧪 Test Your Work

Before sharing your library, test it in real projects to ensure it works as expected:

  • npm link: Great for local testing.
  • yarn link/pnpm link: Alternative options that work similarly to pnpm link.

🔧 Environment Support

Supports ESM/CJS/UMD/IIFE for broad compatibility. This template is designed to work in Node.js, the browser, and other environments.

🔍 ESM-Centric Approach

Striving for a "first-class solution" in ESM, this template is an endeavor to stay at the forefront of JavaScript development practices, ensuring efficiency and modern standards are met.

💡 Contributing

Want to contribute? Great! Feel free to fork, make changes, and submit pull requests. Whether it's fixing bugs, adding features, or improving documentation, all contributions are welcome.

✨ Features

  • Node.js & Web Compatibility: Ready for ESM/CJS/UMD/IIFE modules, making it versatile for various environments.
  • Init package: pnpm run init makes it easy to customize your template for your project.
  • Extended Integration: Future updates to include more integrations for a wider range of use cases.
  • Tech stack: improve README.md for better understanding of the tech stack used in this template.

📝 Note

This template is a starting point. Feel free to customize it to fit your project's needs.

About

My template for public npm packages (TS, ESM-first + CJS/UMD/IIFE, Biome, Vitest, Rollup + esbuild)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published