Module

fabric-cli

Command-line interface for Fabric setup and update operations

sequenceDiagram participant User participant CLI participant UpdateFabric participant SetupFabric User->>CLI: Run command CLI->>CLI: Parse arguments alt update command CLI->>UpdateFabric: Call updateFabric() UpdateFabric->>UpdateFabric: Download install script UpdateFabric->>UpdateFabric: Make script executable else setup command CLI->>SetupFabric: Call setupFabric(config) SetupFabric->>SetupFabric: Install components end CLI->>User: Display result

View Source bin/fabric.ts, line 2

Example
// Update Fabric install script
node fabric.js update

// Setup Fabric components
node fabric.js setup --fabric-version 2.5.12 --ca-version 1.5.15 --components binary docker

Methods

# static setupFabric(config) → {Promise.<void>}

This function installs the specified Fabric components using the install-fabric.sh script. It iterates through the components list and executes the script for each component with the specified Fabric and CA versions. After installation, it copies configuration files to the root config folder.

Sets up Fabric components based on the provided configuration

sequenceDiagram participant Function participant FileSystem participant InstallScript Function->>FileSystem: Check if install script exists alt Script not found Function->>Function: Log error and exit else Script found loop For each component Function->>InstallScript: Execute install script InstallScript-->>Function: Installation result alt Installation failed Function->>Function: Log error and exit end end Function->>FileSystem: Copy config files alt Copy failed Function->>Function: Log error end end Function->>Function: Log success message
Parameters:
Name Type Description
config Object

Configuration object for Fabric setup

fabricVersion string

Fabric version to install

caVersion string

Fabric CA version to install

components Array.<string>

List of components to install

View Source bin/fabric.ts, line 127

If the install script is not found, component installation fails, or file copying fails

Error
Promise.<void>
Example
const config = {
  fabricVersion: "2.5.12",
  caVersion: "1.5.15",
  components: ["binary", "docker"]
};
await setupFabric(config);

# static updateFabric() → {Promise.<void>}

This function removes the existing install script (if present), downloads the latest version from the Hyperledger Fabric GitHub repository, and makes it executable.

Updates the Fabric install script by downloading the latest version

sequenceDiagram participant Function participant FileSystem participant GitHub Function->>FileSystem: Check if script exists alt Script exists Function->>FileSystem: Remove existing script end Function->>GitHub: Download latest script GitHub-->>Function: Return script content Function->>FileSystem: Write new script Function->>FileSystem: Make script executable

View Source bin/fabric.ts, line 75

If the download fails or file operations encounter issues

Error
Promise.<void>
Example
await updateFabric();