0.0.2 • Published 3 months ago

@silentflick/esm-extractor v0.0.2

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 months ago

ESM Extractor

This project automates the extraction of TypeScript exports from a given package and aggregates them into a single declaration file (index.d.ts). This file can then be used as a unified type definition bundle for tooling, such as compiling ESM modules to CommonJS with esbuild.

Overview

The project is divided into three main components:

  • Extractor Module: Recursively scans a target package’s directory, reads TypeScript files, and collects export declarations.
  • Generator Module: Processes the collected export declarations and generates a single aggregated declaration file.
  • Updator Module: (Optional) Reads the project's package.json, locates the dependency version for the target package, and updates the project's version accordingly. This ensures consistency between the library version and the package version used.

Usage

The script accepts the following options:

  • -p, --packageName (required): The name of the package from which to extract exports.
  • -o, --output (optional): The output directory where index.d.ts will be generated. Defaults to the current script directory if not provided.
  • -j, --packageJson (optional): The path to the package.json file. Defaults to package.json in the current directory.
  • -u, --update (optional): Flag to update the project's version based on the version of the extracted package. Defaults to false.
0.0.2

3 months ago

0.0.1

3 months ago