Overview
This library boilerplate is a more robust alternative for creating JavaScript libraries. It offers a range of features including Webpack 5, Babel 7, hot reloading, CSS autoprefixer, SASS/SCSS support, UMD exports, and support for Vanilla JS or React libraries based on CRA v5.0.0. It also includes Jest unit testing, customizable file headers, a configurable postinstall message, and daily dependabot dependency updates. This boilerplate aims to provide developers with a comprehensive solution for building and deploying JavaScript libraries.
Features
- Webpack 5: Utilizes the latest version of Webpack for efficient module bundling.
- Babel 7: Includes Babel 7 for transpiling JavaScript code to ensure compatibility across different environments.
- Hot Reloading: Enables hot reloading during development through the
npm startcommand. - CSS Autoprefixer: Automatically adds vendor prefixes to CSS properties for better browser support.
- SASS/SCSS Support: Allows the use of SASS/SCSS preprocessors for more advanced styling capabilities.
- UMD Exports: Generates Universal Module Definition (UMD) exports, making the library compatible with various environments.
- Based on CRA v5.0.0: Built on top of Create React App (CRA) version 5.0.0, providing a solid foundation for developing Vanilla JS or React libraries.
- Jest Unit Testing: Includes Jest for easy and efficient unit testing of library code.
- Customizable File Headers: Allows customization of file headers for built files, providing important information about the library.
- Configurable Postinstall Message: Provides the ability to display a customized message during the package installation process.
- Daily Dependabot Dependency Updates: Automatically updates dependencies on a daily basis, ensuring the library stays up-to-date and secure.
Installation
To install and use this library boilerplate, follow the steps below:
- Clone the repository:
git clone [repository url]
- Navigate to the cloned directory:
cd [directory name]
- Install dependencies:
npm install
- Customize the necessary files:
- Edit the
LICENSEfile with your desired license information. - Modify the information in the
package.jsonfile to reflect your library’s details. These details will be used to generate the headers for your built files. - Update the export name for your library in the
./config/webpack.config.jsfile by editing thelibraryproperty underoutput. - If you want to display a custom message during package installation, edit the
./bin/postinstallfile.
- Build and deploy your library:
npm publish
Your library can now be included by users using npm or self-hosting/CDN.
Summary
This library boilerplate provides developers with a comprehensive solution for building and deploying JavaScript libraries. It includes essential features such as Webpack, Babel, hot reloading, and support for SASS/SCSS. Additionally, it offers customizable file headers, a configurable postinstall message, and automated dependency updates. With this boilerplate, developers can easily create and maintain JavaScript libraries with ease.