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

Conversation

Dhaiwat10
Copy link
Member

@Dhaiwat10 Dhaiwat10 commented May 31, 2024


Breaking change

  • createConfig now has individual hooks for all fuels CLI events types.
// Before
import { createConfig } from 'fuels';

createConfig({
  onSuccess: (event: CommandEvent, config: FuelsConfig) => {
    const { data, type } = event;
    console.log('fuels:onSuccess', { data, type });
  }
});

// After
import { createConfig, DeployedContract } from 'fuels';

createConfig({
  onBuild: (config: FuelsConfig) => {
    console.log('fuels:onBuild', { config });
  },
  onDeploy: (config: FuelsConfig, data: DeployedContract[]) => {
    console.log('fuels:onDeploy', { config, data });
  },
  onDev: (config: FuelsConfig) => {
    console.log('fuels:onDev', { config });
  },
  onNode: (config: FuelsConfig) => {
    console.log('fuels:onNode', { config });
  },
});
  • Altered the signature for onFailure hook in createConfig.
// Before
import { createConfig } from 'fuels';

createConfig({
  onFailure: (error: Error, config: FuelsConfig) => {
    console.log('fuels:onFailure', { error, config });
  },
});

// After
import { createConfig } from 'fuels';

createConfig({
  onFailure: (config: FuelsConfig, error: Error) => {
    console.log('fuels:onFailure', { config, error });
  },
});

@Dhaiwat10 Dhaiwat10 requested a review from arboleya June 12, 2024 02:23
@arboleya arboleya added this to the 0.x mainnet milestone Jun 12, 2024
@petertonysmith94 petertonysmith94 marked this pull request as draft June 21, 2024 07:15
@petertonysmith94 petertonysmith94 changed the title feat: emit the build and deploy events during fuels dev feat!: separate onSuccess events for the Fuels CLI Jun 24, 2024
@petertonysmith94 petertonysmith94 marked this pull request as ready for review June 25, 2024 09:51
@fuel-service-user
Copy link
Contributor

fuel-service-user commented Jun 25, 2024

✨ A PR has been created under the rc-2433 tag on fuels-wallet repo.
FuelLabs/fuels-wallet#1401

Copy link
Contributor

@petertonysmith94 petertonysmith94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering whether we should update the onFailure method to match the new listener format...

onFailure?: (event: Error, config: FuelsConfig) => void;

to

onFailure?: (config: FuelsConfig, event: Error) => void;

@arboleya What do you think?
Edit: I'm doing it

Copy link
Member

@arboleya arboleya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 🎯

Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
80.3%(+0.01%) 71.8%(+0%) 77.56%(+0%) 80.37%(+0.01%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/fuels/src/cli/commands/node/index.ts 88%
(+0.5%)
100%
(+0%)
100%
(+0%)
88.88%
(+0.42%)

@petertonysmith94 petertonysmith94 merged commit e159582 into master Jun 27, 2024
26 of 36 checks passed
@petertonysmith94 petertonysmith94 deleted the dp/fuels-dev-build-deploy-emit-event branch June 27, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fire the build and deploy events during fuels dev
6 participants