Use nvm to use the appropriate Node.js version from .nvmrc:
nvm iInstall the dependencies using pnpm:
pnpm iRun the build script:
pnpm buildThe package is bundled using pkgroll (Rollup). It infers the entry-points from package.json so there are no build configurations.
During development, you can use the watch flag (--watch, -w) to automatically rebuild the package on file changes:
pnpm build -wSince pkgroll knows the entry-point is a binary (being in package.json#bin), it automatically adds the Node.js hashbang to the top of the file, and chmods it so it's executable.
You can run the distribution file in any directory:
./dist/cli.mjsOr in non-UNIX environments, you can use Node.js to run the file:
node ./dist/cli.mjsTesting requires passing in GEMINI_KEY as an environment variable:
GEMINI_KEY=<your GEMINI key> pnpm testYou can still run tests that don't require GEMINI_KEY but will not test the main functionality:
pnpm test
Let's say you made some changes in a fork/branch and you want to test it in a project. You can publish the package to a GitHub branch using git-publish:
Publish your current branch to a npm/* branch on your GitHub repository:
$ pnpm dlx git-publish
✔ Successfully published branch! Install with command:
→ npm i 'mzazakeith/gemcommits#npm/develop'Note: The
mzazakeith/gemcommitswill be replaced with your fork's URL.
Now, you can run the branch in your project:
$ pnpm dlx 'mzazakeith/gemcommits#npm/develop' # same as running `npx gemcommits`