Skip to content

feat: convert package to ESM-only #143

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ name: Release
- next
- beta
- "*.x"

# These are recommended by the semantic-release docs: https://github.com/semantic-release/npm#npm-provenance
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance

jobs:
release:
name: release
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ npm install @probot/adapter-aws-lambda-serverless

```javascript
// handler.js
const {
import {
createLambdaFunction,
createProbot,
} = require("@probot/adapter-aws-lambda-serverless");
const appFn = require("./");
module.exports.lambdaFn = createLambdaFunction(appFn, {
} from "@probot/adapter-aws-lambda-serverless";
import appFn from "./app.js";
export const lambdaFn = createLambdaFunction(appFn, {
probot: createProbot(),
});
```
Expand All @@ -29,7 +29,7 @@ You need to add [environment variables to configure Probot](https://probot.githu
```yml
provider:
name: aws
runtime: nodejs12.x
runtime: nodejs22.x
lambdaHashingVersion: 20201221
environment:
APP_ID: ${param:APP_ID}
Expand Down
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const ProbotExports = require("probot");
const lambdaFunction = require("./lambda-function");
import lambdaFunction from "./lambda-function.js";

module.exports = { ...ProbotExports, createLambdaFunction };
export * from "probot";

/**
*
* @param {import('probot').ApplicationFunction} app
* @param { { probot: import('probot').Probot } } options
*/
function createLambdaFunction(app, { probot }) {
export function createLambdaFunction(app, { probot }) {
// load app once outside of the function to prevent double
// event handlers in case of container reuse
probot.load(app);
Expand Down
6 changes: 3 additions & 3 deletions lambda-function.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = lambdaFunction;
export default lambdaFunction;

const lowercaseKeys = require("lowercase-keys");
const { template } = require("./views/probot");
import lowercaseKeys from "lowercase-keys";
import { template } from "./views/probot.js";

async function lambdaFunction(probot, event, context) {
if (event.httpMethod === "GET" && event.path === "/probot") {
Expand Down
Loading