clarinet
clarinet copied to clipboard
[Feature] Add deps.ts file for less error prone library upgrades.
Right now all test files and any other files that uses some part of Clarinet imports Clarinet library at the top of each file.
For example:
import {
Account,
Chain,
Clarinet,
Tx,
types,
} from "https://deno.land/x/[email protected]/index.ts";
It's ok when we have only few files and we know that we won't have to or don't want to upgrade Clarinet library very often. But when we'll have more files suddenly upgrading to new version is a bit challenging, as we have to find every single file with import and update it.
Deno documentation suggests that it can be beneficial to use deps.ts
file.
I think that Clarinet should suggest this approach when we create a new project. That way it would teach users a good practice that will save them some time in the future.
We tried it out in CityCoin and I like this solution: https://github.com/citycoins/citycoin/blob/main/deps.ts https://github.com/citycoins/citycoin/blob/bf7e22ff8bf29f74a0a5a60c5b0737c2d1cd18f3/src/client.ts#L1-L5
@philipdesmedt, @nieldeckx you may want to try this approach in Arkadiko. I saw that you have quite a lot of test files.
@LNow This is a good refactoring. I'll talk to Niel and try this over the next week or so
Interesting, thank you @LNow for this approach!
Great idea, will adopt this as well.