Skip to content

Allow inputs.src.hook to expand variables #92

Description

@divillysausages

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions