
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@n8d/htwoo-pattern-export
Advanced tools
CLI tool for exporting and comparing Pattern Lab patterns for the htwoo design system
A CLI tool and programmatic API for exporting and comparing Pattern Lab patterns. Specifically designed for the htwoo design system to safely manage pattern updates between source and consuming projects.
This utility helps you maintain consistent design patterns across multiple projects by:
.hbs (Handlebars), .json, .md (Markdown), and image filesnpm install --save-dev @n8d/core-patternexport
pattern-exports/
├── patterns/ # Contains all pattern files
│ ├── atoms/
│ ├── molecules/
│ ├── organisms/
│ └── templates/
├── data/ # Contains all data files
├── compare.ts # Comparison script
├── manifest.json # Pattern hashes
└── package.json # Project configuration
# Quick test (build + dry run export)
npm test
# Full test suite (build + export + verification)
npm run test:full
# Individual tests
npm run test:help # Show help message
npm run test:build # Test TypeScript compilation
npm run test:export # Test dry run export
npm run test:export:full # Test full export with files
npm run test:verify # Verify output structure
# Bidirectional import tests
npm run test:import # Test import with dry-run
npm run test:roundtrip # Full round-trip test (export → import → verify)
# Clean up test files
npm run test:clean
pattern-export --source <source-dir> --output <output-dir> [options]
| Option | Description |
|---|---|
-s, --source <path> | Source patterns directory (defaults to PatternLab config) |
-d, --data <path> | Source data directory (optional, auto-detected) |
-i, --images <path> | Source images directory (optional, auto-detected) |
-o, --output <path> | Output directory (required) |
-v, --verbose | Enable verbose output |
--dry-run | Show what would change without modifying files |
-h, --help | Show help message |
Export patterns only (auto-detects data and images):
pattern-export --source ./src/_patterns --output ./dist
Export patterns, data, and images from custom locations:
pattern-export \
--source ./htwoo-core/src/_patterns \
--data ./htwoo-core/src/_data \
--images ./htwoo-core/src/images \
--output ./packages/htwoo-patterns
Preview changes without making any file modifications:
pattern-export --source ./src/_patterns --output ./dist --dry-run --verbose
The tool is flexible - you can copy any folder to any destination:
# Export to a different project
pattern-export --source ../project-a/patterns --output ../project-b/patterns
# Export with custom images location
pattern-export \
--source ./patterns \
--images ./assets/img \
--output ./exported
If no --source is specified, the tool will:
Look for a patternlab-config.json file in the current directory
Extract the pattern and data paths from the config
Use those paths for comparison
The tool compares patterns using MD5 hashes of file content:
The tool exports the following file types:
Pattern Files:
.hbs - Handlebars template files.json - Pattern configuration files.md - Markdown documentation filesData Files:
.json - Data files from the _data directoryImage Files:
.png, .jpg, .jpeg, .gif, .svg, .webp, .avif, .bmp, .ico - All common image formatsAll files are tracked in the manifest with MD5 hashes for accurate change detection.
A manifest.json file is maintained in the output directory to track file hashes, making subsequent comparisons faster and more accurate.
The tool is fully bidirectional and works in both directions:
Export Mode (Pattern Lab → Shared Library):
# From Pattern Lab project directory
pattern-export --output ../shared-patterns
Import Mode (Shared Library → Pattern Lab):
# From Pattern Lab project directory
pattern-export --source ../shared-patterns/_patterns --data ../shared-patterns/_data --output ./source
Simply swap the --source and --output parameters to reverse the direction. The tool automatically detects the operation mode based on the provided flags.
Use the --dry-run option to preview changes without modifying any files. This shows:
When changes are detected, the tool generates a markdown report with details about modified, new, and removed patterns. This is saved as pattern-report.md in the parent directory.
License
MIT
FAQs
CLI tool for exporting and comparing Pattern Lab patterns for the htwoo design system
We found that @n8d/htwoo-pattern-export demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.