-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: Support Foundry contract naming conventions #906
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote the tests because we shouldn't test isMatch
but findContract
instead. Otherwise there's no direct test connection between these tests and the actual CLI
LGTM
const lastSlash = contract.fullyQualifiedName.lastIndexOf('/'); | ||
const fullyQualifiedWithoutPath = | ||
lastSlash >= 0 ? contract.fullyQualifiedName.slice(lastSlash + 1) : contract.fullyQualifiedName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also more straightforward as well
const lastSlash = contract.fullyQualifiedName.lastIndexOf('/'); | |
const fullyQualifiedWithoutPath = | |
lastSlash >= 0 ? contract.fullyQualifiedName.slice(lastSlash + 1) : contract.fullyQualifiedName; | |
const fullyQualifiedWithoutPath = contract.fullyQualifiedName.replace(/.*\//, ''); |
|
||
function matchesDotSol(contractName: string, contract: SourceContractIdentifier) { | ||
if (contractName.endsWith('.sol')) { | ||
const name = contractName.slice(0, contractName.length - 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more explicit imo
const name = contractName.slice(0, contractName.length - 4); | |
const name = contractName.replace('.sol', '') |
Cancelling since Foundry naming conventions are not standard, so should be handled by the caller on the Foundry side before calling the Upgrades CLI. |
Fixes #902