Skip to content

Commit

Permalink
fix: make startFuelCore package manager agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaiwat10 committed Dec 5, 2023
1 parent 17788fe commit 2ecf1a4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-carrots-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels": patch
---

fix: make `startFuelCore` package manager agnostic
1 change: 1 addition & 0 deletions packages/fuels/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"handlebars": "^4.7.7",
"joycon": "^3.1.1",
"lodash.camelcase": "^4.3.0",
"npm-which": "^3.0.1",
"portfinder": "^1.0.32",
"rimraf": "^3.0.2",
"toml": "^3.0.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/fuels/src/cli/commands/dev/startFuelCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { getPortPromise } from 'portfinder';
import treeKill from 'tree-kill';

import type { FuelsConfig } from '../../types';
import { findPackageRoot } from '../../utils/findPackageRoot';
import { getBinarySource } from '../../utils/getBinarySource';
import { error, log, loggingConfig } from '../../utils/logger';

import { defaultChainConfig, defaultConsensusKey } from './defaultChainConfig';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const npmWhich = require('npm-which')(__dirname);

export type FuelCoreNode = {
bindIp: string;
accessIp: string;
Expand Down Expand Up @@ -73,8 +75,8 @@ export const startFuelCore = async (config: FuelsConfig): Promise<FuelCoreNode>
].flat();

return new Promise((resolve, reject) => {
const pkgRootDir = findPackageRoot();
const builtInFuelsCorePath = join(pkgRootDir, 'node_modules', '.bin', 'fuels-core');
// This line finds the path to the built-in fuels-core binary
const builtInFuelsCorePath = npmWhich.sync('fuels-core');

const command = config.useBuiltinFuelCore ? builtInFuelsCorePath : 'fuel-core';
const core = spawn(command, flags, { stdio: 'pipe' });
Expand Down
21 changes: 21 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ecf1a4

Please sign in to comment.