Publishing blt.diy as npm package for better user experience

I idea came while I was discussing plugins with @wonderwhy.er , when he mentioned bolt can be a npm package which can be used as library.

which sparked the idea of why not first publish the releases of bolt as standalone npm package like jupyter notebook or lab

also I hate the idea of regular end users doing git clone to run the project.
What if we publish the release as bolt package in npm with a bin to start the application

for example:
user goes to terminal and types
npm install bolt -g
this will install bolt as a package in there system

then in the terminal the can type
bolt --port 3000

this will start the local bolt server

here is a simple implementation is did

here is a PR that you can try

3 Likes

Ouh you already did that.
Thus could make it possible to run it as npx bolt.diy or something.
Love it.
Need to take a look.

1 Like

done.
you need to use npm link in the project to use the cli, since its not published yet

1 Like

@wonderwhy.er
try running this command in your terminal, no need to clone the repo just anywhere in the terminal
npm install -g bolt.diy

and then try the command after installation
bolt.diy

@aliasfox this uses build version of the code not the dev version

1 Like

tried
npx bolt.diy
got this

Tried
npm install -g bolt.diy
got

did work with sudo npm install -g bolt.diy

but then running with
bolt.diy

Running with sudo did work
But honestly running with sudo could be concerning to some people

But still great progress towards this!

1 Like

Doesn’t work for me, for either bolt.diy or npx bolt.diy after install.

Haven’t tried this on Linux yet, but on Windows it just doesn’t know what to do. And most people probably use Windows:

needs to change the bolt.js file permission with chmod…

also needs to see how this can be done on windows since it might needs a exe maybe

@wonderwhy.er
can you try now. i have added steps to fix the permissions
npm i -g bolt.diy@0.0.5-test-2

It tried to launch the shell script again by default, but then I just browsed to the directory and ran the CMD and it worked for me. I’m running Windows 11 and I will check on Linux later.

image

so you where not able to directly run bolt.diy?

It defaulted to the bolt.diy (no extension/shell script) on Windows and not bolt.diy.cmd, so no.

I think i need to run a vm with windows to get this fixed

Just tried
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: EACCES: permission denied, open β€˜/Users/eduardruzga/Library/Preferences/.wrangler/registry/bolt’
at async open (node:internal/fs/promises:639:25)
at async writeFile (node:internal/fs/promises:1212:14)
at async Object.registerWorker (/usr/local/lib/node_modules/bolt.diy/node_modules/wrangler/wrangler-dist/cli.js:197368:3)
at async LocalRuntimeController. (/usr/local/lib/node_modules/bolt.diy/node_modules/wrangler/wrangler-dist/cli.js:198485:17)

I wonder if this is something specific to me or my setup
This is on Mac

my doubt is, because I am the creator of the file so I have execute permission. when you are installing i have a script whichdoes β€œchmod” to the file to make it executable.
thats where the issue is occurring, its not properly getting executed i believe

I actually released my first npm module over last weeks
As part of it also needed to make things executable
Here how it looks for Claude MCPs usually, may be that can help.

The shx chmod +x dist/*.js part
It should work on windows too

@thecodacus just let me know / ping me in chat, if I should test something out in windows.

1 Like

i initially put chmod but removed it from the package.json.
never tried shx, is this a builtin command in windows ?

itΒ΄s not a build in command: GitHub - shelljs/shx: Portable Shell Commands for Node

so the package has to have this as dependency

1 Like