Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 1.88 KB

File metadata and controls

64 lines (41 loc) · 1.88 KB

CLI Development

Maintaining code around the CLI tool

The code is in src/cli/. The CLI commands are built using steps set in package.json.

  • See cli:install and bin section, which are both related and work with npm link.
  • See make cli-build which is for building binaries with pkg for distribution. See pkg page on NPM docs.

Run directly

Run a script directly without compiling:

$ npx ts-node src/cli/diffIndexGenerate.ts
$ npx ts-node src/cli/diffIndexGenerateCommit.ts
$ npx ts-node src/cli/generate.ts

Install globally

$ npm install
$ npm run cli:install

Package as a binary

See Releases for info on the release pipeline to publish the binaries.

Build the CLI as a binary which can be installed without the source code or Node.

$ make cli-build

Note

In Makefile, Node 18 is set to avoid errors from pkg. Even though 22 is set in package.json and is active with NVM. Check the pkg docs for more info on available versions.

Check the dist directory once it is created. These are added to a release.

Troubleshooting

On macOS, installed here as a symlink pointing to the .js file in the repo:

/opt/homebrew/bin/acm

If you get permissions issues, it is because the .js file was rebuilt and with standard permissions and needs to be linked again.

$ npm run cli

Check:

ls -l $(realpath /opt/homebrew/bin/acm)

See package.json.

Supposedly you should be able to leave out the project name when running npm link via an npm run ... command but I found this causes issues, so decided to always use the full name in the configuration. But removed it later . And to always unlink then link in one go because of permissions issues.