serverless / components

The Serverless Framework's new infrastructure provisioning technology — Build, compose, & deploy serverless apps in seconds...
https://www.serverless.com
Apache License 2.0
2.31k stars 181 forks source link

How to run a different hook command for each stage? #1024

Open Lobosque opened 2 years ago

Lobosque commented 2 years ago

Description

I want to run different build commands for my static website, depending on the stage. The following does not work, because the ${stage} is empty, even when explicitly setting the stage via the --stage cli parameter:

org: lobosque
app: foo-frontend
name: vue-starter
component: website

inputs:
  domain: ${param:domain}
  src:
    src: ./src
    hook: npm run build-${stage}
    dist: ./dist

Result:

Deploying...

 Error: Failed running "src.hook": "npm run build-${stage}" due to the following error: Command failed: npm run build-${stage}
npm ERR! missing script: build-