clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Revisit Deno vendoring

Open lgalabru opened this issue 3 years ago • 2 comments
trafficstars

With this PR, we are revisiting the integration points between Deno and Clarinet. As explained in https://github.com/hirosystems/clarinet/issues/423, developers have been busy unbundling Deno into smaller crates, which is exciting for Clarinet. In this new approach, Clarinet relies as much as possible on the canonical version of Deno (using the libs published on crates.io). The remaining code being imported in clarinet is:

  • Glue code for configuring a Deno test environment. The approach here is to import a large portion of deno-cli, call the right functions and let the linker eliminating the dead code.
  • Deno runtime: we could rely on deno-runtime but this crate does not give the ability to select features. as such, things like WebGL are being imported and compiled, which adds a lot of complexity to the compilation process.

Todo

  • [ ] More tests
  • [ ] More pruning
  • [ ] Explicit message for developers using v0.33.0 -> need to upgrade to v0.34.0
  • [ ] Remove gitsubmodule

lgalabru avatar Aug 07 '22 23:08 lgalabru

From an outside-in perspective, things look good. #393 and related/external issues seem to be solved. I should be able to run this with more test-suites soon. Thank you @lgalabru 👍

moodmosaic avatar Aug 10 '22 11:08 moodmosaic

Looks like this functionality no longer works in this branch:

$ clarinet requirements add ST3QFME3CANQFQNR86TYVKQYCFT7QX4PRXM1V9W6H.cargo
Updated Clarinet.toml with requirement ST3QFME3CANQFQNR86TYVKQYCFT7QX4PRXM1V9W6H.cargo

# Though nothing was actually added.

moodmosaic avatar Aug 12 '22 21:08 moodmosaic

@lgalabru:

Deno supports using a TS config file, though like the rest of Deno, the detection and use of a configuration file is not automatic. To use a TS config file with Deno, we have to provide a path on the command line, for example:

deno test --config ./deno.json tests.ts

IMPORTANT Deno prefers naming that file deno.json isntead of tsconfig.json as explained here.

It'd be useful if we could load such configuration in Deno when running Clarinet test, for example:

# Explicit
clarinet test --deno-config ./deno.json

# Implicit (if there's a deno.json file present in the root dir, note the user that it's been loaded.)
clarinet test

This may be useful for #398 where we might have to enable decorators so that we can reflect on the test function arguments and pick the right fast-check arbitrary, and also allow the user through metadata to override our built-in arbitraries.

moodmosaic avatar Aug 16 '22 11:08 moodmosaic