ts-library

Author and publish TypeScript libraries with Rollup-first dual CJS/ESM builds.

2|Updated Dec 18, 2024
One-click install
npx skills add https://github.com/sampleXbro/axios-retryer --skill ts-library-samplexbro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts-library
Source: https://github.com/sampleXbro/axios-retryer/tree/main/.junie/skills/ts-library
Command: npx skills add https://github.com/sampleXbro/axios-retryer --skill ts-library-samplexbro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Prevents fragile or breaking TypeScript library releases caused by ad-hoc build tooling, incorrect package exports, missing declaration bundling, and unverified consumer contracts so that published packages remain stable for both CJS and ESM consumers.

Core Features & Use Cases

  • Package contract preservation: guidance for inspecting existing export maps, packing tarballs, and verifying consumer installs before changing builders.
  • Rollup-first build patterns: stable dual CJS/ESM outputs, separate declaration emit, multiple public entry points, and exact output filenames for published packages.
  • Type and tooling configuration: recommended tsconfig patterns (build vs local), declaration bundling strategies, and TypeScript multi-version testing approaches.
  • Testing, CI, and release: vitest setup, package validation in CI, and reproducible release flows including tokenless OIDC publishing and pkg-pr-new previews.

Quick Start

Use the ts-library skill to set up a Rollup-based TypeScript library with dual CJS/ESM outputs, declaration bundling, verified package.json exports, and a CI pipeline that validates the packed tarball.

Frequently Asked Questions about ts-library

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Rollup for a TypeScript library with dual CJS and ESM outputs?

To configure Rollup for a TypeScript library with dual CJS and ESM outputs, use Rollup-first build patterns to generate stable dual CJS and ESM outputs with separate declaration emit. This approach ensures predictable consumer entry points and exact output filenames for your published package.

What is the best way to verify package exports before publishing a TypeScript library?

The best way to verify package exports is package-contract verification via npm pack. Inspecting existing export maps and packing tarballs allows you to verify consumer installs and prevent fragile or breaking TypeScript library releases.

How do I set up vitest testing and CI release workflows for a TypeScript package?

To set up vitest testing and CI release workflows, configure vitest for testing and implement package validation in CI. Use reproducible release flows including tokenless OIDC publishing and pkg-pr-new previews to automate releases.

Does this approach support monorepo projects requiring multiple public entry points?

Yes, this approach supports single-package and monorepo projects requiring Rollup-first builds. It handles multiple public entry points, precise package.json exports, and declaration bundling for both monorepo and single-package TypeScript libraries.

Why are my TypeScript library declarations missing or incorrectly bundled for consumers?

Missing or incorrectly bundled declarations happen when declaration emit is not separated from the build. Apply recommended tsconfig patterns for declaration bundling strategies to ensure correct TypeScript declaration emit for consumers.