Stop recommending to use pkg for creating a binary CLI due to deprecation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
How can I create a single binary CLI, like with Go?
Use pkg. Make sure you add the commands and other source files by setting pkg.scripts: "./lib/**/*.js" in package.json.
https://oclif.io/docs/faqs/#how-can-i-create-a-single-binary-cli-like-with-go
pkg is deprecated since v5.8.1 2 years ago:
https://github.com/vercel/pkg
I still tried to get it to work with the hello world command line example on macos by adding this to package.json:
...
"pkg": {
"scripts": "dist/**/*.js",
"assets": "dist/**/*",
},
"scripts": {
"pkg": "pkg ./bin/run.js --target node*-mac-x64 --output build/acrolinx.mac-x64",
...
when I ran it in the terminal I just got:
$ ... test-oclif% npm run pkg
test-oclif@0.0.0 pkg
pkg ./bin/run.js --target node*-mac-x64 --output build/acrolinx.mac-x64
pkg@5.8.1
Warning Babel parse has failed: 'await' is only allowed within async functions and at the top levels of modules. (5:0)
Warning Failed to make bytecode node*-x64 for file /snapshot/bin/run.js
Since pkg also does not support node20 or 22, it is probably best to remove it from the documentation, unless it is somehow still viable. Would be nice to have a more in depth explaination in the docs about how a binary can be build.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FAQ entry at oclif.io/docs/faqs/#how-can-i-create-a-single-binary-cli-like-with-go and review the guidance around pkg, including the package.json example. Update the documentation to remove or replace deprecated pkg advice and explain the supported binary-building approach; verify the rendered FAQ no longer recommends an unsupported path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100