-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: make packages usable locally #984
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
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
fc80492
Adding new workspace for tooling stuff
arboleya d439486
Re-configuring `tsup.config.ts` and `package.json` for all packages
arboleya e7b042f
Fixing broken mock
arboleya 5e91d01
Adding simple TODO
arboleya fabc541
Updating lock file
arboleya 955c40c
Adding changeset
arboleya a2dbdc2
Renaming workspace
arboleya 82f1e11
Using Typescript for internal package
arboleya 8457e2a
Building package ahead of time for early availability
arboleya f55ff50
Merging with master
arboleya 0705762
Docs
arboleya 3f81569
Enabling pr release
arboleya 02762ef
Adjusting dependencies split
arboleya 3091491
Updating lock file
arboleya 9bb81d1
Re-stitching internal dependencies
arboleya 4277a96
Adjusting tsup configs for `forc-bin`
arboleya 3ce4181
Merge remote-tracking branch 'origin/master' into aa/feat/make-packag…
arboleya ae476a3
Lintfix
arboleya 9ab72b3
Configuring `nodemon` for optimal file-watch performance
arboleya 9efdd8a
Sorting
arboleya 6e4a5f4
Docs
arboleya 932cf2a
DRY tsup config for `fuels`
arboleya 8f98342
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya e8f2ce4
Moving commands from external script to `package.json`
arboleya abdc0aa
Re-configuring newly added `utils` package
arboleya a6423c6
Referencing bin directly (symlink is broken at first execution)
arboleya 5fe8d3c
Fixing workflow, ensuring only the first regex match is used (head -1)
arboleya d7a87a2
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 5b565aa
Improving docs
arboleya bdefdd4
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 59651da
Turning off PR auto-release
arboleya 9fbd944
Update CONTRIBUTING.md
arboleya 5568562
Resetting docker env before (and after) running tests
arboleya 14082fa
Better organizing scripts
arboleya b31c50f
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 4272721
Marking package as a core module (installed on the monorepo root)
arboleya 80ca770
Fixing binary path
arboleya 2733db3
Publishing a new PR version
arboleya d3d5600
Merging with master
arboleya 8d823a6
Fixing residual merge problems (using `tsx`).
arboleya 4dd64db
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya fa6bf6d
Merge branch 'aa/feat/make-packages-usable-locally' of github.com:Fue…
arboleya 75da28a
Disabling PR auto-publish
arboleya 755beb0
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 0fa46e9
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 04a4b31
Merging with master
arboleya 1ba46c0
Merging with master
arboleya ea65535
Enabling PR auto-publish
arboleya ac84689
Disabling PR auto-publish
arboleya d940a9c
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya e4f9ce3
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 7ef1364
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 6623a50
Merging with master
arboleya 5c2948d
Fixing broken link
arboleya 058a328
Merging with master
arboleya 110e7fa
Re-adding lost `nodemon` dep after merge conflicts
arboleya 47bd051
Docs
arboleya 8a8a672
Enabling PR auto-publish
arboleya fa8cf36
Disabling PR auto-publish
arboleya 1b89cb2
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 9e427f9
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya 74b6b08
Merge branch 'master' into aa/feat/make-packages-usable-locally
arboleya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| "@fuel-ts/abi-coder": minor | ||
| "@fuel-ts/abi-typegen": minor | ||
| "@fuel-ts/address": minor | ||
| "@fuel-ts/contract": minor | ||
| "forc-bin": minor | ||
| "fuels": minor | ||
| "@fuel-ts/hasher": minor | ||
| "@fuel-ts/hdwallet": minor | ||
| "@fuel-ts/interfaces": minor | ||
| "@fuel-ts/keystore": minor | ||
| "@fuel-ts/math": minor | ||
| "@fuel-ts/merkle": minor | ||
| "@fuel-ts/merkle-shared": minor | ||
| "@fuel-ts/merklesum": minor | ||
| "@fuel-ts/mnemonic": minor | ||
| "@fuel-ts/predicate": minor | ||
| "@fuel-ts/program": minor | ||
| "@fuel-ts/providers": minor | ||
| "@fuel-ts/script": minor | ||
| "@fuel-ts/signer": minor | ||
| "@fuel-ts/sparsemerkle": minor | ||
| "@fuel-ts/transactions": minor | ||
| "@fuel-ts/versions": minor | ||
| "@fuel-ts/wallet": minor | ||
| "@fuel-ts/wallet-manager": minor | ||
| "@fuel-ts/wordlists": minor | ||
| --- | ||
|
|
||
| Revamping all packages configs, enabling local installation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| ## 💚 Contributing To Fuel TypeScript SDK | ||
| # Contributing To Fuel TypeScript SDK | ||
|
|
||
| Thanks for your interest in contributing to the Fuel TypeScript SDK! This document outlines the process for installing dependencies, setting up for development, and conventions for contributing. | ||
| Thanks for your interest in contributing to the Fuel TypeScript SDK! | ||
|
|
||
| ## Finding Something to Work On | ||
| This document outlines the process for installing dependencies, setting up for development and conventions for contributing. | ||
|
|
||
| # Finding Something to Work On | ||
|
|
||
| There are many ways in which you may contribute to the project, some of which involve coding knowledge and some which do not. A few examples include: | ||
|
|
||
|
|
@@ -14,7 +16,7 @@ Check out our [Help Wanted](https://github.com/FuelLabs/fuels-ts/issues?q=is%3Ao | |
|
|
||
| If you are planning something big, for example, changes related to multiple components or changes to current behaviors, make sure to [open an issue](https://github.com/FuelLabs/fuels-ts/issues/new) to discuss with us before starting on the implementation. | ||
|
|
||
| ### Setup | ||
| # Setting up | ||
|
|
||
| ```sh | ||
| git clone [email protected]:FuelLabs/fuels-ts.git | ||
|
|
@@ -23,9 +25,76 @@ pnpm install | |
| pnpm build | ||
| ``` | ||
|
|
||
| ## Testing | ||
| # Developing | ||
|
|
||
| For building everything in watch-mode, run: | ||
|
|
||
| ```sh | ||
| # build all projects in watch-mode | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| File watching is done by `nodemon` for increased performance. | ||
|
|
||
| Check `nodemon.config.json` for all settings. | ||
|
|
||
| > **Note**: You can `pnpm dev` a single package: | ||
| > | ||
| > ```sh | ||
| > cd packages/abi-coder | ||
| > pnpm dev | ||
| > ``` | ||
|
|
||
| # Using local sym-linked packages | ||
|
|
||
| First, we need to link our `fuels` package globally in our local `global pnpm store`: | ||
|
|
||
| ```sh | ||
| cd fuels-ts/packages/fuels | ||
| pnpm link --global | ||
| ``` | ||
|
|
||
| Let's check it out: | ||
|
|
||
| ```sh | ||
| pnpm list --global | ||
| ``` | ||
|
|
||
| Cool, now on the root directory of `my-local-project`: | ||
|
|
||
| ```sh | ||
| cd my-local-project | ||
| pnpm link --global fuels | ||
| ``` | ||
|
|
||
| That's it — `my-local-project` is now using our local version of `fuels`. | ||
|
|
||
| The same can be done with all other packages: | ||
|
|
||
| ```sh | ||
| cd fuels-ts/packages/wallet | ||
| pnpm link --global | ||
|
|
||
| # ... | ||
|
|
||
| pnpm list --global # validating | ||
|
|
||
| # ... | ||
|
|
||
| cd my-local-project | ||
| pnpm link --global @fuel-ts/wallet | ||
| ``` | ||
|
|
||
| > **Warning** When using local symlinked `fuels-ts` in `your-local-project`, remember to `pnpm build` the SDK whenever you change a source file to reflect the changes on `your-local-project`. To automate this, you can use `pnpm dev`, which will keep watching and compiling everything automatically while developing. | ||
|
|
||
| See also: | ||
|
|
||
| - [Developing](#Developing) | ||
|
|
||
| # Testing | ||
|
|
||
| In order to run tests locally, you need `fuel-core` running as a docker container. | ||
|
|
||
| To do that run this command in your terminal: | ||
|
|
||
| ```sh | ||
|
|
@@ -37,10 +106,15 @@ And then run the tests in another terminal tab: | |
| ```sh | ||
| # run all tests | ||
| pnpm test | ||
| # run tests and get coverage | ||
| pnpm test -- --coverage | ||
|
|
||
| # run tests while passing other flags to sub-program | ||
| pnpm test -- --coverage --my-other-flag | ||
|
|
||
| # run tests for a specific package | ||
| pnpm --filter @fuel-ts/contract run test | ||
| pnpm test packages/my-desired-package | ||
|
|
||
| # run tests for a specific file | ||
| pnpm test packages/my-desired-package/src/my.test.ts | ||
| ``` | ||
|
|
||
| Or if you want to run docker and all tests serially you can do: | ||
|
|
@@ -51,10 +125,10 @@ pnpm ci:test | |
|
|
||
| This will run `services:run`, `test` and then `services:clean` | ||
|
|
||
| > The tests may break if you are running your tests locally using`services:run` in a separate terminal. | ||
| > The tests may break if you are running your tests locally using `services:run` in a separate terminal. | ||
| > To fix this run `services:clean` to clean docker containers and volumes. | ||
|
|
||
| ## Commit Convention | ||
| # Commit Convention | ||
|
|
||
| Before you create a Pull Request, please check whether your commits comply with | ||
| the commit conventions used in this repository. | ||
|
|
@@ -79,7 +153,7 @@ the following categories: | |
| - `chore`: all changes to the repository that do not fit into any of the above | ||
| categories | ||
|
|
||
| ## Steps to PR | ||
| # Steps to PR | ||
|
|
||
| 1. Fork the fuels-ts repository and clone your fork | ||
|
|
||
|
|
@@ -100,74 +174,39 @@ the following categories: | |
| > `pnpm changeset add --empty` to generate an empty changeset file to document | ||
| > your changes. | ||
|
|
||
| ## Git Hooks | ||
| # Git Hooks | ||
|
|
||
| The SDK utilizes a pre-push git hook to validate your contribution before review. This is a script that will run automatically before changes are pushed to the remote repository. Within the SDK, the pre-push script will run code linting. | ||
|
|
||
| > This can be overridden using the `--no-verify` flag when pushing. | ||
|
|
||
| ## Build and watch all packages | ||
|
|
||
| If you want to work locally using realtime builds, open in one terminal tab build in watch mode | ||
| on all packages from the root directory: | ||
|
|
||
| ```sh | ||
| pnpm build:watch | ||
| ``` | ||
|
|
||
| This command will run `tsup --watch` on all packages using Turborepo | ||
|
|
||
| ## Using linked packages | ||
|
|
||
| This will link all packages inside our monorepo in your `global pnpm store`, enabling you to use `fuels-ts` packages via links in | ||
| your local projects. | ||
|
|
||
| ### On `fuels-ts` root directory | ||
|
|
||
| ```sh | ||
| pnpm -r exec pnpm link --global --dir ./ | ||
| ``` | ||
|
|
||
| You can use [build watch](#build-and-watch-all-packages). | ||
|
|
||
| ### On `your project` root directory | ||
|
|
||
| ```sh | ||
| pnpm link --global fuels | ||
| ``` | ||
| # Updating Forc version | ||
|
|
||
| Or for specfic packages just use `pnpm link @fuel-ts/<pkg-name>`, ex; | ||
| The following script will upgrade Forc to the latest version on GitHub, remove all lockfiles so the latest stdlib can be used, and rebuild all projects: | ||
|
|
||
| ```sh | ||
| pnpm link --global @fuel-ts/wallet | ||
| pnpm forc:update | ||
| ``` | ||
|
|
||
| ### Troubleshooting | ||
|
|
||
| If you're linking for the first time, you might need: | ||
| After this you should run tests and fix any incompatibilities. | ||
|
|
||
| ```sh | ||
| pnpm setup | ||
| ``` | ||
| # Updating Fuel Core version | ||
|
|
||
| If it still have problems, you might need to setup again (As `pnpm` releases new version, the global folder structure may change) | ||
| Manually edit the `.docker/fuel-core/Dockerfile` file, add the right version, and then: | ||
|
|
||
| ```sh | ||
| pnpm setup | ||
| pnpm services:clean # causes rebuilding of the Docker image | ||
| pnpm test:ci | ||
| ``` | ||
|
|
||
| ## Updating Forc version | ||
| If all tests pass, that's it. | ||
arboleya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The following script will upgrade Forc to the latest version on GitHub, remove all lockfiles so the latest stdlib can be used, and rebuild all projects: | ||
| Otherwise, you have work to do. | ||
|
|
||
| ```sh | ||
| pnpm forc:update | ||
| ``` | ||
|
|
||
| After this you should run tests and fix any incompatibilities. | ||
|
|
||
| ## FAQ | ||
| # FAQ | ||
|
|
||
| ### Why is the prefix `fuels` and not `fuel`? | ||
|
|
||
| In order to make the SDK for Fuel feel familiar with those coming from the [ethers.js](https://github.com/ethers-io/ethers.js) ecosystem, this project opted for an `s` at the end. The `fuels-*` family of SDKs is inspired by The Ethers Project. | ||
| In order to make the SDK for Fuel feel familiar with those coming from the [ethers.js](https://github.com/ethers-io/ethers.js) ecosystem, this project opted for an `s` at the end. | ||
|
|
||
| The `fuels-*` family of SDKs is inspired by The Ethers Project. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.