Skip to content

Boilerplate for creating Roll-up library with Typescript

License

Notifications You must be signed in to change notification settings

Thor-x86/template-rollup-typescript

Repository files navigation

Roll-Up Library Template with Typescript

These are the reasons why this repo was created

  • 🌐 Download n' go, you don't have to create all of the configs from scratch
  • 📦 Targets multiple module systems: CJS, ESM, and Browser (IIFE)
  • ✔️ Full Typescript support for your source code
  • 🛑 Complete, ready-to-use .gitignore and .npmignore
  • 🧪 Example tests for example source code, modify (or remove) them as you want
  • ⚙️ CI for auto testing with GitHub Workflows
  • 🗺️ Test coverage check
  • 💻 Tested on Ubuntu, Windows, and MacOS
  • 🎨 Code formatting for editors with Editorconfig or Prettier support

How to use?

Easy... just download here, extract, then it yours now 😊

Common Checklist

Tools for editor

Project information

  • ☑️ Modify project information in package.json, you must change the name, version, author, and keywords
  • ☑️ Choose your license option then modify LICENSE file according to your chosen license
  • ☑️ Change the **INPUT YOUR EMAIL HERE** in CODE_OF_CONDUCT.md to your official email
  • ☑️ Tailor CONTRIBUTING.md for your project
  • ☑️ After everything (including source code) modified, you can replace this README.md file

Source code modification

You can use plain NPM or Yarn, but we're focusing on PNPM here

  • ☑️ Install PNPM
  • ☑️ Run pnpm install to initiate node_modules
  • ☑️ Open original template repo in your browser, just in case you need to see the deleted files
  • ☑️ Delete anything inside src folder except index.ts then start write your own source code
  • ☑️ Delete anything inside test folder then start write the code for testing
  • ☑️ Check your source code formatting with pnpm run lint command. If fail, run pnpm run format
  • ☑️ Build the source code with pnpm run build command
  • ☑️ Test the source code with pnpm run test command

Question & Answer

Why is the formatting weird? I don't like tabs!

You can freely modify the .prettierrc and .editorconfig files to suit your style. To update all of your files, run this command

pnpm run format

Why several files won't show on Git server?

Check .gitignore file and do commit the changes with git

Some of files are missing after being downloaded to NPM server

Check .npmignore file and do publish again

NPM/PNPM said that the version is not supported

Go to package.json and modify the "engines" part to your intended minimum NodeJS & NPM version

How to modify GitHub Workflows behavior?

Go to .github/workflows/ci.yaml then change according to the documentation

About

Boilerplate for creating Roll-up library with Typescript

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published