CLI

Add, update, diff, build and test with the jsrepo CLI.

init

The init command helps you initialize a project that will add blocks with jsrepo.

npx jsrepo init
Usage: jsrepo init [options]

Initializes your project with a configuration file.

Options:
  --path        Path to install the blocks / Path to build the blocks from.
  --repos [repos...]  Repository to install the blocks from.
  --no-watermark      Will not add a watermark to each file upon adding it to your project.
  --tests             Will include tests with the blocks.
  -P, --project       Takes you through the steps to initialize a project.
  -R, --registry      Takes you through the steps to initialize a registry.
  --script      The name of the build script. (For Registry setup) (default: "build")
  -y, --yes           Skip confirmation prompt. (default: false)
  --cwd         The current working directory. (default: ".")
  -h, --help          display help for command

add

The add command helps you add blocks to your project from remote repositories.

npx jsrepo add <category>/<name>

or

npx jsrepo add github/<owner>/<name>/<category>/<name>
Usage: jsrepo add [options] [blocks...]

Arguments:
  blocks         Names of the blocks you want to add to your project. ex: (utils/math, github/ieedan/std/utils/math)

Options:
  --repo   Repository to download the blocks from.
  -A, --allow    Allow jsrepo to download code from the provided repo. (default: false)
  -y, --yes      Skip confirmation prompt. (default: false)
  --verbose      Include debug logs. (default: false)
  --cwd    The current working directory. (default: ".")
  -h, --help     display help for command

update

The update command helps you update blocks already installed in your project. When updating the CLI will take you over every changed file and show you a diff so you can what changed and decide whether or not to accept the change.

npx jsrepo update <category>/<name>
Usage: jsrepo update [options] [blocks...]

Arguments:
  blocks                    Names of the blocks you want to update. ex: (utils/math)

Options:
  --all                     Update all installed components. (default: false)
  -E, --expand              Expands the diff so you see everything. (default: false)
  --max-unchanged   Maximum unchanged lines that will show without being collapsed. (default: 3)
  --repo              Repository to download the blocks from.
  -A, --allow               Allow jsrepo to download code from the provided repo. (default: false)
  -y, --yes                 Skip confirmation prompt. (default: false)
  --verbose                 Include debug logs. (default: false)
  --cwd               The current working directory. (default: ".")
  -h, --help                display help for command

build

The build command builds the specified directories into a jsrepo-manifest.json file.

npx jsrepo build
Usage: jsrepo build [options]

Builds the provided --dirs in the project root into a `jsrepo-manifest.json` file.

Options:
  --dirs [dirs...]                         The directories containing the blocks. (default: ["./blocks"])
  --include-blocks [blockNames...]         Include only the blocks with these names. (default: [])
  --include-categories [categoryNames...]  Include only the categories with these names. (default: [])
  --exclude-deps [deps...]                 Dependencies that should not be added. (default: [])
  --no-output                              Do not output a `jsrepo-manifest.json` file.
  --error-on-warn                          If there is a warning throw an error and do not allow build to complete. (default: false)
  --verbose                                Include debug logs. (default: false)
  --cwd                              The current working directory. (default: ".")
  -h, --help                               display help for command

test

The test command allows you to run remote tests on your local code from the CLI.

This ensures any changes to your code haven't caused any of the original tests to fail.

npx jsrepo test
Usage: jsrepo test [options] [blocks...]

Tests local blocks against most recent remote tests.

Arguments:
  blocks         The blocks you want to test. (default: [])

Options:
  --repo   Repository to download the blocks from
  -A, --allow    Allow jsrepo to download code from the provided repo. (default: false)
  --debug        Leaves the temp test file around for debugging upon failure. (default: false)
  --verbose      Include debug logs. (default: false)
  --cwd    The current working directory. (default: ".")
  -h, --help     display help for command

diff

The diff command allows you to check what changes would occur if you were to update the block from remote.

npx jsrepo diff
Usage: jsrepo diff [options]

Compares local blocks to the blocks in the provided repository.

Options:
  -E, --expand              Expands the diff so you see everything. (default: false)
  --max-unchanged   Maximum unchanged lines that will show without being collapsed. (default: 3)
  --repo              Repository to download the blocks from.
  -A, --allow               Allow jsrepo to download code from the provided repo. (default: false)
  --cwd               The current working directory. (default: ".")
  -h, --help                display help for command