1build icon indicating copy to clipboard operation
1build copied to clipboard

`before` and `after` life cycle hooks per each command

Open akhilbojedla opened this issue 4 years ago • 2 comments

Description

Currently, we have before and after life cycle hooks that get executed before and after all the specified commands are executed. However, In some scenarios, it might be the case that we also need more granular life cycle hooks within the scope of a single command.

project: Sample Web App
before: export VARNAME="my value"
after: unset VARNAME
commands:
   - build: 
        before: echo "before"
        command: npm run build
        after: echo "after"

Acceptance Criteria

  • User should be able to define before and after for each individual command
  • Should be able to disable global before and after for an individual command

akhilbojedla avatar May 17 '20 14:05 akhilbojedla

@akhilbojedla Good feature to have.

Current before after runs as before all and after all is you run multiple commands at a time.

Having per command would definitely help.

It will change the contract for the file. Need to think if we can accommodate it with existing structure.

gopinath-langote avatar May 20 '20 15:05 gopinath-langote

@gopinath-langote I think it should be possible. If we can update our config yml parsing logic. We can make it to either accept a string (which would then be executed as command) or nested properties with lifecycle definitions.

akhilbojedla avatar May 20 '20 15:05 akhilbojedla