Skip to main content

CLI Options

jko provides a set of options that allow you to configure the process's input and output, including:

  • Optional input files for jko,
  • jko console output,
  • Environment settings for your scripts.

Available options are:

  • --config-file: Specifies a custom configuration file for jko.

  • --env-file: Allows jko to load environment variables from a specified file, supplementing the system’s environment. This is particularly useful for testing environments or when running jko in different, predefined setups.

  • --log: Sets the log level for jko. Depending on the provided value ("error", "warn" or "info"), jko will display messages according to the desired verbosity, helping to manage output detail during execution.

  • --package-manager: Determines which package manager should be used for dependency installations. By specifying a package manager (npm or yarn), users can ensure that jko employs the correct tool for managing packages.

Each option must be assigned a value:

$ jko --option1=value1 ... --option5=value5 yourScript 

Each option has a short version:

  • -c = --config-file.
  • -e = --env-file.
  • -l = --log.
  • -p = --package-manager.

e.g.

Instead of:

$ jko --log=error yourScript 

You can use:

$ jko -l=error yourScript 

To review available options from command line, execute:

$ jko --help 

--config-file

--config-file allows the user to specify a custom configuration file for jko, overriding the default settings defined in jko.js (or package.json).

  • --config-file can specified any .js, .mjs, .cjs or .json file.
    • The file path must start with /, ./, or `.
$ jko -c=./path/to/config.js ... 
  • --config-file can specified a package.
    • The package must be available, i.e. it must be installed first.
$ jko --config-file=somePackageName ... 
note

--config-file is the only option available exclusively via the CLI; all other options can be set in configuration files (for example, in jko.js, package.json, or even the file specified using --config-file), e.g. the --env-file option can be defined using the envFile field.


Options vs Arguments

  • Options are values that you pass to the jko.
  • Arguments are values passed to your script.

  • Options are defined after jko.
  • Arguments are defined after your script.

⬇️

$ jko --option1=value1 ... --option5=value5 yourScript arg1 ... argN 
  • Options are used internally by jko.
  • Arguments are used internally by your script.

Was this content valuable?