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

feat: Add forc-publish plugin #6890

Merged
merged 10 commits into from
Feb 11, 2025
Merged

feat: Add forc-publish plugin #6890

merged 10 commits into from
Feb 11, 2025

Conversation

sdankel
Copy link
Member

@sdankel sdankel commented Feb 5, 2025

Description

Closes #6889

Currently it only works when running locally, as the forc.pub server is not yet live. Allows users to publish a package by running forc publish in the root of the package directory. Workspaces not yet supported.

It's intentionally not yet added to the release process (will be done in #6891)

To test it locally, run the forc.pub server and web app locally (see that repo's README for more details).

  1. Start DB ./scripts/start_local_db.sh
  2. Start server cargo run
  3. Start frontend cd app && npm start - opens localhost:3000
  4. Get API token from local webapp -> Login with Github -> API Tokens -> Generate new token
  5. Edit std-lib-core/Forc.toml and add a version key, i.e. version = 0.1.0
  6. Run forc publish from this branch: feat: Check and store package dependencies in database forc.pub#29 and you'll be prompted to enter the token.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@sdankel sdankel marked this pull request as ready for review February 5, 2025 03:26
@sdankel sdankel requested review from a team as code owners February 5, 2025 03:26
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@JoshuaBatty JoshuaBatty requested a review from a team February 5, 2025 04:11
@sdankel sdankel requested a review from a team February 7, 2025 20:03
JoshuaBatty
JoshuaBatty previously approved these changes Feb 9, 2025
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK. Wasn't able to test locally but the code changes here look good.

@JoshuaBatty JoshuaBatty requested a review from a team February 9, 2025 00:14
## Description

`type_check_method_application` does the parsing of arguments in 2
passes, but when the `resolved_method_name` failed the argument error
would not be displayed.

We now store the arg_handlers and append their errors in case
`resolve_method_name` fails.

Fixes #5660

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

Co-authored-by: Joshua Batty <[email protected]>
kayagokalp and others added 3 commits February 10, 2025 19:20
## Description

closes #6861 

`forc` was allowing dependency name being the same (through the use of
`package` alias and the declaration itself) as the project name.

The following two cases are now invalid and produces an error on the
forc-pkg side before going to the compiler.

```TOML
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "lib_contract"

[dependencies]
lib_contract = { path = "../lib_contract_abi/", package = "lib_contract_abi" }
```


and

```TOML
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "lib_contract_abi"

[dependencies]
lib_contract = { path = "../lib_contract_abi/", package = "lib_contract_abi" }

```

---------

Co-authored-by: Joshua Batty <[email protected]>
## Description
closes #6721.

There were couple of issues:

1. Archive unpacking was getting the bytes from `text` field of response
to the IPFS gateway which was adding additional stuff that messes with
unpacking routine.
2. Folder name was invalid so forc was unable to find the packages in
the `ipfs` cache.

Both issues are addressed and this unblocks forc to fetch ipfs fetched
packages once again. Next up on our package registry push is to enable
alternative sources and set the precedence for them.

Also added some tests around extracting logic, which inserts the
contents under a directory named after `CID` as this is how `forc` is
looking for these sources in the first place (related to point 2 above)
Copy link

codspeed-hq bot commented Feb 11, 2025

CodSpeed Performance Report

Merging #6890 will not alter performance

Comparing sophie/forc-publish (b8a99b1) with master (0640dbe)

Summary

✅ 22 untouched benchmarks

@JoshuaBatty JoshuaBatty requested review from a team February 11, 2025 03:58
@sdankel sdankel merged commit eafd99e into master Feb 11, 2025
39 checks passed
@sdankel sdankel deleted the sophie/forc-publish branch February 11, 2025 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

forc-publish plugin
5 participants