From e53f69f2a3d634b545e4f940245bfd34aa23eddc Mon Sep 17 00:00:00 2001 From: Daniel Bate Date: Tue, 25 Jun 2024 17:11:32 +0100 Subject: [PATCH 1/2] feat: add fuel-toolchain to create fuels --- packages/create-fuels/test/cli.test.ts | 20 +++++++++++++++++++ .../nextjs/sway-programs/fuel-toolchain.toml | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 templates/nextjs/sway-programs/fuel-toolchain.toml diff --git a/packages/create-fuels/test/cli.test.ts b/packages/create-fuels/test/cli.test.ts index ae358f8817c..fcc721073c6 100644 --- a/packages/create-fuels/test/cli.test.ts +++ b/packages/create-fuels/test/cli.test.ts @@ -1,3 +1,5 @@ +import { versions } from '@fuel-ts/versions'; +import toml from '@iarna/toml'; import { mkdirSync, readFileSync } from 'fs'; import { join } from 'path'; @@ -52,6 +54,24 @@ describe('CLI', () => { expect(originalTemplateFiles.sort()).toEqual(testProjectFiles.sort()); }); + test('create-fuels checks the versions on the fuel-toolchain file', async () => { + const args = generateArgv(paths.root); + + await runScaffoldCli({ + program: setupProgram(), + args, + }); + + const fuelToolchainPath = join(paths.root, 'sway-programs', 'fuel-toolchain.toml'); + const fuelToolchain = readFileSync(fuelToolchainPath, 'utf-8'); + const parsedFuelToolchain = toml.parse(fuelToolchain); + + const { toolchain, components } = parsedFuelToolchain; + + expect(toolchain).toEqual({ channel: 'testnet' }); + expect(components).toEqual({ forc: versions.FORC, 'fuel-core': versions.FUEL_CORE }); + }); + test('should rewrite for the appropriate package manager', async () => { const args = generateArgv(paths.root, 'bun'); diff --git a/templates/nextjs/sway-programs/fuel-toolchain.toml b/templates/nextjs/sway-programs/fuel-toolchain.toml new file mode 100644 index 00000000000..e670af0afb7 --- /dev/null +++ b/templates/nextjs/sway-programs/fuel-toolchain.toml @@ -0,0 +1,6 @@ +[toolchain] +channel = "testnet" + +[components] +forc = "0.60.0" +fuel-core = "0.30.0" \ No newline at end of file From 08b631d973abf4beaff5937f3ad450946561858b Mon Sep 17 00:00:00 2001 From: Daniel Bate Date: Tue, 25 Jun 2024 17:12:18 +0100 Subject: [PATCH 2/2] chore: changeset --- .changeset/cool-bugs-mix.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cool-bugs-mix.md diff --git a/.changeset/cool-bugs-mix.md b/.changeset/cool-bugs-mix.md new file mode 100644 index 00000000000..b457caa3831 --- /dev/null +++ b/.changeset/cool-bugs-mix.md @@ -0,0 +1,5 @@ +--- +"create-fuels": patch +--- + +feat: add `fuel-toolchain.toml` to `create fuels` template