a hello world program written in JavaScript
The goal of this project is to create a homebrew
formula from JavaScript.
.
├── index.js # entry point of the package
├── package.json
├── dist
│ ├── # compiled files
│ └── # .tar.gz file
└── build
└── index.js # converted file from package into single js file
- Node.js v18 is recommended (v20 not compatible with
pkg
officially) ncc
is a simple CLI for compiling a Node.js module into a single file, together with all its dependencies, gcc-style.npm install -g @vercel/ncc
is required to compile the package into single file forpkg
to work
pkg
is a command line tool for creating executables from Node.js programsnpm install -g @vercel/pkg
is required to create a standalone executable file from the package- for node v20, use
npm install -g @yao-pkg/pkg
instead
- create package's repository on GitHub
create a new repository on GitHub or using git init
command to create a new repository locally.
$ git init
$ git add .
$ git commit -m "Initial commit"
$ git remote add origin <url>
$ git push -u origin master
or create a new github repository from gh
command line tool
$ gh repo create helloworld.js
- create a
package.json
file
$ npm init -y
- create a
index.js
file
Write a simple hello world program in index.js
file.
console.log('Hello, World!');
- create compiled script
$ npm run build && npm run package
- create
tar.gz
file for release
$ mkdir dist # if not exists
$ npm run tar
- create a release on GitHub
$ gh release create <tag> dist/<tar.gz file>
please visit Homebrew for more information on how to create a formula for your package.
Need assistance? Check out my discussion board or review the GitHub status page.
© 2023 AppleBoiy • Code of Conduct • MIT License