Installing b ber for development - triplecanopy/b-ber GitHub Wiki

Installing b-ber for development

The b-ber repository is a monorepo that is managed with Lerna. This means that a number of b-ber packages are published to npm from the same codebase.

Clone the repository and install dependencies

$ git clone https://github.com/triplecanopy/b-ber.git
$ npm i
$ cd b-ber/packages/b-ber-reader
$ npm i
$ cd ../../
$ npm run bootstrap
$ npm run build

Link the b-ber command line tools

To use to the b-ber CLI, use either npm link or create an alias to the b-ber-cli package. Ensure the repo is up-to-date before running the following from the b-ber repository.

Linking with npm

$ npm run bootstrap
$ npm run build
$ cd packages/b-ber-cli
$ npm unlink
$ npm link

Creating an Alias

This method allows you to run bber commands without having to re-link the package whenever a file changes.

  1. Add an alias to bber as _bber in your .bash_profile / .zshrc / or whichever file is loaded at startup. .bash_profile is used an an example below.

Note: Take notice of the leading underscore in the alias _bber.

$ echo "alias _bber=\"$(pwd)/packages/b-ber-cli/dist/index.js\"" >> ~/.zshrc
  1. Reload the shell.
$ source ~/.zshrc
  1. Test that everything is working.
$ _bber --version

Updating b-ber

$ git pull origin main
$ npm run bootstrap
$ npm run build

Developing the b-ber Reader

The b-ber-reader can be tested out independently of the rest of the application. Add unzipped Epubs to the packages/b-ber-reader/epub directory and run the following.

$ cd packages/b-ber-reader
$ npm start

This will open the contents of the packages/b-ber-reader/epub in a web browser.

The b-ber-reader will need to be re-built to function with the rest of the application once development is finished.

npm run lerna run build -- --scope=@canopycanopycanopy/b-ber-reader