Skip to content

0.1.0-alpha.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 22 Feb 15:41
· 1256 commits to main since this release
d5553de

Scarb Third Alpha

Welcome to the third (and hopefully last) alpha release of Scarb. There are two highlights of this version:

  • Git dependencies support - Pull dependencies from Git repositories.
  • scarb add - Add entries to the [dependencies] section in Scarb.toml from command line.

Git dependencies support

Scarb is now capable of pulling dependencies from Git repositories. The syntax for specifying such dependencies in Scarb.toml is identical to one in Cargo:

[dependencies]
quaireaux = { git = "https://github.com/keep-starknet-strange/quaireaux.git" }

As seen in this example, Quaireaux already is a Scarb package 🎉

You can also specify a particular Git reference:

  1. Branch:

    quaireaux = { git = "https://github.com/keep-starknet-strange/quaireaux.git", branch = "feature/stack" }
  2. Tag:

    quaireaux = { git = "https://github.com/keep-starknet-strange/quaireaux.git", tag = "v0.1.0" }
  3. GitHub pull request:

    quaireaux = { git = "https://github.com/keep-starknet-strange/quaireaux.git", rev = "refs/pull/36/head" }
  4. Commit hash:

    quaireaux = { git = "https://github.com/keep-starknet-strange/quaireaux.git", rev = "e03c883" }

Note: Because there is no Scarb.lock file yet, Scarb will attempt to git fetch and update dependencies on each invocation.

scarb add

To ease adoption, we decided to promptly add scarb add command, which adds requested dependencies to Scarb.toml file. The interface of this command is almost identical to cargo add, but one noticeable difference is that Scarb does not yet try to download the dependency to gather its real version (in order to put it in the manifest instead of user-provided version requirement). This interface allows adding any valid dependency specification.

$ scarb add -h
Add dependencies to a Scarb.toml manifest file

Usage: scarb add [OPTIONS] [DEP_ID]...

Arguments:
  [DEP_ID]...  Reference to a package to add as a dependency

Options:
      --dry-run                        Do not actually write the manifest
      --manifest-path <MANIFEST_PATH>  Override path to a directory containing a Scarb.toml file [env: SCARB_MANIFEST_PATH=]
  -p, --package <PACKAGE>              Specify package to modify
  -v, --verbose...                     More output per occurrence
  -q, --quiet...                       Less output per occurrence
      --json                           Print machine-readable output in NDJSON format
      --offline                        Run without accessing the network [env: SCARB_OFFLINE=]
  -h, --help                           Print help (see more with '--help')

Source:
      --path <PATH>      Filesystem path to local package to add
      --git <URI>        Git repository location
      --branch <BRANCH>  Git branch to download the package from
      --tag <TAG>        Git tag to download the package from
      --rev <REV>        Git reference to download the package from

For example, to add Quaireaux dependency, you can run:

scarb add quaireaux --git https://github.com/keep-starknet-strange/quaireaux.git

Notable minor changes

  • Scarb passes some more information about execution environment via environment variables to subcommands.
  • Both scarb --help and scarb metadata will now contain information about Cairo language version bundled with Scarb.
  • We don't vendor Cairo's core library in Scarb's repo any more, instead we pull it from upstream during build time. This still is not the final solution, but it's a step forward.
  • Added --offline flag, which prevents Scarb from doing any network access.
  • scarb -q will not silent any messages printed to standard output; similarly, scarb -v will print a little bit more.
  • Slightly tweaked handling of .gitignore file in scarb new.

Cairo version

This version of Scarb comes with Cairo v0.1.0-alpha.3.

Pull requests

Full Changelog: v0.1.0-alpha.1...v0.1.0-alpha.2