PUI CLI Documentation
Welcome to the ICE MT UI Platform CLI documentation. This CLI tool provides a comprehensive set of commands for building, testing, and maintaining UI applications and libraries.
Quick Linksโ
- GitHub Repository
- Build Job
- SonarQube Report
- Usage Guide - Detailed command reference and examples
- API Documentation - Generated API docs from source code
- SSL Certificate Setup - HTTPS certificate configuration
Featuresโ
- ๐ Modern Build Tools - Webpack and Vite integration
- ๐งช Testing - Jest and Vitest support with coverage
- ๐จ Linting - ESLint, Prettier, and Stylelint configurations
- ๐ TypeScript - Full TypeScript support
- ๐ Storybook - Component development and documentation
- ๐ง Development Server - Hot module replacement
- ๐ฆ Library Support - Build both applications and libraries
- ๐ฏ Monorepo Support - Workspace version management
Getting Startedโ
This guide will help you get started with @elliemae/pui-cli, a command-line interface tool for building and managing UI applications and libraries.
Prerequisitesโ
Before you begin, ensure you have the following installed:
- Node.js: Version 20
- pnpm: Version 8 (recommended package manager)
Installationโ
For New Projectsโ
Install the CLI as a development dependency in your project:
pnpm add -D @elliemae/pui-cli
Quick Startโ
Setting Up a New Applicationโ
- Create a package.json if you don't have one:
pnpm init
- Install pui-cli:
pnpm add -D @elliemae/pui-cli
- Add scripts to your package.json:
For applications:
{
"scripts": {
"start": "pui-cli start",
"start:prod": "pui-cli start -p",
"build": "pui-cli build",
"test": "pui-cli test",
"vitest": "pui-cli vitest",
"test:fix": "pui-cli test -f",
"test:debug": "pui-cli test --debug",
"lint": "pui-cli lint",
"lint:fix": "pui-cli lint --fix",
"lint:staged": "lint-staged",
"tscheck": "pui-cli tscheck --files",
"storybook": "pui-cli storybook",
"storybook:docs": "pui-cli storybook --docs",
"storybook:build": "pui-cli storybook -b",
"gendoc": "pui-cli gendoc"
}
}
For libraries:
{
"scripts": {
"build": "pui-cli pack -p",
"build:dev": "pui-cli pack",
"test": "pui-cli test",
"test:fix": "pui-cli test -f",
"lint": "pui-cli lint",
"lint:fix": "pui-cli lint --fix",
"tscheck": "pui-cli tscheck --files"
}
}
- Create a TypeScript configuration (
tsconfig.json):
For applications:
{
"extends": "@elliemae/pui-cli/app.tsconfig.json",
"compilerOptions": {
"outDir": "dist/types",
"baseUrl": ".",
"paths": {}
},
"include": [
"app/**/*",
"wdio.config.mjs",
"vitest.config.ts",
"docusaurus.config.ts"
],
"exclude": ["node_modules", "**/*.spec.ts"]
}
For libraries:
{
"extends": "@elliemae/pui-cli/library.tsconfig.json",
"compilerOptions": {
"outDir": "dist/types",
"declarationDir": "dist/types",
"baseUrl": "."
},
"include": ["lib/**/*", "./docusaurus.config.ts"],
"exclude": ["node_modules"]
}
- Create your source structure:
For applications:
your-project/
โโโ app/
โ โโโ index.tsx # Entry point
โ โโโ route/ # Routes
โ โโโ view/ # Components
โ โโโ data/ # Redux slices
โ โโโ api/ # RTK Query APIs
โ โโโ sideeffect/ # Redux Sagas
โ โโโ utils/ # Utilities
โ โโโ app.config.json # App configuration
โโโ public/ # Static assets
โโโ package.json
โโโ tsconfig.json
For libraries:
your-project/
โโโ lib/
โ โโโ index.ts # Entry point
โ โโโ components/ # Components
โ โโโ utils/ # Utilities
โ โโโ __tests__/ # Tests
โโโ stories/ # Storybook stories (optional)
โโโ package.json
โโโ tsconfig.json
Project Structureโ
Application Structureโ
your-app/
โโโ app/ # Application source code
โ โโโ index.tsx # Entry point
โ โโโ route/ # Route definitions
โ โโโ view/ # UI components
โ โโโ data/ # Redux slices (state)
โ โโโ api/ # RTK Query API definitions
โ โโโ sideeffect/ # Redux Sagas
โ โโโ utils/ # Utility functions
โ โโโ tests/ # Test files
โ โโโ app.config.json # App configuration
โโโ public/ # Static assets
โโโ e2e/ # E2E tests (optional)
โโโ docs/ # Docusaurus docs (optional)
โโโ package.json
โโโ tsconfig.json
Library Structureโ
your-library/
โโโ lib/ # Library source code
โ โโโ index.ts # Entry point
โ โโโ components/ # Components
โ โโโ __tests__/ # Test files
โโโ stories/ # Storybook stories
โโโ package.json
โโโ tsconfig.json
Configuration Filesโ
Prettier Configurationโ
Create prettier.config.cjs:
const { prettierConfig } = require('@elliemae/pui-cli');
module.exports = prettierConfig;
Stylelint Configurationโ
Create stylelint.config.cjs:
const { stylelintConfig } = require('@elliemae/pui-cli');
module.exports = stylelintConfig;
Commitlint Configurationโ
Create commitlint.config.cjs:
const { commitlintConfig } = require('@elliemae/pui-cli');
module.exports = commitlintConfig;
Lint-staged Configurationโ
Create lint-staged.config.mjs:
import { lintStagedConfig } from '@elliemae/pui-cli';
export default lintStagedConfig;
Babel Configuration (Optional)โ
Create babel.config.cjs for custom Babel configuration:
const { babelConfig } = require('@elliemae/pui-cli');
module.exports = babelConfig;
Git Hooks Setupโ
To enable pre-commit hooks with Husky:
- Install Husky:
pnpm add -D husky
npx husky init
- Create
.husky/pre-commit:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
- Make it executable:
chmod +x .husky/pre-commit
Additional Configuration Filesโ
Jest Configurationโ
For custom Jest configuration, create jest.config.cjs:
const { jestConfig } = require('@elliemae/pui-cli');
module.exports = jestConfig;
Environment Variablesโ
Create a .env file in your project root for environment-specific configuration:
PORT=3000
NODE_ENV=development
Running Your First Buildโ
Start Development Serverโ
# Start development server
pnpm start
# Start with production mode
pnpm start:prod
# or
pui-cli start -p
This will:
- Start webpack dev server
- Enable hot module replacement
- Serve your application (default: http://localhost:3000)
- Watch for file changes
Build for Productionโ
# Build application
pnpm build
# Build library
pui-cli pack -p
# Build library for development (no minification)
pui-cli pack
This will:
- Create an optimized production build
- Output files to the
dist/orbuild/directory - Generate source maps
- Minify and bundle your code
- For libraries: Generate ESM, CJS, and type declarations
Run Testsโ
# Run Jest tests
pnpm test
# Run tests with auto-fix
pnpm test:fix
# Debug tests
pnpm test:debug
# Watch mode
pnpm test:watch
Linting and Type Checkingโ
# Lint code
pnpm lint
# Auto-fix lint issues
pnpm lint:fix
# Type check
pnpm tscheck
# Lint staged files only
pnpm lint:staged
Storybookโ
# Run Storybook dev server
pnpm storybook
# Run with docs mode
pnpm storybook:docs
# Build static Storybook
pnpm storybook:build
Next Stepsโ
- Read the Usage Guide for detailed command documentation
- Check out the API Documentation for library exports
- Review the Migration Guide if upgrading from an older version
Troubleshootingโ
Common Issuesโ
Port already in use:
# Change the port in your .env file
PORT=3001
Module not found errors:
# Clear node_modules and reinstall
rm -rf node_modules
pnpm install
Build fails with TypeScript errors:
# Run type checking separately to see detailed errors
pnpm tscheck
HTTPS certificate warnings:
If you see "Not Secure" or certificate warnings when using HTTPS in development:
- See the SSL Certificate Setup Guide for detailed instructions
- You need to trust the self-signed CA certificate on your system
- Platform-specific instructions available for macOS, Windows, and Firefox
Getting Helpโ
If you encounter issues:
- Review the documentation in the
docs/folder - Reach out to the ui-platform teams channel