Skip to content

Commit

Permalink
chore!: remove built-in binaries for forc and fuel-core (#2143)
Browse files Browse the repository at this point in the history
* Removed documentation reference to the built-in binaries

* Update versions on documentation

* Changeset

* Removed unused configs

* Removed `forc` and `core` from CLI + configuration

* Removed trustedDependencies

* Moved forc and fuel-core to internal

* Removed forc and fuel-core from fuels

* Changed to @internal/forc and @internal/fuel-core namespaces

* Removed unneed import

* Lint

* Fixed filepaths for fuel-core and forc

* Fix VERSION_EXPERIMENTAL

* Added packages to knip ignore

* Update .changeset/friendly-deers-glow.md

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>

* Implemented `forcPath` and `fuelCorePath`

* Fixed forc version path

* Removed binaries from docs

* Lint

* Finalising passing though forcPath and fuelCorePath

* Re-added binary source log

* Readd tests for init config

* Adding functionality to pass thought a custom fuelCorePath to launchNode

* Added fuelCorePath to autoStartFuelCore

* Tests around loadConfig

* Changeset update

* Lint

* Removed unneeded forc path conditional

* Removed `useSystemFuelCore` from `autoStartFuelCore`

* Added doc block param for launchNode

* Removed

* Removed @fuel-ts/versions from changeset

* Update .changeset/friendly-deers-glow.md

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>

* Added rewrite functionality for fuels.config

* Removed binaries doc

* Lint

* Log out the binary paths for debugging purposes only

* Fix changeset version

* Reshuffle test case

* Added functionality to pass through a custom fuel core or forc path to system versions

* Throw error when binary path not found

* Lint

* Added @fuels-ts/versions to changeset

* Added forcPath and fuelCorePath for required tests

* Added forcPath and fuelCorePath for deploy and dev tests

* Extracted find binary logics to cli-utils

* Removed unneeded additions to getSystemVersions

* Linting

* Removed unneeded dependency

* Added versions to the utils package

* Added node group to test file

* pls release

* Fixing issue with path not being found correctly

* Lint

* Suppress stdio for getSystemVersion

* Making error message more explicit

* Only display the error message when config throws

* Lint

* Fixing tests

* Added binary paths to the versions command

* Added version error for incompatible versions

* Lint

* Missing test group

* Updated docs to reflect changes better

* Suppressing the version logs (stderr) from outputting

* Removed region

* Incorrect binary

* Removed release tag

* Merge branch 'master' into ps/docs/undocument-binaries

* Fixing test

* Auto-populate latest binary versions to docs

* Added default install path for forc and fuel-core to examples

* Rewrite Prerequisites

* Lint

* Anchor doesn't exist

* Nitty McNittyson: Whitespace

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>

* Nitty McNittyson: Whitespace

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>

* Nitty McNittyson: Whitespace

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>

* Updated logs with binary path

* Fixing ci:test

* Refactored to warn the user over throwing

* Verbose warning message

* Removed old parameter

* Removed `useSystemFuelCore` from `launchNode`

* Fix url in config

* Lint

* Removed redundant `findBinPath` method

* Lint

* chore: changeset update

---------

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>
Co-authored-by: Chad Nehemiah <chad.nehemiah94@gmail.com>
Co-authored-by: Dhaiwat <dhaiwatpandya@gmail.com>
  • Loading branch information
4 people committed May 21, 2024
1 parent f76aa57 commit 67afa32
Show file tree
Hide file tree
Showing 100 changed files with 769 additions and 629 deletions.
9 changes: 9 additions & 0 deletions .changeset/friendly-deers-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@fuel-ts/account": patch
"create-fuels": patch
"fuels": minor
"@fuel-ts/utils": minor
"@fuel-ts/versions": patch
---

chore!: remove built-in binaries for `forc` and `fuel-core`
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
run: |
pnpm changeset version
echo "RELEASE_VERSION=v$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' packages/fuels/package.json)" >> $GITHUB_ENV
echo "FUEL_CORE_VERSION=$(cat ./packages/fuel-core/VERSION)" >> $GITHUB_ENV
echo "FORC_VERSION=$(cat ./packages/forc/VERSION)" >> $GITHUB_ENV
echo "FUEL_CORE_VERSION=$(cat ./internal/fuel-core/VERSION)" >> $GITHUB_ENV
echo "FORC_VERSION=$(cat ./internal/forc/VERSION)" >> $GITHUB_ENV
git reset --hard
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
],
"ignoreDependencies": [
"@fuel-ts/*",
"@internal/fuel-core",
"@internal/forc",
"@types/jest",
"@types/rimraf",
"@graphql-codegen*",
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ After this you should run tests and fix any incompatibilities.

# Updating Fuel Core version

Manually edit the `packages/fuel-core/VERSION` file, add the right version, and then:
Manually edit the `internal/fuel-core/VERSION` file, add the right version, and then:

```sh
pnpm install # will download new binaries
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ Commands:
deploy [options] Deploy contracts to the Fuel network
typegen [options] Generate Typescript from Sway ABI JSON files
versions Check for version incompatibilities
core Wrapper around Fuel Core binary
forc Wrapper around Forc binary
help [command] Display help for command
```

Expand Down
6 changes: 1 addition & 5 deletions apps/create-fuels-counter-guide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,5 @@
"postcss": "^8",
"tailwindcss": "^3.3.0",
"typescript": "^5"
},
"trustedDependencies": [
"@fuel-ts/fuel-core",
"@fuel-ts/forc"
]
}
}
10 changes: 0 additions & 10 deletions apps/demo-fuels/fuels.config.explicit-built-in.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/demo-fuels/fuels.config.explicit-system.ts

This file was deleted.

18 changes: 9 additions & 9 deletions apps/demo-fuels/fuels.config.full.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { createConfig } from 'fuels';
import type { CommandEvent, ContractDeployOptions, FuelsConfig } from 'fuels/src/cli/types';
import type { CommandEvent, ContractDeployOptions, FuelsConfig } from 'fuels';

const MY_FIRST_DEPLOYED_CONTRACT_NAME = '';

Expand Down Expand Up @@ -96,15 +96,15 @@ export default createConfig({
},
// #endregion onFailure

// #region useBuiltInForc
// Default: undefined
useBuiltinForc: false,
// #endregion useBuiltInForc
// #region forcPath
// Default: 'forc',
forcPath: '~/.fuelup/bin/forc',
// #endregion forcPath

// #region useBuiltInFuelCore
// Default: undefined
useBuiltinFuelCore: false,
// #endregion useBuiltInFuelCore
// #region fuelCorePath
// Default: 'fuel-core'
fuelCorePath: '~/.fuelup/bin/fuel-core',
// #endregion fuelCorePath
});

export const simpleDeployConfig = createConfig({
Expand Down
13 changes: 13 additions & 0 deletions apps/demo-fuels/fuels.config.minimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// #region config
import { createConfig } from 'fuels';

export default createConfig({
workspace: './sway-programs', // forc workspace
output: './src/sway-programs-api',
});
// #endregion config

/**
* Check the docs:
* https://docs.fuel.network/docs/fuels-ts/fuels-cli/config-file/
*/
6 changes: 3 additions & 3 deletions apps/demo-fuels/fuels.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// #region config
import { createConfig } from 'fuels';

export default createConfig({
workspace: './sway-programs', // forc workspace
output: './src/sway-programs-api',
forcPath: 'fuels-forc',
fuelCorePath: 'fuels-core',
});
// #endregion config

/**
* Check the docs:
* https://fuellabs.github.io/fuels-ts/guide/fuels/config-file
* https://docs.fuel.network/docs/fuels-ts/fuels-cli/config-file/
*/
2 changes: 1 addition & 1 deletion apps/demo-typegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"devDependencies": {
"@fuel-ts/account": "workspace:*",
"@fuel-ts/errors": "workspace:*",
"@fuel-ts/forc": "workspace:*"
"@internal/forc": "workspace:*"
},
"version": null
}
2 changes: 2 additions & 0 deletions apps/docs-snippets/fuels.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export default createConfig({
workspace: './test/fixtures/forc-projects',
output: './test/typegen',
forcBuildFlags: ['--release'],
forcPath: 'fuels-forc',
fuelCorePath: 'fuels-core',
});
4 changes: 0 additions & 4 deletions apps/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ export default defineConfig({
text: 'Commands',
link: '/guide/fuels-cli/commands',
},
{
text: 'Binaries',
link: '/guide/fuels-cli/binaries',
},
{
text: 'ABI Typegen',
link: '/guide/fuels-cli/abi-typegen',
Expand Down
61 changes: 0 additions & 61 deletions apps/docs/src/guide/fuels-cli/binaries.md

This file was deleted.

43 changes: 13 additions & 30 deletions apps/docs/src/guide/fuels-cli/commands.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup>
import { data } from '../../versions.data'
const { fuels } = data
const { fuels, forc, fuelCore } = data
</script>

# Commands

The `fuels` CLI consists of a couple commands.
The `fuels` CLI consists of a couple of commands.

## `fuels init`

Expand Down Expand Up @@ -36,7 +36,7 @@ npx fuels@{{fuels}} init --workspace ./sway-programs --output ./src/sway-program

This will give you a minimal configuration:

<<< @../../../demo-fuels/fuels.config.ts#config{ts:line-numbers}
<<< @../../../demo-fuels/fuels.config.minimal.ts#config{ts:line-numbers}

In a nutshell:

Expand Down Expand Up @@ -127,7 +127,7 @@ The `fuels dev` command does three things:

1. Auto-start a short-lived `fuel-core` node ([docs](./config-file.md#autostartfuelcore))
1. Runs `build` and `deploy` once at the start
1. Watches your Forc workspace and repeats previous step on every change
1. Watches your Forc workspace and repeats the previous step on every change

> _In `dev` mode, every time you update a contract on your Forc `workspace`, we re-generate type definitions and factory classes for it, following your pre-configured [`output`](./config-file.md#output) directory. If it's part of another build system running in dev mode (i.e. `next dev`), you can expect it to re-build / auto-reload as well._
Expand Down Expand Up @@ -161,31 +161,14 @@ Check for version incompatibilities between your [Fuel Toolchain](https://docs.f
npx fuels@{{fuels}} versions
```

```
```console-vue
┌───────────┬───────────┬────────────────┬─────────────┐
│ │ Supported │ Yours / System │ System Path │
├───────────┼───────────┼────────────────┼─────────────┤
│ Forc │ {{forc}} │ {{forc}} │ forc │
├───────────┼───────────┼────────────────┼─────────────┤
│ Fuel-Core │ {{fuelCore}} │ {{fuelCore}} │ fuel-core │
└───────────┴───────────┴────────────────┴─────────────┘
You have all the right versions! ⚡
┌───────────┬───────────┬─────────────────┐
│ │ Supported │ Yours / System │
├───────────┼───────────┼─────────────────┤
│ Forc │ 0.30.0 │ 0.30.0 │
├───────────┼───────────┼─────────────────┤
│ Fuel-Core │ 0.14.0 │ 0.14.0 │
└───────────┴───────────┴─────────────────┘
```

## `fuels forc`

Simple [wrapper](./binaries.md) around the `forc` binary.

Check also:

- [Built-in Binaries](./binaries.md)
- [`forc` documentation](https://docs.fuel.network/docs/forc/commands/)

## `fuels core`

Simple [wrapper](./binaries.md) around the `fuel-core` binary.

Check also:

- [Built-in Binaries](./binaries.md)
- [`fuel-core` documentation](https://docs.fuel.network/guides/running-a-node/running-a-local-node/)
28 changes: 8 additions & 20 deletions apps/docs/src/guide/fuels-cli/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,33 +143,21 @@ Parameters:

<<< @../../../demo-fuels/fuels.config.full.ts#onFailure{ts:line-numbers}

## `useBuiltinForc`
## `forcPath`

Opt-in or out from using [built-in](./binaries.md) `forc` binaries.
Path to the `forc` binary.

When not supplied, will default to using the `system` binaries.
When not supplied, will default to using the `system` binaries (`forc`).

If `system` binaries are absent, print a warning and use `built-in` ones instead.
<<< @../../../demo-fuels/fuels.config.full.ts#forcPath{ts:line-numbers}

<<< @../../../demo-fuels/fuels.config.full.ts#useBuiltInForc{ts:line-numbers}
## `fuelCorePath`

Check also:

- [Built-in Binaries](./binaries.md)

## `useBuiltinFuelCore`

Opt-in or out from using [built-in](./binaries.md) `fuel-core` binaries.
Path to the `fuel-core` binary.

When not supplied, will default to using the `system` binaries.

If `system` binaries are absent, print a warning and use `built-in` ones instead.

<<< @../../../demo-fuels/fuels.config.full.ts#useBuiltInFuelCore{ts:line-numbers}

Check also:
When not supplied, will default to using the `system` binaries (`fuel-core`).

- [Built-in Binaries](./binaries.md)
<<< @../../../demo-fuels/fuels.config.full.ts#fuelCorePath{ts:line-numbers}

## Loading environment variables

Expand Down
9 changes: 9 additions & 0 deletions apps/docs/src/guide/fuels-cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ my-fuel-dapp # NextJS app or similar
└── package.json
```

## Prerequisites

The [Fuel Toolchain](https://docs.fuel.network/docs/sway/introduction/fuel_toolchain/#the-fuel-toolchain) and its components (namely `forc` and `fuel-core`) are pre-requisite for several operations with the Fuels CLI. For example:

- Building out contracts using [`fuels build`](./commands.md#fuels-build) requires `forc`.
- Deploying contracts locally using [`fuels deploy`](./commands.md#fuels-deploy) requires `fuel-core`.

Follow the [installation guide](https://docs.fuel.network/guides/installation/) if you don't have them installed already.

## Installation

Add it to your `my-fuel-dapp` project:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Firstly, you will need a local node running on your machine. We recommend one of the following methods:

- [Testing utilities](../testing/index.md#wallet-test-utilities) can assist in programmatically launching a short-lived node.
- Running [fuel-core](https://docs.fuel.network/guides/running-a-node/running-a-local-node/) directly, or via the CLI [fuels](../fuels-cli/commands.md#fuels-core).
- Running [fuel-core](https://docs.fuel.network/guides/running-a-node/running-a-local-node/) locally.

In the following example, we create a provider to connect to the local node and sign a message.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/forc/README.md → internal/forc/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@fuel-ts/forc`
# `@internal/forc`

Binary wrapper for [Forc](https://github.com/FuelLabs/sway)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/forc/package.json → internal/forc/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@fuel-ts/forc",
"private": true,
"name": "@internal/forc",
"version": "0.88.1",
"description": "NPM bin wrapper around Fuel `forc`",
"author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# @fuel-ts/fuel-core
# @internal/fuel-core

## 0.86.0

## 0.88.1

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 67afa32

Please sign in to comment.