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

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

An advanced boilerplate for Node.js libraries with TypeScript and Rollup. Perfect for creating optimized, typed TypeScript packages ready for distribution.
https://github.com/5h1ngy/bl-rollup-node-typescript

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

Last synced: 6 months ago
JSON representation

An advanced boilerplate for Node.js libraries with TypeScript and Rollup. Perfect for creating optimized, typed TypeScript packages ready for distribution.

Awesome Lists containing this project

README

          

# ๐Ÿš€ Rollup-TSX

![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)
![TypeScript](https://img.shields.io/badge/TypeScript-4.x-3178C6.svg?logo=typescript)

An advanced boilerplate for Node.js libraries with TypeScript and Rollup. Perfect for creating optimized, typed TypeScript packages ready for distribution.

**Topics:** `node` `typescript` `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
- ๐Ÿ”’ Type safety with TypeScript
- ๐Ÿ” TypeScript linting with ESLint
- ๐ŸŽจ Code formatting with Prettier
- ๐Ÿงช Testing with Jest and TS-Jest
- ๐Ÿ“ค Support for ES Modules import/export
- ๐Ÿ’พ 100% offline functionality
- ๐Ÿ”„ Support for hot-reload during development
- ๐Ÿ“Š Tools for documentation generation
- ๐Ÿ“ TypeScript type declarations (.d.ts)

## ๐Ÿ—‚๏ธ Project Structure

```
bl-rollup-node-typescript/
โ”œโ”€โ”€ dist/ # Output directory for the bundle
โ”œโ”€โ”€ src/ # TypeScript source code
โ”‚ โ”œโ”€โ”€ index.ts # Main entry point
โ”‚ โ””โ”€โ”€ lib/ # Library modules and functionality
โ”œโ”€โ”€ test/ # Test files
โ”œโ”€โ”€ .eslintrc # ESLint configuration
โ”œโ”€โ”€ rollup.config.js # Rollup configuration
โ”œโ”€โ”€ jest.config.js # Jest configuration
โ”œโ”€โ”€ tsconfig.json # TypeScript 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/)
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
- [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)