Skip to content

Commit 690b161

Browse files
committed
initial commit; based off of skylab-js-client 819b011
0 parents  commit 690b161

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+54385
-0
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.eslintrc.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
module.exports = {
4+
root: true,
5+
env: {
6+
browser: true,
7+
es6: true,
8+
jest: true,
9+
node: true,
10+
},
11+
parser: '@typescript-eslint/parser',
12+
plugins: ['@typescript-eslint', 'jest', 'import', 'prettier'],
13+
extends: [
14+
'eslint:recommended',
15+
'plugin:@typescript-eslint/recommended',
16+
'prettier',
17+
'prettier/@typescript-eslint',
18+
],
19+
rules: {
20+
'no-console': ['error', { allow: ['warn', 'error', 'debug'] }],
21+
22+
// eslint-plugin-import
23+
'import/order': [
24+
'error',
25+
{ 'newlines-between': 'always', alphabetize: { order: 'asc' } },
26+
],
27+
28+
// eslint-plugin-prettier
29+
'prettier/prettier': 'error',
30+
},
31+
};

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!--
2+
Thanks for contributing to the Amplitude Experiment Javascript Client SDK! 🎉
3+
4+
Please fill out the following sections to help us quickly review your pull request.
5+
-->
6+
7+
### Summary
8+
9+
<!-- What does the PR do? -->
10+
11+
### Checklist
12+
13+
* [ ] Does your PR title have the correct [title format](https://github.com/amplitude/skylab-js-client/blob/main/CONTRIBUTING.md#pr-commit-title-conventions)?
14+
* Does your PR have a breaking change?: <!-- Yes or no -->

.github/workflows/lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-18.04
8+
steps:
9+
- name: Check out Git repository
10+
uses: actions/checkout@v2
11+
12+
- name: Cache Node Modules
13+
uses: actions/cache@v2
14+
with:
15+
path: '**/node_modules'
16+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
17+
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Install
24+
run: yarn install --frozen-lockfile
25+
26+
- name: Lint
27+
run: yarn lint

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dryRun:
7+
description: 'Do a dry run to preview instead of a real release'
8+
required: true
9+
default: 'true'
10+
11+
jobs:
12+
authorize:
13+
name: Authorize
14+
runs-on: ubuntu-18.04
15+
steps:
16+
- name: ${{ github.actor }} permission check to do a release
17+
uses: octokit/[email protected]
18+
with:
19+
route: GET /repos/:repository/collaborators/${{ github.actor }}
20+
repository: ${{ github.repository }}
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
release:
25+
name: Release
26+
runs-on: ubuntu-18.04
27+
needs: [authorize]
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
32+
# Needed for lerna version to determine last tag
33+
- name: Fetch
34+
run: git fetch --prune --unshallow --tags
35+
36+
- name: Cache Node Modules
37+
uses: actions/cache@v2
38+
with:
39+
path: '**/node_modules'
40+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
41+
42+
- name: Setup Node
43+
uses: actions/setup-node@v2
44+
with:
45+
node-version: '10'
46+
47+
- name: Install
48+
run: yarn install --frozen-lockfile
49+
50+
- name: Build
51+
run: npx lerna exec yarn
52+
53+
- name: Test
54+
run: yarn test
55+
56+
- name: Configure Git User
57+
run: |
58+
git config --global user.name amplitude-sdk-bot
59+
git config --global user.email [email protected]
60+
61+
- name: Release (Dry Run)
62+
if: ${{ github.event.inputs.dryRun == 'true'}}
63+
env:
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
run: |
66+
yarn lerna version -m "chore(release): publish %s" \
67+
--conventional-commits \
68+
--no-push \
69+
--no-git-tag-version \
70+
--loglevel silly \
71+
--yes
72+
73+
- name: Setup NPM Token
74+
if: ${{ github.event.inputs.dryRun == 'false'}}
75+
env:
76+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
77+
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
78+
79+
- name: Release
80+
if: ${{ github.event.inputs.dryRun == 'false'}}
81+
env:
82+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
run: |
84+
yarn lerna version -m "chore(release): publish %s" \
85+
--conventional-commits \
86+
--create-release github \
87+
--loglevel silly \
88+
--yes
89+
yarn lerna publish from-git --yes --loglevel silly

.github/workflows/semantic-pr.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Semantic PR Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, edited]
6+
7+
jobs:
8+
pr-title-check:
9+
runs-on: ubuntu-18.04
10+
steps:
11+
- name: PR title is valid
12+
if: >
13+
startsWith(github.event.pull_request.title, 'feat:') || startsWith(github.event.pull_request.title, 'feat(') ||
14+
startsWith(github.event.pull_request.title, 'fix:') || startsWith(github.event.pull_request.title, 'fix(') ||
15+
startsWith(github.event.pull_request.title, 'perf:') || startsWith(github.event.pull_request.title, 'perf(') ||
16+
startsWith(github.event.pull_request.title, 'docs:') || startsWith(github.event.pull_request.title, 'docs(') ||
17+
startsWith(github.event.pull_request.title, 'test:') || startsWith(github.event.pull_request.title, 'test(') ||
18+
startsWith(github.event.pull_request.title, 'refactor:') || startsWith(github.event.pull_request.title, 'refactor(') ||
19+
startsWith(github.event.pull_request.title, 'style:') || startsWith(github.event.pull_request.title, 'style(') ||
20+
startsWith(github.event.pull_request.title, 'build:') || startsWith(github.event.pull_request.title, 'build(') ||
21+
startsWith(github.event.pull_request.title, 'ci:') || startsWith(github.event.pull_request.title, 'ci(') ||
22+
startsWith(github.event.pull_request.title, 'chore:') || startsWith(github.event.pull_request.title, 'chore(') ||
23+
startsWith(github.event.pull_request.title, 'revert:') || startsWith(github.event.pull_request.title, 'revert(')
24+
run: |
25+
echo 'Title checks passed'
26+
27+
- name: PR title is invalid
28+
if: >
29+
!startsWith(github.event.pull_request.title, 'feat:') && !startsWith(github.event.pull_request.title, 'feat(') &&
30+
!startsWith(github.event.pull_request.title, 'fix:') && !startsWith(github.event.pull_request.title, 'fix(') &&
31+
!startsWith(github.event.pull_request.title, 'perf:') && !startsWith(github.event.pull_request.title, 'perf(') &&
32+
!startsWith(github.event.pull_request.title, 'docs:') && !startsWith(github.event.pull_request.title, 'docs(') &&
33+
!startsWith(github.event.pull_request.title, 'test:') && !startsWith(github.event.pull_request.title, 'test(') &&
34+
!startsWith(github.event.pull_request.title, 'refactor:') && !startsWith(github.event.pull_request.title, 'refactor(') &&
35+
!startsWith(github.event.pull_request.title, 'style:') && !startsWith(github.event.pull_request.title, 'style(') &&
36+
!startsWith(github.event.pull_request.title, 'build:') && !startsWith(github.event.pull_request.title, 'build(') &&
37+
!startsWith(github.event.pull_request.title, 'ci:') && !startsWith(github.event.pull_request.title, 'ci(') &&
38+
!startsWith(github.event.pull_request.title, 'chore:') && !startsWith(github.event.pull_request.title, 'chore(') &&
39+
!startsWith(github.event.pull_request.title, 'revert:') && !startsWith(github.event.pull_request.title, 'revert(')
40+
run: |
41+
echo 'Pull request title is not valid. Please check github.com/amplitude/Amplitude-JavaScript/blob/main/CONTRIBUTING.md#pr-commit-title-conventions'
42+
exit 1

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
node-version: ['10', '12', '14']
11+
os: [macos-10.14, ubuntu-18.04]
12+
runs-on: ${{ matrix.os }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Cache Node Modules
19+
uses: actions/cache@v2
20+
with:
21+
path: '**/node_modules'
22+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
29+
- name: Install
30+
run: yarn install --frozen-lockfile
31+
32+
- name: Build
33+
run: npx lerna exec yarn
34+
35+
- name: Test
36+
run: yarn test

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Modules
9+
node_modules/
10+
jspm_packages/
11+
12+
# Output folders
13+
build/
14+
dist/
15+
16+
# caches
17+
.cache
18+
19+
# MacOS
20+
.DS_Store

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.prettierrc.json

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

0 commit comments

Comments
 (0)