Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
feat: switch to ESM and esbuild (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Jan 7, 2022
1 parent 1fcf039 commit 193c4a9
Show file tree
Hide file tree
Showing 23 changed files with 767 additions and 1,089 deletions.
3 changes: 0 additions & 3 deletions .prettierrc.js

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/NordicSemiconductor/cloud-aws-package-layered-lambdas-js)](https://mergify.io)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

Packages lambdas with intra-project dependencies using Webpack and a base layer
with the dependencies defined in `package.json`.
Packages lambdas with intra-project dependencies using
[esbuild](https://github.com/evanw/esbuild) and a base layer with the
dependencies defined in `package.json`.

Checksums are created for dependencies per lambda so that rebuild only happens
when files are changed.
Expand Down
2 changes: 1 addition & 1 deletion cdk/LambdaSourceCodeStorageApp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { App } from '@aws-cdk/core'
import { LambdaSourceCodeStorageStack } from './LambdaSourceCodeStorageStack'
import { LambdaSourceCodeStorageStack } from './LambdaSourceCodeStorageStack.js'

/**
* In order to deploy lambda functions written in TypeScript we need to publish
Expand Down
4 changes: 2 additions & 2 deletions cdk/TestApp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App } from '@aws-cdk/core'
import { TestStack, TestStackLambdas } from './TestStack'
import { LayeredLambdas } from '../src'
import { LayeredLambdas } from '../src/index.js'
import { TestStack, TestStackLambdas } from './TestStack.js'

export class TestApp extends App {
public constructor(args: {
Expand Down
8 changes: 4 additions & 4 deletions cdk/TestStack.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as CloudFormation from '@aws-cdk/core'
import * as Lambda from '@aws-cdk/aws-lambda'
import * as IAM from '@aws-cdk/aws-iam'
import * as S3 from '@aws-cdk/aws-s3'
import * as Lambda from '@aws-cdk/aws-lambda'
import * as CloudWatchLogs from '@aws-cdk/aws-logs'
import { LayeredLambdas } from '../src'
import * as S3 from '@aws-cdk/aws-s3'
import * as CloudFormation from '@aws-cdk/core'
import { LayeredLambdas } from '../src/index.js'

export type TestStackLambdas = {
uuid: string
Expand Down
4 changes: 2 additions & 2 deletions cdk/cloudformation-sourcecode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LambdaSourceCodeStorageApp } from './LambdaSourceCodeStorageApp'
import { LambdaSourceCodeStorageStack } from './LambdaSourceCodeStorageStack'
import { LambdaSourceCodeStorageApp } from './LambdaSourceCodeStorageApp.js'
import { LambdaSourceCodeStorageStack } from './LambdaSourceCodeStorageStack.js'

const stackName = process.env.STACK_NAME

Expand Down
4 changes: 2 additions & 2 deletions cdk/cloudformation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestApp } from './TestApp'
import { prepareResources } from './prepareResources'
import { prepareResources } from './prepareResources.js'
import { TestApp } from './TestApp.js'

const stackName = process.env.STACK_NAME

Expand Down
2 changes: 1 addition & 1 deletion cdk/getLambdaSourceCodeBucketName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
CloudFormationClient,
DescribeStacksCommand,
} from '@aws-sdk/client-cloudformation'
import { LambdaSourceCodeStorageStack } from './LambdaSourceCodeStorageStack'
import { LambdaSourceCodeStorageStack } from './LambdaSourceCodeStorageStack.js'

const cf = new CloudFormationClient({})

Expand Down
13 changes: 8 additions & 5 deletions cdk/prepareResources.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import * as path from 'path'
import { promises as fs } from 'fs'
import { getLambdaSourceCodeBucketName } from './getLambdaSourceCodeBucketName'
import { TestStackLambdas } from './TestStack'
import { packBaseLayer, packLayeredLambdas, LayeredLambdas } from '../src'
import * as path from 'path'
import {
LayeredLambdas,
packBaseLayer,
packLayeredLambdas,
} from '../src/index.js'
import { getLambdaSourceCodeBucketName } from './getLambdaSourceCodeBucketName.js'
import { TestStackLambdas } from './TestStack.js'

export const prepareResources = async ({
stackName,
Expand Down Expand Up @@ -81,7 +85,6 @@ export const prepareResources = async ({
lambdas: {
uuid: path.resolve(rootDir, 'test', 'uuidLambda.ts'),
},
tsConfig: path.resolve(rootDir, 'tsconfig.json'),
})

return {
Expand Down
File renamed without changes.
Loading

0 comments on commit 193c4a9

Please sign in to comment.