Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: separate onSuccess events for the Fuels CLI #2433

Merged
merged 16 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-seas-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fuels": patch
---

feat: emit the `build` and `deploy` events during `fuels dev`
21 changes: 19 additions & 2 deletions packages/fuels/src/cli/commands/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { watch } from 'chokidar';
import { globSync } from 'glob';

import { loadConfig } from '../../config/loadConfig';
import type { FuelsConfig } from '../../types';
import { Commands, type FuelsConfig } from '../../types';
import { error, log } from '../../utils/logger';
import { build } from '../build';
import { deploy } from '../deploy';
Expand All @@ -18,7 +18,24 @@ export const closeAllFileHandlers = (handlers: FSWatcher[]) => {

export const buildAndDeploy = async (config: FuelsConfig) => {
await build(config);
return deploy(config);
config.onSuccess?.(
{
type: Commands.build,
data: null,
},
config
);
arboleya marked this conversation as resolved.
Show resolved Hide resolved

const deployedContracts = await deploy(config);
config.onSuccess?.(
{
type: Commands.deploy,
data: deployedContracts,
},
config
);

return deployedContracts;
};

export const getConfigFilepathsToWatch = (config: FuelsConfig) => {
Expand Down
Loading