We prefer using yarn 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
anddevelop
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
develop
branch functions as a candidate for the next release. Create your pull requests into this branch. The code indevelop
must always pass the tests.
-
After cloning the repository, run
yarn install
to install dependencies. -
Run
yarn 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:
yarn lint
You don't need to do this manually, CI runs the check automatically. To fix all auto-fixable issues at once, run:
yarn 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.
The workflow release.yml
is responsible for releasing a new version. It has to be run on develop
branch, and at the end it will create a release and a PR to main
branch.
CloudFront Integration by Fingerprint always uses the latest stable version for the customers and upgrades customer Lambda@Edge automatically by running CodePipeline once a new version of Lambda@Edge function is available on the public S3 bucket. The serverless application that contains the CodePipeline is responsible for delivering new updates from the S3 bucket to the customer's infrastructure.