UNPKG

typed-serverless

Version:

Helps you write a consistent Serverless Framework configuration in TypeScript

13 lines (11 loc) 379 B
export function getServerlessStage(): string { const stage = process.argv.find( (value, index, args) => ['--stage', '-s'].includes(args[index - 1]) && value ); if (stage) return stage; if (process.env.STAGE) return process.env.STAGE; throw new Error('Stage not found'); } export function getServerlessEnv(): string { return getServerlessStage().split('-')[0]; }