Piral CLI
raw JSON →Piral CLI (Command Line Interface) is the essential toolkit for developing microfrontends within the Piral framework. It empowers developers to scaffold new Piral instances (the host shell application) and individual Pilets (the microfrontend modules), and to manage their lifecycle including building, debugging, and deploying. The current stable version is 1.10.3, with a release cadence that includes frequent patch and minor updates to incorporate bug fixes, dependency upgrades, and enhance compatibility with evolving frontend frameworks like Angular and React. Its key differentiators include a bundler-agnostic architecture supporting popular tools such as Webpack, Vite, and Esbuild, strong TypeScript integration, and comprehensive features for orchestrating independently deployable microfrontends, including shared dependencies and dynamic runtime updates.
Common errors
error 'piral' is not recognized as an internal or external command, operable program or batch file. ↓
npm install -g piral-cli, or use npx to run commands: npx piral [command]. error Error: Minimum Node.js version not met. Expected >=18.17.0, got X.Y.Z ↓
nvm install 18 and nvm use 18 (or your preferred version manager). error Angular Compilation Error: NG04002 ↓
piral-ng documentation and changelog for known issues and required piral-cli versions for your Angular version. Ensure consistent @angular/core versions across your Piral instance and pilets. Warnings
breaking The Node.js engine requirement for `piral-cli` is `>=18.17`. Using older Node.js versions will result in an error and prevent the CLI from running. ↓
gotcha Compatibility with specific Angular versions and features (e.g., standalone components, lazy component loaders, input signals) in the `piral-ng` plugin often requires specific `piral-cli` and `piral-ng` versions. Discrepancies can lead to build or runtime errors. ↓
breaking The `container` property was removed from the event arguments for the `unhandled-error` event. Code relying on this property will break. ↓
gotcha Earlier versions of `piral-cli` (prior to v1.8.2) had issues with command-line argument parsing on Windows, which could lead to unexpected behavior or incorrect command execution. ↓
Install
npm install piral-cli yarn add piral-cli pnpm add piral-cli Imports
- run wrong
import run from 'piral-cli';correctimport { run } from 'piral-cli'; // or require for CJS const { run } = require('piral-cli'); - CliPlugin wrong
import { CliPlugin } from 'piral-cli';correctimport type { CliPlugin } from 'piral-cli'; - cliApi wrong
import { cliApi } from 'piral-cli';correct// In a Piral CLI plugin (e.g., piral-cli-my-plugin/index.js): module.exports = function (cliApi) { /* ... */ };
Quickstart
# Install Piral CLI globally (recommended for convenience, or use npx)
npm install -g piral-cli
# Or use npx for local execution:
# npx piral new my-piral-app --framework react --install
npx piral new my-piral-app --framework react --install
cd my-piral-app
npx piral debug
# In a new terminal, scaffold a new pilet (microfrontend)
npx pilet new my-pilet --source my-piral-app@1.0.0 --install
cd my-pilet
npx pilet debug