@scom/cli
v0.1.14
Published
CLI for building and testing SCOM packages
Downloads
24
Readme
@scom/cli
Command line interface for building, testing, and developing Secure Compute (SCOM) packages and applications.
Overview
The @scom/cli is a development toolkit that streamlines the creation, building, testing, and deployment of SCOM components and applications. It provides scaffolding, bundling, development servers, and testing capabilities in a unified command-line interface.
Installation
Global Installation (Recommended)
npm install -g @scom/cliLocal Installation
npm install @scom/cli --save-devCommands
init - Project Initialization
Create new SCOM projects from templates:
# Create a new React TypeScript application
npx @scom/cli init app my-app
cd my-app
# Initialize in current directory
npx @scom/cli init app .
# Create a React widget
npx @scom/cli init widget my-widgetOptions:
app <project-name>: Creates a React TypeScript applicationwidget <widget-name>: Creates a React widget component
bundle - Build and Bundle
Bundle SCOM packages for production:
# Bundle the current project
npx @scom/cli bundleUses the integrated @scom/bundler to create optimized production builds with proper module resolution and dependency management.
serve - Development Server
Start a development server for testing and previewing:
# Serve current directory
npx @scom/cli serve
# Serve specific directory
npx @scom/cli serve dist
# Serve with custom port
npx @scom/cli serve dist --port 8080
# Serve with assets mapping
npx @scom/cli serve examples --port 8080 --map /lib/amd-loader.js:./src/lib/amd-loader.jsFeatures:
- Live reloading during development
- Custom port configuration
- File mapping for development overrides
- Static file serving
dev - Development Mode
Start development server with auto-rebuild capabilities:
# Start development mode
npx @scom/cli dev
# Custom port and host
npx @scom/cli dev --port 8080 --host localhost
# Auto-open browser
npx @scom/cli dev --open
# Silent mode (suppress output)
npx @scom/cli dev --silentFeatures:
- Automatic rebuilding on file changes
- Hot module replacement
- Browser auto-opening
- Development optimizations
test - Testing
Run tests using the integrated @scom/test framework:
# Run all tests in current directory
npx @scom/cli test
# Run tests in specific directory
npx @scom/cli test tests
# Run tests in custom directory
npx @scom/cli test my-test-folderFeatures:
- Jest-compatible testing environment
- React component testing support
- TypeScript support
- Browser and Node.js test environments
publish - Package Publishing
Publish packages to npm with automatic dependency resolution:
# Publish with default npm settings
npx @scom/cli publish
# Publish with specific npm tag
npx @scom/cli publish --tag beta
# Preview changes without publishing (dry-run)
npx @scom/cli publish --simulate
npx @scom/cli publish --dry-runFeatures:
- Automatically replaces
file:dependencies with actual versions - Supports npm publish options and tags
- Dry-run mode for testing
- Automatic backup and restore of package.json
Project Templates
App Template
Creates a full React TypeScript application with:
- Modern React setup with TypeScript
- Development and production configurations
- Testing environment pre-configured
- SCOM component integration ready
- Build and deployment scripts
Widget Template
Creates a reusable React widget component with:
- Component scaffolding
- TypeScript definitions
- Testing setup
- Build configuration for widget distribution
- Example usage and documentation
Dependencies
The CLI integrates several SCOM tools:
- @scom/bundler: Advanced bundling and module resolution
- @scom/serve: Development server with live reloading
- @scom/test: Testing framework for components and applications
- TypeScript: Full TypeScript support
- React: React and ReactDOM for component development
Usage Examples
Creating a New Application
# Create and setup a new app
npx @scom/cli init app my-secure-app
cd my-secure-app
# Start development
npx @scom/cli dev --open
# Run tests
npx @scom/cli test
# Build for production
npx @scom/cli bundleDeveloping Components
# Create a widget
npx @scom/cli init widget my-widget
cd my-widget
# Start development with live reload
npx @scom/cli serve src --port 3000
# Test the component
npx @scom/cli test
# Bundle for distribution
npx @scom/cli bundleDevelopment Workflow
# Start development server
npx @scom/cli dev --port 8080
# In another terminal, run tests in watch mode
npx @scom/cli test --watch
# Build when ready for production
npx @scom/cli bundleConfiguration
The CLI respects standard configuration files:
package.json: Project metadata and dependenciestsconfig.json: TypeScript configurationscconfig.json: SCOM-specific configuration.gitignore: Version control exclusions
Integration with SCOM Ecosystem
The CLI is designed to work seamlessly with:
- @scom/core: Provides runtime dependencies
- @scom/bundler: Advanced module bundling
- @scom/serve: Development server capabilities
- @scom/test: Comprehensive testing framework
Binary Installation
When installed, the CLI provides the scom-cli binary globally:
which scom-cli
# /usr/local/bin/@scom/cli (or equivalent)Help
Get help for any command:
npx @scom/cli --help
npx @scom/cli init --help
npx @scom/cli serve --help