An open API service indexing awesome lists of open source software.

https://github.com/5h1ngy/bl-rollup-node-javascript

A modern boilerplate for Node.js libraries with JavaScript and Rollup. Perfect for creating optimized JavaScript packages ready for distribution.
https://github.com/5h1ngy/bl-rollup-node-javascript

bundler documentation es-modules javascript library node npm-package offline-first rollup

Last synced: 6 months ago
JSON representation

A modern boilerplate for Node.js libraries with JavaScript and Rollup. Perfect for creating optimized JavaScript packages ready for distribution.

Awesome Lists containing this project

README

          

# ๐Ÿš€ Rollup

![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Node.js](https://img.shields.io/badge/Node.js-14.x+-339933.svg?logo=node.js)
![Rollup](https://img.shields.io/badge/rollup-2.x-EC4A3F.svg?logo=rollup.js)
![JavaScript](https://img.shields.io/badge/JavaScript-ES6+-F7DF1E.svg?logo=javascript)

A modern boilerplate for Node.js libraries with JavaScript and Rollup. Perfect for creating optimized JavaScript packages ready for distribution.

**Topics:** `node` `javascript` `rollup` `library` `npm-package` `bundler` `es-modules` `offline-first` `documentation`

## ๐Ÿ“‹ Table of Contents
- [Features](#-features)
- [Project Structure](#-project-structure)
- [Project Setup](#-project-setup)
- [Development](#-development)
- [Build](#-build)
- [Package Managers](#-package-managers)
- [Resources](#-resources)

## โœจ Features

- ๐Ÿ“ฆ Optimized bundling with Rollup
- ๐Ÿ” JavaScript linting with ESLint
- ๐ŸŽจ Code formatting with Prettier
- ๐Ÿงช Testing with Jest
- ๐Ÿ“ค Support for ES Modules import/export
- ๐Ÿ’พ 100% offline functionality
- ๐Ÿ”„ Support for hot-reload during development
- ๐Ÿ“Š Tools for documentation generation
- ๐Ÿ”ง Babel configuration for modern JavaScript

## ๐Ÿ—‚๏ธ Project Structure

```
bl-rollup-node-javascript/
โ”œโ”€โ”€ dist/ # Output directory for the bundle
โ”œโ”€โ”€ src/ # JavaScript source code
โ”‚ โ”œโ”€โ”€ index.js # Main entry point
โ”‚ โ””โ”€โ”€ lib/ # Library modules and functionality
โ”œโ”€โ”€ test/ # Test files
โ”œโ”€โ”€ .eslintrc # ESLint configuration
โ”œโ”€โ”€ rollup.config.js # Rollup configuration
โ”œโ”€โ”€ jest.config.js # Jest configuration
โ”œโ”€โ”€ babel.config.js # Babel configuration
โ””โ”€โ”€ package.json # Project dependencies and scripts
```

## ๐Ÿš€ Project Setup

### ๐Ÿ“ฅ Install

```bash
$ pnpm install
```

## ๐Ÿ”ง Development

```bash
$ pnpm dev
```

## ๐Ÿ“ฆ Build

```bash
$ pnpm build
```

## ๐Ÿ“ฆ Package Managers

This project supports multiple package managers. Here's how to use each one:

### NPM

NPM is the default package manager for Node.js.

**Install NPM:**
```bash
# Included with Node.js installation
```

**Setup project with NPM:**
```bash
# Install dependencies
$ npm install

# Development mode
$ npm run dev

# Build the library
$ npm run build
```

**Key features:**
- ๐Ÿ“š Vast package ecosystem
- ๐Ÿ”’ Hierarchical node_modules structure
- ๐Ÿ“‹ Package.json for dependency management

### Yarn

Yarn is a fast, reliable, and secure alternative to NPM.

**Install Yarn:**
```bash
# Install using NPM
$ npm install -g yarn
```

**Setup project with Yarn:**
```bash
# Install dependencies
$ yarn

# Development mode
$ yarn dev

# Build the library
$ yarn build
```

**Key features:**
- โšก Faster installation speeds
- ๐Ÿ“ฆ Offline caching
- ๐Ÿ”’ Better security with checksums
- ๐Ÿ“‹ yarn.lock for deterministic installations

### PNPM

PNPM is a disk-space efficient package manager.

**Install PNPM:**
```bash
# Install using NPM
$ npm install -g pnpm
```

**Setup project with PNPM:**
```bash
# Install dependencies
$ pnpm install

# Development mode
$ pnpm dev

# Build the library
$ pnpm build
```

**Key features:**
- ๐Ÿ’พ Disk space savings through symlinks
- ๐Ÿš€ Fast installation speeds
- ๐Ÿ”„ Content-addressable storage
- ๐Ÿ“‹ pnpm-lock.yaml for dependency lock

### Comparison

| Feature | NPM | Yarn | PNPM |
|-----------------------|---------|---------|---------|
| Disk usage | High | High | Low |
| Installation speed | Slow | Fast | Fastest |
| Parallel installations| Limited | Yes | Yes |
| Workspace support | Limited | Good | Best |
| Offline mode | Limited | Good | Good |
| Security | Good | Better | Better |

## ๐Ÿ“š Resources

- [Node.js Documentation](https://nodejs.org/en/docs/)
- [JavaScript MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
- [Rollup Documentation](https://rollupjs.org/guide/en/)
- [NPM Documentation](https://docs.npmjs.com/)
- [Yarn Documentation](https://yarnpkg.com/getting-started)
- [PNPM Documentation](https://pnpm.io/motivation)