Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lambda-nodejs): local bundling #9632

Merged
merged 19 commits into from
Aug 17, 2020
Merged

Conversation

jogold
Copy link
Contributor

@jogold jogold commented Aug 12, 2020

Bundle locally if Parcel v2 is installed.

Closes #9120
Closes #9639
Closes #9153


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

eladb
eladb previously requested changes Aug 16, 2020
```

To force bundling in a Docker container, set the `forceDockerBundling` prop to `true`. This is useful
when installing node modules with native dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence "This is useful when installing node modules with native dependencies" is a bit cryptic. Elaborate a bit or provide an example.


private static _runsLocally?: boolean;

constructor(private readonly props: LocalBundlerProps) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to pass all the options here? I recall tryBundle's second argument is options which should include all the needed context.

To verify we designed the protocol correctly, let's try to implement tryBundle through a simple "lambda-interface" instead of as a class:

local: {
  tryBundle: (outdir: string, options: ...) => {
    // foo bar
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will give it a shot but it seemed easier/cleaner to implement it with the bundler's option instead of parsing the Docker command. Might have implications to offer Windows support for local bundling also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. Yeah I wouldn't parse the docker command...

You are right.

Let's leave as is. I am good

@mergify mergify bot dismissed eladb’s stale review August 17, 2020 14:01

Pull request has been modified.

@eladb
Copy link
Contributor

eladb commented Aug 17, 2020

@jogold lmk when this is ready

@jogold jogold marked this pull request as ready for review August 17, 2020 16:01
@jogold
Copy link
Contributor Author

jogold commented Aug 17, 2020

@jogold lmk when this is ready

It is now

@mergify
Copy link
Contributor

mergify bot commented Aug 17, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 32a4e7a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Aug 17, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 276c322 into aws:master Aug 17, 2020
misterjoshua pushed a commit to misterjoshua/aws-cdk that referenced this pull request Aug 19, 2020
Bundle locally if Parcel v2 is installed.

Closes aws#9120
Closes aws#9639
Closes aws#9153 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
jogold added a commit to jogold/cdk-ecr-image-scan-handler that referenced this pull request Aug 20, 2020
Install Parcel as a dev dependency to switch to local bundling.

aws/aws-cdk#9632
jogold added a commit to jogold/aws-cdk that referenced this pull request Aug 20, 2020
Execute local bundling from the directory containing the entry file.

Without this change, in a monorepo with multiple `package.json` files
Parcel doesn't look for the right one.

Also fix a regression introduced in aws#9632 for the working directory in
the container.
mergify bot pushed a commit that referenced this pull request Aug 26, 2020
…9870)

Execute local bundling from the directory containing the entry file.

Without this change, in a monorepo with multiple `package.json` files
or when consuming a module exposing a construct, Parcel doesn't look for
the right `package.json`.

Also fix a regression introduced in #9632 for the working directory in
the container.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@jogold jogold deleted the lambda-nodejs-local branch September 4, 2020 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants