Skip to content

Commit dabce4b

Browse files
Set up initial kit configuration (#3)
1 parent 409006f commit dabce4b

30 files changed

+14814
-0
lines changed

.eslintrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"node": true
6+
},
7+
"globals": {
8+
"mParticle": true,
9+
"describe": true,
10+
"Should": true,
11+
"MockHttpServer": true,
12+
"it": true,
13+
"sinon": true,
14+
"const": true,
15+
"before": true,
16+
"beforeEach": true,
17+
"after": true,
18+
"Leanplum": true
19+
},
20+
"extends": ["plugin:prettier/recommended", "eslint:recommended"],
21+
"plugins": ["prettier"],
22+
"rules": {
23+
"prettier/prettier": "error",
24+
"no-prototype-builtins": "off",
25+
"no-empty": "off",
26+
"no-useless-escape": "off",
27+
"no-unexpected-multiline": "off"
28+
}
29+
}

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Summary
2+
{provide a thorough description of the changes}
3+
4+
## Testing Plan
5+
{explain how this has been tested, and what additional testing should be done}

.github/workflows/release.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Release Kit
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dryRun:
7+
description: 'Do a dry run to preview instead of a real release [true/false]'
8+
required: true
9+
default: 'true'
10+
11+
jobs:
12+
# Kit release is done from main branch.
13+
confirm-public-repo-main-branch:
14+
name: 'Confirm release is run from public/main branch'
15+
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable
16+
17+
build-and-test:
18+
name: Build and Test
19+
runs-on: ubuntu-latest
20+
needs: confirm-public-repo-main-branch
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: NPM install
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20.x
29+
30+
- name: Run NPM CI
31+
run: npm ci
32+
33+
- name: Build Files
34+
run: npm run build
35+
36+
- name: Run Core tests
37+
run: npm run test
38+
39+
- name: Archive npm failure logs
40+
uses: actions/upload-artifact@v4
41+
if: failure()
42+
with:
43+
name: npm-logs
44+
path: ~/.npm/_logs
45+
46+
create-release-branch:
47+
name: Create release branch
48+
runs-on: ubuntu-latest
49+
needs:
50+
- build-and-test
51+
- confirm-public-repo-main-branch
52+
steps:
53+
- name: Checkout development branch
54+
uses: actions/checkout@v4
55+
with:
56+
repository: mparticle-integrations/mparticle-javascript-integration-rokt
57+
ref: development
58+
59+
- name: Create and push release branch
60+
run: |
61+
git checkout -b release/${{ github.run_number }}
62+
git push origin release/${{ github.run_number }}
63+
release:
64+
name: Perform Release
65+
runs-on: ubuntu-latest
66+
needs:
67+
- build-and-test
68+
- create-release-branch
69+
- confirm-public-repo-main-branch
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
72+
GIT_AUTHOR_NAME: mparticle-automation
73+
GIT_AUTHOR_EMAIL: developers@mparticle.com
74+
GIT_COMMITTER_NAME: mparticle-automation
75+
GIT_COMMITTER_EMAIL: developers@mparticle.com
76+
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
77+
78+
steps:
79+
- name: Checkout public main branch
80+
uses: actions/checkout@v4
81+
with:
82+
fetch-depth: 0
83+
ref: main
84+
85+
- name: Import GPG Key
86+
uses: crazy-max/ghaction-import-gpg@v4
87+
with:
88+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
89+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
90+
git_user_signingkey: true
91+
git_commit_gpgsign: true
92+
93+
- name: Merge release branch into main branch
94+
run: |
95+
git pull origin release/${{ github.run_number }}
96+
- name: Setup Node.js
97+
uses: actions/setup-node@v4
98+
with:
99+
node-version: 20.x
100+
101+
- name: Install dependencies
102+
run: npm ci
103+
104+
- name: Release --dry-run
105+
if: ${{ github.event.inputs.dryRun == 'true'}}
106+
run: |
107+
npx semantic-release --dry-run
108+
- name: Release
109+
if: ${{ github.event.inputs.dryRun == 'false'}}
110+
run: |
111+
npx semantic-release
112+
- name: Archive npm failure logs
113+
uses: actions/upload-artifact@v4
114+
if: failure()
115+
with:
116+
name: npm-logs
117+
path: ~/.npm/_logs
118+
119+
- name: Push automated release commits to release branch
120+
if: ${{ github.event.inputs.dryRun == 'false' }}
121+
run: |
122+
git push origin HEAD:release/${{ github.run_number }}
123+
sync-repository:
124+
name: Sync repositories
125+
needs: release
126+
runs-on: ubuntu-latest
127+
steps:
128+
- name: Checkout main branch
129+
uses: actions/checkout@v4
130+
with:
131+
fetch-depth: 0
132+
repository: ${{ github.repository }}
133+
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
134+
ref: main
135+
136+
- name: Merge release branch into main branch
137+
if: ${{ github.event.inputs.dryRun == 'false' }}
138+
run: |
139+
git pull origin release/${{ github.run_number }}
140+
- name: Push release commits to main and development branches
141+
if: ${{ github.event.inputs.dryRun == 'false' }}
142+
run: |
143+
git push origin HEAD:development
144+
git push origin HEAD:main
145+
- name: Delete release branch
146+
if: ${{ github.event.inputs.dryRun == 'false' }}
147+
run: |
148+
git push --delete origin release/${{ github.run_number }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Reusable Workflows
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
web-kit-pull-request:
8+
name: Run Web Kit PR Workflow
9+
uses: mParticle/mparticle-workflows/.github/workflows/web-kit-pull-request.yml@stable
10+
pr-branch-check-name:
11+
name: Check PR for semantic branch name
12+
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-check-name.yml@stable
13+
pr-title-check:
14+
name: Check PR for semantic title
15+
uses: mParticle/mparticle-workflows/.github/workflows/pr-title-check.yml@stable
16+
pr-branch-target-gitflow:
17+
name: Check PR for semantic target branch
18+
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-target-gitflow.yml@stable

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
test/test-bundle.js
3+
.DS_Store
4+
test/end-to-end-testapp/build/compilation.js
5+
dist/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.13.1

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"tabWidth": 4
5+
}

CHANGELOG.md

Whitespace-only changes.

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contributing
2+
3+
Thanks for contributing! Please read this document to follow our conventions for contributing to the mParticle SDK.
4+
5+
## Setting Up
6+
7+
- Fork the repository and then clone down your fork
8+
- Commit your code per the conventions below, and PR into the mParticle SDK `master` branch
9+
- Your PR title will be checked automatically against the below convention (view the commit history to see examples of a proper commit/PR title). If it fails, you must update your title.
10+
- Our engineers will work with you to get your code change implemented once a PR is up
11+
12+
## PR Title and Commit Convention
13+
14+
PR titles should follow [conventional commit standards](https://www.conventionalcommits.org/). This helps automate the release process.
15+
16+
The standard format for commit messages is as follows:
17+
18+
```
19+
<type>[optional scope]: <description>
20+
[optional body]
21+
[optional footer]
22+
```
23+
24+
The following lists the different `types` allowed in the commit message:
25+
26+
- feat: A new feature (automatic minor release)
27+
- fix: A bug fix (automatic patch release)
28+
- docs: Documentation only changes
29+
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
30+
- refactor: A code change that neither fixes a bug nor adds a feature
31+
- perf: A code change that improves performance
32+
- test: Adding missing or correcting existing tests
33+
- chore: Changes that don't modify src or test files, such as automatic documentation generation, or building latest assets
34+
- ci: Changes to CI configuration files/scripts
35+
- revert: Revert commit
36+
- build: Changes that affect the build system or other dependencies
37+
38+
In the footer, if there is a breaking change, start your footer with `BREAKING CHANGE:` followed by a description.
39+
40+
## Running Tests
41+
42+
```bash
43+
$ npm install
44+
$ npm run test // builds mparticle bundles and runs tests
45+
```
46+
47+
There are additional scripts that may improve your development experience:
48+
```bash
49+
$ npm run watch // watches src/ files and continuously rebuilds bundles as changes are made
50+
$ npm run watch:tests // watches test/ files and continuously rebuilds test bundles as changes are made
51+
$ npm run test:debug // opens a browser so you can step through mParticle and test code
52+
```

0 commit comments

Comments
 (0)