npm package: @pangrampangram/pp-font-packager
Description: Interactive CLI for organizing font files into distribution-ready folder structures
Latest version: 0.5.7

# PP Font Packager

Interactive CLI for organizing font files into distribution-ready folder structures.

## Install

### NPM
```bash
npm install -g @pangrampangram/pp-font-packager
```

### PNPM
```bash
pnpm add -g @pangrampangram/pp-font-packager
```

## Features

- Organizes font files (ttf, otf, woff, woff2, eot) into standardized folders
- Auto-detects font names, families, and subfamilies from filenames
- Interactive prompts with sensible defaults
- Generates multiple package types:
  - **Single Styles** - Individual weight folders (e.g., `PP Frama Regular v1.0/`)
  - **Full Family** - All variants organized by type (`ttf/`, `otf/`, `web/`, `variable/`)
  - **Family packages** - Per-family groupings (Normal, Text, Display, etc.)
  - **Subfamily packages** - Per-subfamily groupings (Upright, Italic, etc.)
- Separates variable fonts into `variable/` subfolder
- Mini variable fonts go to `variable/mini variable/`
- Web fonts (woff, woff2, eot) organized into `web/` subfolder

## Development Setup

```bash
pnpm install
```

## Usage

```bash
pnpm dev
```

The CLI guides you through the following prompts:

```
┌  PP Font Packager
│
◆  Enter font directory path:
│  ./fonts
│
│  Detected: 24 font files
│  Detected font name: PP Frama
│  Detected families: Normal, Text
│  Detected subfamilies: Upright, Italic
│
◆  Enter font name:
│  PP Frama
│
◆  Enter version:
│  v1.0
│
◆  Select families (first is default for unmatched files):
│  ◼ Normal
│  ◼ Text
│
◆  Do you want to organize by subfamilies?
│  Yes
│
◆  Select subfamilies:
│  ◼ Upright
│  ◼ Italic
│
◆  Select output packages to generate:
│  ◼ Single Styles
│  ◼ Full Family
│  ◼ Family packages
│  ◼ Subfamily packages
│
◆  Organize PP Frama fonts in ./fonts?
│  Yes
│
◐  Organizing files...
│
│  Created 15 folders:
│    PP Frama Regular v1.0
│    PP Frama Bold v1.0
│    PP Frama - Full Family v1.0
│    PP Frama - Normal Family v1.0
│    ...
│
└  Complete!
```

## Output Structure

### Single Styles
Each font weight gets its own folder:
```
PP Frama Regular v1.0/
  PPFramaRegular.ttf
PP Frama Bold v1.0/
  PPFramaBold.ttf
```

### Full Family
All fonts organized by type:
```
PP Frama - Full Family v1.0/
  ttf/
    PPFramaRegular.ttf
    PPFramaBold.ttf
  otf/
    PPFramaRegular.otf
  web/
    PPFramaRegular.woff
    PPFramaRegular.woff2
  variable/
    PPFramaVariable.ttf
    mini variable/
      Variable.ttf
```

### Family Packages
Per-family organization:
```
PP Frama - Normal Family v1.0/
  ttf/
  otf/
  web/
PP Frama - Text Family v1.0/
  ttf/
  otf/
  web/
```

### Subfamily Packages
Per-family + subfamily organization:
```
PP Frama - Normal Upright Family v1.0/
PP Frama - Normal Italic Family v1.0/
PP Frama - Text Upright Family v1.0/
PP Frama - Text Italic Family v1.0/
```

## Development

```bash
pnpm dev          # Run CLI
pnpm build        # Compile TypeScript
pnpm typecheck    # Type check
pnpm lint         # Lint with Biome
pnpm lint:fix     # Auto-fix lint issues
pnpm format       # Format with Biome
pnpm test         # Run tests (53 tests)
pnpm test:watch   # Run tests in watch mode
```

## Project Structure

```
src/
├── index.ts          # CLI entry point
├── prompts.ts        # Interactive prompt flows
├── ui.ts             # Terminal styling (chalk)
├── organizer.ts      # Core organization logic
├── detector.ts       # Auto-detect font info
├── types.ts          # Type definitions
├── utils/
│   ├── fs.ts         # File system helpers
│   └── naming.ts     # Font name parsing
└── __tests__/        # Test files
    ├── fs.test.ts
    ├── naming.test.ts
    ├── detector.test.ts
    └── organizer.test.ts
```

## License

MIT