Skip to content

Feat/npm distribution - #871

Open
Efeguclu1 wants to merge 8 commits into
hyperledger-labs:mainfrom
Efeguclu1:feat/npm-distribution
Open

Efeguclu1 wants to merge 8 commits into
hyperledger-labs:mainfrom
Efeguclu1:feat/npm-distribution

Conversation

@Efeguclu1

Copy link
Copy Markdown
Contributor

Fablo can now be installed from npm as @fablo-io/fablo. When installed that way, generator commands (init, generate, validate, …) run on the local Node.js instead of the Fablo Docker image. The network itself still runs on Docker.

Changes

  • package.json: renamed to @fablo-io/fablo; fixed the bin entry; added files, engines and prepack
  • fablo.sh: runs generator commands locally when started from the npm package
  • docker-entrypoint.sh: works outside the image; shfmt is optional
  • fix: .gitignore templates renamed to gitignore, because npm never packs .gitignore files
  • test-01-v3-simple.sh now runs from the packed npm package
  • New publish-npm job in release-on-tag.yml (script: .github/scripts/publish-npm.sh); pre-releases go to next

npm never includes files named .gitignore in a package, so generate
failed when Fablo was installed from npm.

Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
When installed from npm, fablo.sh runs generator commands on the local
Node.js instead of the Fablo Docker image. shfmt is optional.

Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
npm 11 removes bin entries starting with ./ when publishing, which left
the published package without the fablo command.

Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
The workflow keeps the setup steps; the version check, dist-tag choice
and publish live in a script that runs locally with DRY_RUN=1.
lint.sh now shellchecks .github/scripts.

Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
Comment thread package.json Outdated
@@ -1,5 +1,5 @@
{
"name": "fablo",
"name": "@fablo-io/fablo",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can actually use fablo - https://www.npmjs.com/package/fablo

Comment on lines +32 to +35
# provenance can only be generated inside GitHub Actions
if [ -n "${GITHUB_ACTIONS:-}" ]; then
publish_flags+=(--provenance)
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be verified

Comment thread .github/workflows/release-on-tag.yml Outdated
Comment on lines +72 to +79
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org

- name: Update npm (trusted publishing needs 11.5.1 or newer)
run: npm install --global npm@11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be checked if we can set npm version in actions/setup-node@v4

Comment thread bin/fablo.mjs Outdated
Comment on lines +11 to +14
const result = spawnSync("bash", [join(packageDir, "fablo.sh"), ...process.argv.slice(2)], {
stdio: "inherit",
env: { ...process.env, FABLO_PACKAGE_DIR: packageDir },
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want fablo.sh because is requires docker. We want to generate network without fablo container (assume fablo container is not available).

we should map fablo.sh commands/features to call node.js fablo sources/lib, without redundant Docker container layer.

Comment thread docs/fablo.sh Outdated
Comment on lines +304 to +310
executeFabloGenerator() {
if [ -n "$FABLO_PACKAGE_DIR" ]; then
executeOnLocalFablo "$@"
else
executeOnFabloDocker "$@"
fi
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to call local node.js Fablo package, but the whole execution is:

  1. cal node.js fablo
  2. spawn process with fablo.sh
  3. fablo.sh calls fablo node.js dist

instead node.js fablo should call fablo node.js dist directly

@mergify

mergify Bot commented Nov 11, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

…o image

Signed-off-by: Efeguclu1 <efeguclu3435@gmail.com>
@dzikowski
dzikowski enabled auto-merge (squash) November 19, 2026 11:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants