CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-ice--app

A universal framework based on React.js that provides scripts and configuration for web development with zero-config support for ES6+, TypeScript, routing, state management, and multi-platform deployment.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

cli.mddocs/

Command Line Interface

Ice.js provides a powerful CLI for development and build operations with extensive configuration options and multi-platform support. The CLI is accessible through the ice command after installing @ice/app.

Capabilities

Build Command

Build the project for production with optimization and multi-platform support.

ice build [options]

Build Options:

interface BuildOptions {
  /** Build target platform */
  --target: 'web' | 'weex' | 'ali-miniapp' | 'wechat-miniprogram' | 
           'bytedance-microapp' | 'baidu-smartprogram' | 'kuaishou-miniprogram';
  /** Build mode */
  --mode: string; // default: 'production'
  /** Enable bundle analyzer visualization */
  --analyzer: boolean; // default: false
  /** Custom configuration file path */
  --config: string;
  /** Project root directory */
  --rootDir: string; // default: process.cwd()
  /** Add custom Ice.js plugin by npm package name */
  --plugin: string;
  /** Enable Rust-based build optimization */
  --speedup: boolean; // default: false
}

Usage Examples:

# Basic production build
ice build

# Build for specific platform
ice build --target ali-miniapp

# Build with bundle analysis
ice build --analyzer

# Build with custom config
ice build --config ./configs/ice.prod.config.ts

# Build with custom plugin
ice build --plugin @my-org/ice-plugin-custom

# Build with speedup mode for faster builds
ice build --speedup

Start Command

Start the development server with hot reloading and comprehensive development features.

ice start [options]

Development Server Options:

interface StartOptions {
  /** Build target platform */
  --target: 'web' | 'weex' | 'ali-miniapp' | 'wechat-miniprogram' | 
           'bytedance-microapp' | 'baidu-smartprogram' | 'kuaishou-miniprogram';
  /** Development mode */
  --mode: string; // default: 'development'
  /** Custom configuration file path */
  --config: string;
  /** Development server host */
  --host: string; // -h shorthand
  /** Development server port */
  --port: number; // -p shorthand
  /** Disable automatic browser opening */
  --no-open: boolean;
  /** Disable mock service */
  --no-mock: boolean;
  /** Project root directory */
  --rootDir: string; // default: process.cwd()
  /** Enable bundle analyzer during development */
  --analyzer: boolean; // default: false
  /** Enable HTTPS server */
  --https: boolean | 'self-signed'; // default: false
  /** Force remove cache directory */
  --force: boolean; // default: false
  /** Enable Rust-based build optimization */
  --speedup: boolean; // default: false
  /** Open browser with specific route */
  --open: boolean | string; // default: true
  /** List all available pages */
  --list: boolean; // default: false
}

Usage Examples:

# Basic development server
ice start

# Start on specific host and port
ice start --host 0.0.0.0 --port 8080

# Start with HTTPS
ice start --https

# Start without opening browser
ice start --no-open

# Start with mock service disabled
ice start --no-mock

# Start with speedup mode (Rust tools)
ice start --speedup

# Start and open specific route
ice start --open /dashboard

# List all available pages
ice start --list

# Force cache clear and start
ice start --force

# Start miniapp development
ice start --target ali-miniapp

Global Options

Options available for all commands.

interface GlobalOptions {
  /** Show version number */
  --version: boolean; // -V shorthand
  /** Show help information */
  --help: boolean; // -h shorthand
}

Usage Examples:

# Show version
ice --version
ice -V

# Show help
ice --help
ice -h

# Show command-specific help
ice build --help
ice start --help

Multi-Platform Targets

Ice.js supports multiple deployment targets through the --target option.

type BuildTarget = 
  | 'web'                    // Standard web application (default)
  | 'weex'                   // Weex mobile framework
  | 'ali-miniapp'           // Alibaba Mini Program
  | 'wechat-miniprogram'    // WeChat Mini Program
  | 'bytedance-microapp'    // ByteDance Micro App
  | 'baidu-smartprogram'    // Baidu Smart Program
  | 'kuaishou-miniprogram'; // Kuaishou Mini Program

Platform-Specific Examples:

# Web development (default)
ice start
ice build

# WeChat Mini Program
ice start --target wechat-miniprogram
ice build --target wechat-miniprogram

# Alibaba Mini Program  
ice start --target ali-miniapp
ice build --target ali-miniapp --analyzer

# Weex mobile app
ice start --target weex --host 0.0.0.0
ice build --target weex --mode production

Configuration File Resolution

The CLI automatically resolves configuration files in the following order:

// Configuration file resolution order
const configFiles = [
  'ice.config.mts',  // TypeScript ES modules
  'ice.config.mjs',  // JavaScript ES modules  
  'ice.config.ts',   // TypeScript
  'ice.config.js',   // JavaScript
  'ice.config.cjs',  // CommonJS
  'ice.config.json'  // JSON
];

Custom Configuration:

# Use specific config file
ice build --config ./configs/production.config.ts
ice start --config ./configs/development.config.mjs

# Config files are resolved relative to rootDir
ice build --rootDir ./packages/web --config ice.config.ts

Environment Variables

The CLI automatically sets and recognizes various environment variables.

interface CLIEnvironmentVariables {
  /** Automatically set by CLI based on command */
  NODE_ENV: 'development' | 'production';
  /** Set by CLI with package version */
  __ICE_VERSION__: string;
  /** Custom environment variables from .env files */
  [key: string]: string;
}

Environment File Support:

# Environment files loaded in order of precedence
.env.local          # Local overrides (gitignored)
.env.development    # Development-specific
.env.production     # Production-specific  
.env                # Default environment

Advanced CLI Usage

Plugin Integration

# Install and use custom plugins
npm install @my-org/ice-plugin-custom
ice build --plugin @my-org/ice-plugin-custom

# Multiple plugins (space-separated)
ice start --plugin plugin-one --plugin plugin-two

Development Workflow

# Full development setup
ice start --host 0.0.0.0 --port 3000 --https --analyzer --speedup

# Production build with analysis
ice build --analyzer --mode production

# Cross-platform development
ice start --target wechat-miniprogram --list

Debugging and Analysis

# Enable bundle analysis
ice build --analyzer
ice start --analyzer

# List all available routes
ice start --list

# Force cache clear for troubleshooting
ice start --force

# Use speedup mode for faster builds
ice start --speedup
ice build --speedup

CI/CD Integration

# Production build for CI
ice build --mode production --no-open

# Build specific platform for deployment
ice build --target ali-miniapp --config ./configs/miniapp.config.ts

# Build with custom root directory
ice build --rootDir ./packages/frontend --config ice.config.ts

Command Exit Codes

interface ExitCodes {
  0: 'Success';
  1: 'Build error or process failure';
}

The CLI will exit with code 1 on build failures to ensure proper CI/CD integration.

Configuration Integration

All CLI options can be overridden by configuration files:

// ice.config.ts
import { defineConfig } from "@ice/app";

export default defineConfig({
  // CLI --analyzer option can be overridden
  analyzer: process.env.ANALYZE === 'true',
  
  // CLI --target option default
  // (CLI option takes precedence)
  
  // Development server defaults
  // (CLI --host and --port take precedence)
  server: {
    host: 'localhost',
    port: 3000,
    https: false
  }
});

The precedence order is: CLI options > Configuration file > Default values.

docs

analysis.md

cli.md

configuration.md

index.md

logging.md

service.md

testing.md

types.md

tile.json