-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…2149) Co-authored-by: Chad Nehemiah <[email protected]> Co-authored-by: Peter Smith <[email protected]>
- Loading branch information
1 parent
586e1e2
commit 7c3ef04
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
"create-fuels": minor | ||
--- | ||
|
||
feat: optionally auto-install `fuelup` during `create fuels` routine |
This file contains 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 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,32 @@ | ||
import { execSync } from 'child_process'; | ||
import { log } from 'console'; | ||
import ora from 'ora'; | ||
|
||
export const checkIfFuelUpInstalled = () => { | ||
try { | ||
execSync('fuelup --version', { stdio: 'pipe' }); | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
}; | ||
|
||
export const installFuelUp = (isVerbose: boolean = false) => { | ||
const installFuelUpSpinner = ora({ | ||
text: 'Installing fuelup..', | ||
color: 'green', | ||
}); | ||
try { | ||
execSync(`curl https://install.fuel.network | sh`, { stdio: 'inherit' }); | ||
installFuelUpSpinner.succeed('Successfully installed fuelup!'); | ||
} catch (error) { | ||
if (isVerbose) { | ||
log(error); | ||
} | ||
log( | ||
installFuelUpSpinner.fail( | ||
'An error occurred while installing `fuelup`. Please try again, or try installing it manually. See https://docs.fuel.network/guides/installation/#running-fuelup-init for more information.' | ||
) | ||
); | ||
} | ||
}; |