Skip to main content

packemon

Build Status npm version npm deps

Gotta pack 'em all!

Are you a library maintainer? Confused on how to build packages for consumers? Unsure of what tooling and plugins to use? What about CommonJS vs ECMAScript? TypeScript, JavaScript, or FlowType? Forget that headache and let Packemon do the heavy lifting for you. No need to fiddle with Babel or Rollup configurations!

Packemon is a "batteries included" CLI that will prepare each package for distribution by building with the proper tooling and plugins, provide sane defaults and configurations, verify package requirements, and much more! By default Packemon will generate ECMAScript modules, but can be configured to support all formats.

Features#

  • Scaffold TypeScript packages, in either a monorepo or polyrepo project setup.
  • Configure packages for Node.js, Web browsers, or React Native, with multiple output formats like CommonJS and ECMAScript (default).
  • Build packages with Rollup to create self-contained and tree-shaken bundles. Provide the smallest file sizes possible!
  • Support a single index import, multiple imports, deep imports, or any kind of entry point.
  • Transform packages with Babel's preset-env and the configured platform targets. Only ship and polyfill what's truly necessary!
  • Generate and combine TypeScript declarations into a single public-only API representation.
  • Generate compact source maps for platform + format based builds.

Requirements#

  • Linux, OSX, Windows
  • Node 12.17+

Documentation#

https://packemon.dev

Index

Type aliases

AnalyzeType

AnalyzeType: network | none | sunburst | treemap

ArtifactState

ArtifactState: building | failed | passed | pending

Awaitable

Awaitable: Promise<void> | void

BrowserFormat

BrowserFormat: CommonFormat | esm | umd

CommonFormat

CommonFormat: lib

DeclarationType

DeclarationType: api | none | standard

Environment

Environment: `${Platform}:${Support}`

Format

InfraType

InfraType: monorepo | polyrepo

InputMap

InputMap: Record<string, string>

NativeFormat

NativeFormat: CommonFormat

NodeFormat

NodeFormat: CommonFormat | cjs | mjs

PackageExportConditions

PackageExportConditions: browser | default | import | module | node | react-native | require | types

PackageExportPaths

PackageExportPaths: { [ K in PackageExportConditions ]?: PackageExportPaths | string }

PackageExports

PackageExports: Record<string, PackageExportPaths | string>

Platform

Platform: browser | native | node

Support

Support: current | experimental | legacy | stable

TemplateType

TemplateType: monorepo-package | monorepo | polyrepo-package | polyrepo

Variables

BROWSER_TARGETS

BROWSER_TARGETS: { [ K in Support ]: string[] | string } = ...

DEFAULT_FORMATS

DEFAULT_FORMATS: Record<Platform, Format[]> = ...

DEFAULT_INPUT

DEFAULT_INPUT: src/index.ts = 'src/index.ts'

DEFAULT_PLATFORM

DEFAULT_PLATFORM: Platform = 'browser'

DEFAULT_SUPPORT

DEFAULT_SUPPORT: Support = 'stable'

EXCLUDE

EXCLUDE: string[] = ...

EXTENSIONS

EXTENSIONS: string[] = ...

FORMATS

FORMATS: Format[] = ...

FORMATS_BROWSER

FORMATS_BROWSER: BrowserFormat[] = ...

FORMATS_NATIVE

FORMATS_NATIVE: NativeFormat[] = ...

FORMATS_NODE

FORMATS_NODE: NodeFormat[] = ...

NATIVE_TARGETS

NATIVE_TARGETS: { [ K in Support ]: string } = ...

NODE_SUPPORTED_VERSIONS

NODE_SUPPORTED_VERSIONS: { [ K in Support ]: string } = ...

NPM_SUPPORTED_VERSIONS

NPM_SUPPORTED_VERSIONS: { [ K in Support ]: string[] | string } = ...

PLATFORMS

PLATFORMS: Platform[] = ...

STATE_COLORS

STATE_COLORS: { [ K in ArtifactState ]?: StyleType } = ...

STATE_LABELS

STATE_LABELS: { [ K in ArtifactState ]: string } = ...

SUPPORTS

SUPPORTS: Support[] = ...

SUPPORT_PRIORITY

SUPPORT_PRIORITY: Record<Support, number> = ...