Skip to content
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

fix: improve fuels init directory detection #3638

Merged

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Jan 28, 2025

Release notes

In this release, we:

  • Improved directory detection for fuels init

Summary

When using fuels init, we now detect individual contracts, predicates and scripts by their respective Forc.toml files. This should account for more user error when using the command and alleviate some pain points.

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@petertonysmith94 petertonysmith94 added the bug Issue is a bug label Jan 28, 2025
@petertonysmith94 petertonysmith94 self-assigned this Jan 28, 2025
Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 1:17pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 1:17pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 1:17pm

arboleya
arboleya previously approved these changes Feb 4, 2025
@Torres-ssf
Copy link
Contributor

Torres-ssf commented Feb 4, 2025

@petertonysmith94 Maybe I am missing something, but when running this locally while using the fuels from your branch, I have the following output for the project that I am using:

➜  pnpm fuels init --predicates sway-programs/predicate/* --output ./src/predicate_api
using deprecated parameters for the initialization function; pass a single object instead

✅ Your fuels version is up to date: 0.98.0

############### INIT CALLED

error: unable to detect program/s
- contract/s detected 0

The ############### INIT CALLED was added by me to serve as a confirmation that I was using the fuels from your branch

But when using the released version, everything seems to work:

➜  pnpm fuels init --predicates sway-programs/predicate/* --output ./src/predicate_api
using deprecated parameters for the initialization function; pass a single object instead

✅ Your fuels version is up to date: 0.98.0

Config file created at:

 /Users/torres-m3/Documents/personal/my-fuel-project/fuels.config.ts

@petertonysmith94 petertonysmith94 marked this pull request as draft February 4, 2025 19:47
@petertonysmith94
Copy link
Contributor Author

@petertonysmith94 Maybe I am missing something, but when running this locally while using the fuels from your branch, I have the following output for the project that I am using:

It was me that was missing something - nice catch 🎣

Turns out the OS expands glob patterns before they hit the CLI. Therefore, our tests weren't picking these up. I've made the following changes 167c42a which should address this :)

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Coverage Report:

Lines Branches Functions Statements
77.25%(+0.05%) 70.73%(-0.03%) 75.42%(+0.13%) 77.24%(+0.05%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/fuels/src/cli/commands/init/index.ts 95.34%
(-4.66%)
83.33%
(-16.67%)
100%
(+0%)
95.55%
(-4.45%)
🔴 packages/fuels/src/cli/config/forcUtils.ts 94.28%
(+0.84%)
75%
(-5%)
100%
(+0%)
94.59%
(+0.75%)

@petertonysmith94 petertonysmith94 merged commit 0429278 into master Feb 6, 2025
24 checks passed
@petertonysmith94 petertonysmith94 deleted the ps/fix/improve-fuels-init-directory-detection branch February 6, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve fuels init directory detection
3 participants