Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
41e7a28
init setup to remove yeoman and use oclif
OsamaRab3 Nov 19, 2025
2a57fed
intial fablo up
OsamaRab3 Nov 19, 2025
9258f62
inital fablo stop
OsamaRab3 Nov 19, 2025
8cfa0b3
inital fablo down
OsamaRab3 Nov 19, 2025
4c0bc8d
fablo splash
OsamaRab3 Nov 19, 2025
616cd0c
inital fablo prune
OsamaRab3 Nov 19, 2025
14e2a1e
inital fablo recreate
OsamaRab3 Nov 19, 2025
79cd27a
inital fablo start
OsamaRab3 Nov 19, 2025
23c82cd
inital fablo init
OsamaRab3 Nov 19, 2025
5fe9009
inital fablo export-topology
OsamaRab3 Nov 20, 2025
6e9443f
inital extend-config
OsamaRab3 Nov 20, 2025
4a1b01f
move extend config to src dir
OsamaRab3 Dec 4, 2025
e4ca733
remove old yeoman , unuseful commands
OsamaRab3 Dec 4, 2025
ae3cfc2
remove yeoman from entery point
OsamaRab3 Dec 4, 2025
5459362
fix: import lib path
OsamaRab3 Dec 4, 2025
2353cab
inital validate and verrsion
OsamaRab3 Dec 4, 2025
8304167
update setup-network, k8s ,list-version and list-compatible
OsamaRab3 Dec 4, 2025
39fbcb4
utils for ejs templete
OsamaRab3 Dec 4, 2025
a4ff2cf
Iterate on Dockerfile and docker-entrypoint.sh
dzikowski Dec 5, 2025
fa80133
Iterate on docker entrypoint and init command
dzikowski Jan 2, 2026
3c609d4
Iterate on docker entrypoint and fix build in fablo-build
OsamaRab3 Jan 24, 2026
9ec52bd
fix path to ref into docker and setup-netwrok
OsamaRab3 Jan 24, 2026
9aae49b
Merge branch 'main' into del-yeoman
OsamaRab3 Jan 24, 2026
922eaeb
uncomment export-toplogy and fix packege.json
OsamaRab3 Jan 24, 2026
0e7f344
Merge branch 'main' into del-yeoman
OsamaRab3 Feb 27, 2026
5618bad
fix: export-topology command to export to optional file
OsamaRab3 Feb 28, 2026
e5e6652
fix: solve oclif warnings
OsamaRab3 Mar 1, 2026
da52868
setup e2e test
OsamaRab3 Mar 1, 2026
4b1ce0a
fix system error in ci
OsamaRab3 Mar 1, 2026
ed39104
fix: update exportNetworkTopology to use correct config path
OsamaRab3 Mar 1, 2026
64122d1
refactor: clean up unused code and improve logging in SetupDocker
OsamaRab3 Mar 4, 2026
8fa55a2
Merge branch 'main' into del-yeoman
OsamaRab3 Mar 4, 2026
4b4ce98
update snpashots
OsamaRab3 Mar 4, 2026
06de7f5
Support the legacy type of commands for init (no dashes)
dzikowski Mar 6, 2026
e10087f
Revert back mounting /etc/passwd and /etc/group in Docker container i…
dzikowski Mar 6, 2026
6cb2172
refactor: remove printSplash function and its usage in Init command
OsamaRab3 Mar 6, 2026
c3ecfba
refactor: remove main entry point class
OsamaRab3 Mar 6, 2026
73415b3
refactor: update Dockerfile and scripts to remove legacy user handlin…
OsamaRab3 Mar 6, 2026
b416d22
refactor: replace mounting of host passwd and group files with genera…
OsamaRab3 Mar 6, 2026
833faed
test: update init tests to include group and passwd files
OsamaRab3 Mar 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ node_modules
.idea
.vscode
samples/invalid-fablo-config.json
.DS_Store
.DS_Store
dist
17 changes: 4 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM node:20-alpine

RUN apk add --no-cache sudo shfmt
RUN npm install --global --silent yo

# copy fablo files
COPY generators /fablo/generators
COPY dist /fablo/dist
COPY package.json /fablo/package.json
COPY package-lock.json /fablo/package-lock.json

Expand All @@ -16,19 +15,11 @@ WORKDIR /fablo
RUN npm install --silent --only=prod
RUN npm link

# Add a yeoman user because Yeoman freaks out and runs setuid(501).
# This was because less technical people would run Yeoman as root and cause problems.
# Setting uid to 501 here since it's already a random number being thrown around.
# @see https://github.com/yeoman/yeoman.github.io/issues/282
# @see https://github.com/cthulhu666/docker-yeoman/blob/master/Dockerfile
# @see https://github.com/phase2/docker-yeoman/blob/master/Dockerfile
RUN adduser -D -u 501 yeoman && \
echo "yeoman ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Yeoman needs the use of a home directory for caching and certain config storage.
ENV HOME /network/workspace
ENV HOME=/network/workspace

COPY docker-entrypoint.sh /fablo/docker-entrypoint.sh
COPY bin /fablo/bin
COPY bin/run.mjs /fablo/bin/run.mjs
COPY docs /fablo/docs
COPY README.md /fablo/README.md
COPY samples /fablo/samples/
Expand Down
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
5 changes: 5 additions & 0 deletions bin/dev.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning

import { execute } from '@oclif/core'

await execute({ development: true, dir: import.meta.url })
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
5 changes: 5 additions & 0 deletions bin/run.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { execute } from '@oclif/core'

await execute({ dir: import.meta.url })
56 changes: 28 additions & 28 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,27 @@

set -e

executeYeomanCommand() {
executeOclifCommand() {
command_with_params=$1

# cleanup yeoman files after execution
# shellcheck disable=SC2064
trap "rm -rf \"$yeoman_target_dir/.cache\" \"$yeoman_target_dir/.config\" \"$yeoman_target_dir/.npm\"" EXIT

if [ "$(id -u)" = 0 ]; then
# root user detected, running as yeoman user
sudo chown -R yeoman:yeoman "$yeoman_target_dir"
# shellcheck disable=SC2086
(cd "$yeoman_target_dir" && sudo -E -u yeoman yo --no-insight $command_with_params)
sudo chown -R root:root "$yeoman_target_dir"
else
# shellcheck disable=SC2086
(cd "$yeoman_target_dir" && yo --no-insight $command_with_params)
fi
# shellcheck disable=SC2086
(cd "$target_dir" && node --no-warnings /fablo/bin/run.mjs $command_with_params)
}

formatGeneratedFiles() {
# Additional script and yaml formatting
#
# Why? Yeoman output may contain some additional whitespaces or the formatting
# Why? Generated output may contain some additional whitespaces or the formatting
# might not be ideal. Keeping those whitespaces, however, might be useful
# in templates to improve the brevity. That's why we need additional formatting.
# Since the templates should obey good practices, we don't use linters here
# (i.e. shellcheck and yamllint).
echo "Formatting generated files"
shfmt -i=2 -l -w "$yeoman_target_dir" >/dev/null
shfmt -i=2 -l -w "$target_dir" >/dev/null

for yaml in "$yeoman_target_dir"/**/*.yaml; do
for yaml in "$target_dir"/**/*.yaml; do

# the expansion failed, no yaml files found
if [ "$yaml" = "$yeoman_target_dir/**/*.yaml" ]; then
if [ "$yaml" = "$target_dir/**/*.yaml" ]; then
break
fi

Expand All @@ -48,16 +35,29 @@ formatGeneratedFiles() {
done
}

yeoman_target_dir="/network/workspace"
yeoman_command=${1:-Fablo:setup-network}

# This part of output will be replaces with empty line. It breaks parsing of yeoman generator output.
# See also: https://github.com/yeoman/generator/issues/1294
annoying_yeoman_info="No change to package.json was detected. No package manager install will be executed."
target_dir="/network/workspace"
oclif_command=${1:-setup-network}

# Map old yeoman command format to oclif format
case "$oclif_command" in
"Fablo:setup-network"|"fablo:setup-network")
oclif_command="setup-network"
;;
esac

# Build command with all arguments (mapped command + remaining args)
# Replace first argument with mapped command, then pass all args
if [ $# -gt 0 ]; then
shift
set -- "$oclif_command" "$@"
else
set -- "$oclif_command"
fi
command_with_args="$*"

# Execute the command
executeYeomanCommand "$yeoman_command" 2>&1 | sed "s/$annoying_yeoman_info//g"
executeOclifCommand "$command_with_args"

if echo "$yeoman_command" | grep "setup-network"; then
if echo "$oclif_command" | grep -q "setup-network"; then
formatGeneratedFiles
fi
7 changes: 5 additions & 2 deletions e2e-network/docker/test-01-v3-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,8 @@ expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \

# Test export-network-topology to Mermaid
cp -f "$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode.json" "$TEST_TMP/simple-config.json"
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" export-network-topology simple-config.json simple-network-topology.mmd)
expectCommand "cat \"$TEST_TMP/simple-network-topology.mmd\"" "graph LR"
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" export-network-topology simple-config.json network-topology.mmd)
expectCommand "cat \"$TEST_TMP/network-topology.mmd\"" "graph LR"


echo "Test passed ✅"
24 changes: 12 additions & 12 deletions e2e/__snapshots__/extendConfig.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = `
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": undefined,
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -1079,7 +1079,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] =
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": undefined,
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -1906,7 +1906,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": undefined,
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -2787,7 +2787,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": "OR('Org1MSP.member', 'Org2MSP.member')",
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -3197,7 +3197,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-go",
"directory": "chaincodes/chaincode-kv-go",
"endorsement": "AND('Org1MSP.member', 'Org2MSP.member')",
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -4275,7 +4275,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`]
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": "OR ('Org1MSP.member', 'Org2MSP.member')",
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -4735,7 +4735,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`]
],
"profileName": "MyChannel3",
},
"directory": "./chaincodes/chaincode-java-simple",
"directory": "chaincodes/chaincode-java-simple",
"endorsement": "OR ('Org1MSP.member', 'Org2MSP.member')",
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -6875,7 +6875,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": undefined,
"image": undefined,
"initRequired": false,
Expand Down Expand Up @@ -10886,7 +10886,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-2chaincodes.json 1`] = `
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": "AND ('Org1MSP.member')",
"image": undefined,
"init": "{"Args":[]}",
Expand Down Expand Up @@ -11256,7 +11256,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-2chaincodes.json 1`] = `
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-go",
"directory": "chaincodes/chaincode-kv-go",
"endorsement": "AND ('Org1MSP.member')",
"image": undefined,
"init": "{"Args":[]}",
Expand Down Expand Up @@ -13293,7 +13293,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] =
],
"profileName": "MyChannel1",
},
"directory": "./chaincodes/chaincode-kv-node",
"directory": "chaincodes/chaincode-kv-node",
"endorsement": "AND ('Org1MSP.member')",
"image": undefined,
"init": "{"Args":[]}",
Expand Down Expand Up @@ -15556,7 +15556,7 @@ exports[`extend config samples/java-dev-mode-sample.json 1`] = `
],
"profileName": "Mychannel",
},
"directory": "./chaincodes/java-chaincode",
"directory": "chaincodes/java-chaincode",
"endorsement": undefined,
"image": undefined,
"initRequired": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ installChaincodes() {
printItalics "Installing chaincodes...." "U1F618"
printItalics "Building chaincode chaincode1" "U1F618"
buildAndInstallChaincode "chaincode1" "peer0.$NAMESPACE" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "0.0.1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml"
buildAndInstallChaincode "chaincode1" "peer0.$NAMESPACE" "node" "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node" "0.0.1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml"
printItalics "Approving chaincode...." "U1F618"
approveChaincode "chaincode1" "peer0.$NAMESPACE" "0.0.1" "my-channel1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml" "Org1MSP"
Expand All @@ -279,7 +279,7 @@ installChaincodes() {
commitChaincode "chaincode1" "peer0.$NAMESPACE" "0.0.1" "my-channel1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml" "Org1MSP"
printItalics "Building chaincode chaincode1" "U1F618"
buildAndInstallChaincode "chaincode1" "peer1.$NAMESPACE" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "0.0.1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml"
buildAndInstallChaincode "chaincode1" "peer1.$NAMESPACE" "node" "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node" "0.0.1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml"
printItalics "Approving chaincode...." "U1F618"
approveChaincode "chaincode1" "peer1.$NAMESPACE" "0.0.1" "my-channel1" "$ORG1_CA_ADMIN_NAME" "$CONFIG_DIR/Org1.yaml" "Org1MSP"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1738,14 +1738,14 @@ installChannels() {
}
installChaincodes() {
if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then
if [ -n "$(ls "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node")" ]; then
printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E"
chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" ""
printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618"
chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" ""
else
echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty."
echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'"
echo "Looked in dir: '$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node'"
fi
}
Expand All @@ -1764,9 +1764,9 @@ installChaincode() {
fi
if [ "$chaincodeName" = "chaincode1" ]; then
if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then
if [ -n "$(ls "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node")" ]; then
printHeadline "Packaging chaincode 'chaincode1'" "U1F60E"
chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16"
chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node" "16"
chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "my-channel1"
printHeadline "Installing 'chaincode1' for Org1" "U1F60E"
chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "my-channel1" ""
Expand All @@ -1776,7 +1776,7 @@ installChaincode() {
else
echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty."
echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'"
echo "Looked in dir: '$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node'"
fi
fi
}
Expand Down Expand Up @@ -1812,9 +1812,9 @@ upgradeChaincode() {
fi
if [ "$chaincodeName" = "chaincode1" ]; then
if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then
if [ -n "$(ls "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node")" ]; then
printHeadline "Packaging chaincode 'chaincode1'" "U1F60E"
chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16"
chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node" "16"
chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "my-channel1"
printHeadline "Installing 'chaincode1' for Org1" "U1F60E"
chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "my-channel1" ""
Expand All @@ -1824,7 +1824,7 @@ upgradeChaincode() {
else
echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty."
echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'"
echo "Looked in dir: '$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node'"
fi
fi
}
Expand Down Expand Up @@ -1923,7 +1923,7 @@ services:
- ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's
- ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/
- ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/
- "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/"
- "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/"
networks:
- basic
Expand Down Expand Up @@ -2018,7 +2018,7 @@ services:
- ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's
- ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/
- ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/
- "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/"
- "$CHAINCODES_BASE_DIR/chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/"
networks:
- basic
Expand Down
Loading
Loading