serverless-components / website

:zap: Instantly deploy static website on serverless infrastructure with zero configuration using Serverless Components.
https://serverless.com
Apache License 2.0
155 stars 49 forks source link

Allow inputs.src.hook to expand variables #92

Open divillysausages opened 2 years ago

divillysausages commented 2 years ago

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