website icon indicating copy to clipboard operation
website copied to clipboard

Allow inputs.src.hook to expand variables

Open divillysausages opened this issue 3 years ago • 0 comments

I have multiple scripts in my package.json, such as:

"build-prod": "webpack --env stage='prod'",
"build-staging": "webpack --env stage='staging'"

In serverless.yml, I can use variables such as ${stage} for pretty much everything (e.g. domain, bucketName, etc), EXCEPT for the hook

So this works:

inputs:
  src:
    src: ./src
    hook: npm run build-prod # hook to run before building
    dist: ./.build # output folder
  domain: ${stage}.mydomain.com # domain name
  region: ${env:REGION}
  bucketName: ${stage}.mydomain.com

but this doesn't

inputs:
  src:
    src: ./src
    hook: npm run build-${stage} # hook to run before building
    dist: ./.build # output folder
  domain: ${stage}.mydomain.com # domain name
  region: ${env:REGION}
  bucketName: ${stage}.mydomain.com

It would be great if that was possible

divillysausages avatar Feb 04 '22 16:02 divillysausages