We prefer using pnpm for installing dependencies and running scripts.
For proposing changes, use the standard pull request approach. It's recommended to discuss fixes or new functionality in the Issues, first.
- The
main
andrc
branches are locked for the push action. - Releases are created from the
main
branch. If you have CloudFront Integration set up, it is running code from themain
branch. Pull requests into themain
branch are not accepted. - The
rc
branch functions as a candidate for the next release. Create your pull requests into this branch. The code inrc
must always pass the tests.
-
After cloning the repository, run
pnpm install
to install dependencies. -
Run
pnpm build
to build the project into thedist
folder. The createddist/fingerprintjs-pro-cloudfront-lambda-function.js
file is meant to be deployed to Lambda@Edge.
- Install the AWS CLI and configure it according to the AWS CLI Guide.
- Create a Lambda function using the AWS Console. For the Lambda function for CloudFront distribution, you must create it in the
us-east-1
region. - Prepare a
.zip
archive that contains the built Lambda@Edge function (dist/fingerprintjs-pro-cloudfront-lambda-function.js
). - Run
aws lambda update-function-code --function-name <LAMBDA_FUNCTION_NAME> --region <AWS_REGION> --zip-file file://lambda.zip --publish
You can invoke the function from your local environment using the Invoke command in the AWS CLI, for example aws lambda invoke --function-name <LAMBDA_FUNCTION_NAME> --region <AWS_REGION> --invocation-type RequestResponse --payload <EVENT_JSON>
, where the <EVENT_JSON>
is the JSON you want to provide to your Lambda function as input. See examples of events here.
To deploy your function to your CloudFront distribution follow the Cloudfront Developer Guide.
Consistent code formatting is enforced by ESLint and Prettier. To check your code, run:
pnpm lint
You don't need to do this manually, CI runs the check automatically. To fix all auto-fixable issues at once, run:
pnpm lint:fix
You are required to follow conventional commits rules.
End-to-end tests are written in playwright and pulumi and located in the e2e
folder.
These tests are run automatically by the deploy_test_branch.yml
workflow on every PR automatically, you don't need to run them locally.
Every PR should target rc
branch first. Upon merge, if there are relevant changes a new release candidate is created.
When that happens, an automated PR is created to main
branch, and E2E tests run against it. If the tests pass, the PR can be merged and the release is created.
The integration is automatically released on every push to the main branch if there are relevant changes. The workflow must be approved by one of the maintainers, first.
CloudFront Integration by Fingerprint always uses the latest stable version for the customers and keeps it up-to-date by using the management Lambda function created during the installation.