@tapestrylab/cli
v0.2.1
Published
Unified CLI for all Tapestry tools
Readme
@tapestrylab/cli
Unified command-line interface for all Tapestry design system tools.
Installation
npm install -g @tapestrylab/cli
# or
pnpm add -g @tapestrylab/cliUsage
The tapestry CLI provides a single entrypoint for all Tapestry tools:
Extract Component Metadata
Extract component metadata from source files:
tapestry extract --root ./src --output ./metadata.jsonOptions:
-c, --config <path>- Path to config file-r, --root <path>- Project root directory-o, --output <path>- Output file path-i, --include <patterns...>- Include patterns-e, --exclude <patterns...>- Exclude patterns--json- Output as JSON
Generate Documentation
Generate documentation from component source files:
tapestry generate --source ./src/Button.tsx --template component-docsOptions:
-s, --source <path>- Source file or directory (default:./src/components)-o, --output <path>- Output directory (default:./docs)-t, --template <name|path>- Template name or path to template file-f, --format <format>- Output format:markdown,mdx, orhtml(default:mdx)--theme <path>- Path to custom theme file--no-relationships- Skip relationship resolution--project-root <path>- Project root for relationship resolution
List Available Templates
List all built-in templates:
tapestry listInitialize Configuration
Initialize Tapestry configuration in the current directory:
tapestry initOptions:
--force- Overwrite existing files
This will create:
tapestry.config.js- Configuration filetemplates/- Directory for custom templatestemplates/custom.taptpl.json- Example custom templatecustom.theme.js- Example custom theme
Examples
Extract and Generate Documentation
# Extract metadata from all components
tapestry extract --root ./src/components --output ./metadata.json
# Generate documentation for a single component
tapestry generate --source ./src/Button.tsx --template component-docs --format mdx
# Generate documentation for all components in a directory
tapestry generate --source ./src/components --output ./docs --template api-referenceUsing Custom Templates and Themes
# Initialize Tapestry configuration
tapestry init
# Edit the generated tapestry.config.js and templates/custom.taptpl.json
# Generate docs with custom template and theme
tapestry generate --template ./templates/custom.taptpl.json --theme ./custom.theme.jsMigration from Individual CLIs
If you were previously using tapestry-extract or tapestry-template, you can now use the unified tapestry CLI:
Before:
tapestry-extract extract --root ./src --output ./metadata.json
tapestry-template generate --source ./src/Button.tsx --template component-docs
tapestry-template list
tapestry-template initAfter:
tapestry extract --root ./src --output ./metadata.json
tapestry generate --source ./src/Button.tsx --template component-docs
tapestry list
tapestry initThe individual CLIs (tapestry-extract and tapestry-template) will continue to work, but we recommend using the unified tapestry CLI for a better experience.
Package Architecture
This CLI package is a thin wrapper that delegates to the underlying packages:
tapestry extract→@tapestrylab/extracttapestry generate→@tapestrylab/templatetapestry list→@tapestrylab/templatetapestry init→@tapestrylab/template
License
MIT
