Skip to content
Closed
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
62 changes: 62 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"env": {
"browser": true,
"node": true

},
"globals": {
"mParticle": true,
"describe": true,
"Should": true,
"MockHttpServer": true,
"it": true,
"sinon": true,
"const": true,
"before": true,
"beforeEach": true,
"after": true,
"Leanplum": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4,
{ "SwitchCase": 1}
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-unneeded-ternary": [
"error",
{ "defaultAssignment": false }
],
"comma-dangle": [
"error",
"never"
],
"curly": [
"error",
"multi-line"
],
"comma-spacing": [
"error",
{ before: false, after: true }
],
"quote-props": [
"error",
"as-needed",
{ keywords: false, unnecessary: true, numbers: false }
],
"no-multi-spaces": "error",
}
}
27 changes: 27 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Dependabot Auto Merge

on: [push, pull_request]

jobs:
build-and-test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Install dependencies, build, then test
run: |
npm install
npm run build
npm run test

automerge:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: fastify/github-action-merge-dependabot@v1
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
with:
github-token: ${{secrets.github_token}}
merge-method: 'squash'
32 changes: 32 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Web Kit Build & Test

on: pull_request

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: NPM install
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Run NPM CI
run: npm ci

- name: Build Files
run: npm run build

- name: Run Core tests
run: npm run test

- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
153 changes: 153 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Release Kit

on:
workflow_dispatch:
inputs:
dryRun:
description: 'Do a dry run to preview instead of a real release [true/false]'
required: true
default: 'true'

jobs:
# Kit release is done from master branch.
confirm-public-repo-master-branch:
name: 'Confirm release is run from public/master branch'
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable

build-and-test:
name: Build and Test
runs-on: ubuntu-latest
needs: confirm-public-repo-master-branch
steps:
- name: Checkout
uses: actions/checkout@v4

- name: NPM install
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Run NPM CI
run: npm ci

- name: Build Files
run: npm run build

- name: Run Core tests
run: npm run test

- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

create-release-branch:
name: Create release branch
runs-on: ubuntu-latest
needs:
- build-and-test
- confirm-public-repo-master-branch
steps:
- name: Checkout development branch
uses: actions/checkout@v4
with:
# TODO: Update this with the name of your repository
repository: mparticle-integrations/mparticle-javascript-integration-example
ref: development

- name: Create and push release branch
run: |
git checkout -b release/${{ github.run_number }}
git push origin release/${{ github.run_number }}

release:
name: Perform Release
runs-on: ubuntu-latest
needs:
- build-and-test
- create-release-branch
- confirm-public-repo-master-branch
env:
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

steps:
- name: Checkout public master branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Merge release branch into master branch
run: |
git pull origin release/${{ github.run_number }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: npm ci

- name: Release --dry-run
if: ${{ github.event.inputs.dryRun == 'true'}}
run: |
npx semantic-release --dry-run
- name: Release
if: ${{ github.event.inputs.dryRun == 'false'}}
run: |
npx semantic-release

- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

- name: Push automated release commits to release branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push origin HEAD:release/${{ github.run_number }}

sync-repository:
name: Sync repositories
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.repository }}
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
ref: master

- name: Merge release branch into master branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git pull origin release/${{ github.run_number }}

- name: Push release commits to master and development branches
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push origin HEAD:development
git push origin HEAD:master
- name: Delete release branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push --delete origin release/${{ github.run_number }}
20 changes: 20 additions & 0 deletions .github/workflows/reusable-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Reusable Workflows

on:
pull_request:

jobs:
pr-branch-check-name:
name: Check PR for semantic branch name
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-check-name.yml@stable
pr-title-check:
name: Check PR for semantic title
uses: mParticle/mparticle-workflows/.github/workflows/pr-title-check.yml@stable
pr-branch-target-gitflow:
name: Check PR for semantic target branch
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-target-gitflow.yml@stable
security-lint-checks:
name: Security Lint Checks
uses: mparticle/mparticle-workflows/.github/workflows/security-checks.yml@stable
with:
base_branch: 'development'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
test/test-bundle.js
test/end-to-end-testapp/compilation.js
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.13.1
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js
node_js:
- "7"
dist: trusty
sudo: required
addons:
chrome: stable
firefox: latest
cache:
directories:
- node_modules
script:
- npm install
- npm run testKarma -- --single-run=true --browsers=ChromeHeadless,FirefoxHeadless
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
# mparticle-javascript-integration-rokt
# mParticle JS Example Web Integration

A web integration (or a kit) is an extension to the core [mParticle Web SDK](https://github.com/mParticle/mparticle-web-sdk). A kit works as a bridge between the mParticle SDK and a partner SDK. It abstracts the implementation complexity, simplifying the implementation for developers.

A kit takes care of initializing and forwarding information depending on what you've configured in [mParticle's dashboard](https://app.mparticle.com).

## Create Your Own Integration

Detailed instructions on how to implement your own integration with the mParticle Web SDK can be found [here](https://docs.mparticle.com/developers/partners/kit-integrations/javascript-kit), but you can view a quick start guide below.

## Quick Start Guide

1. Fork this repo and `cd` into it locally on your computer.
2. Run `npm install` to install dependencies.
3. Run `KIT=YOURKITNAME npm run watch` to watch files in the `src/` folder, and automatically build your kit to `dist/YOURKITNAME-Kit.iife.js`. Your kit will continuously build as your save your edits.
4. Following examples such as [Optimizely](https://github.com/mparticle-integrations/mparticle-javascript-integration-optimizely), edit files in `src/`.
5. As you map mParticle's methods to your own in `src/`, stub your SDK methods and create tests in `test/tests.js`.
6. Submit a pull request to this repo. A developer from mParticle will review it and once complete, we will help provide you with a repo for your integration.

## Support

Questions? Give us a shout at <support@mparticle.com>

## License

This mParticle Web Kit is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). See the LICENSE file for more info.
Empty file added dist/.keep
Empty file.
Loading
Loading