1.4.2 • Published 1 year ago

@routineless/cdk v1.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

License: MIT NPM Version codecov Typescript Semantic Release Commitizen friendly

cdk

Set of utilities that can be used for nx cdk application development.

Table of Contents

Install

To install this package run:

npm i @routineless/cdk

Usage

There are some type definitions and utility function that can be used for cdk infrastructure code development.

You can use them to define basic stack props to destinguish envirements.

BaseStackProps type definition, you can extend it to add more props and use accross stacks:

import type { Environment, StackProps } from 'aws-cdk-lib'

export interface CdkEnvironment extends Environment {
  readonly envName: string
}

export interface BaseStackProps extends StackProps {
  readonly env: CdkEnvironment
}

Lambda infrastructure code example:

import { BaseStackProps, capitalize } from '@routineless/cdk'
import { Stack } from 'aws-cdk-lib'
import * as lambda from 'aws-cdk-lib/aws-lambda'
import type { Construct } from 'constructs'
import path from 'path'

export class LambdaStack extends Stack {
  constructor(scope: Construct, id: string, props: BaseStackProps) {
    super(scope, id, props)

    new lambda.Function(this, 'LambdaFunction', {
      functionName: `Lambda${capitalize(props.env.envName)}`,
      runtime: lambda.Runtime.NODEJS_18_X,
      code: lambda.Code.fromAsset(path.join(__dirname, '../runtime')),
      handler: 'main.handler',
    })
  }
}

Maintainers

@KozelAnatoliy

License

MIT © 2023 Anatoli Kozel

1.4.3-beta.2

1 year ago

1.4.3-beta.1

1 year ago

1.4.3-beta.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.1.0-beta.0

2 years ago

1.0.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1-beta.5

2 years ago

0.0.1-beta.4

2 years ago

0.0.1-beta.3

2 years ago

0.0.1-beta.2

2 years ago

0.0.1-beta.1

2 years ago

0.0.1-beta.0

2 years ago