diff --git a/.changeset/cool-bugs-mix.md b/.changeset/cool-bugs-mix.md new file mode 100644 index 0000000000..b457caa383 --- /dev/null +++ b/.changeset/cool-bugs-mix.md @@ -0,0 +1,5 @@ +--- +"create-fuels": patch +--- + +feat: add `fuel-toolchain.toml` to `create fuels` template diff --git a/packages/create-fuels/test/cli.test.ts b/packages/create-fuels/test/cli.test.ts index ae358f8817..fcc721073c 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 0000000000..e670af0afb --- /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