Skip to content

Commit 5bb11a1

Browse files
authored
Merge pull request #1 from TelemetryDeck/initial-release
Initial release
2 parents 5608745 + 6dc5b73 commit 5bb11a1

18 files changed

+6011
-71
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+
module.exports = {
2+
env: {
3+
browser: true,
4+
},
5+
plugins: ['prettier', 'unicorn', 'jest'],
6+
extends: [
7+
'eslint:recommended',
8+
'plugin:prettier/recommended',
9+
'plugin:unicorn/recommended',
10+
'plugin:jest/recommended',
11+
],
12+
13+
overrides: [
14+
{
15+
files: ['.eslintrc.js', 'jest.config.js', 'jest.setup.js'],
16+
env: {
17+
browser: false,
18+
node: true,
19+
},
20+
rules: {
21+
'unicorn/prefer-module': 'off',
22+
},
23+
},
24+
{
25+
files: ['tests/**/*'],
26+
env: {
27+
jest: true,
28+
},
29+
},
30+
],
31+
};

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'v*'
8+
pull_request: {}
9+
10+
env:
11+
PNPM_VERSION: 6.19.0
12+
13+
jobs:
14+
lint:
15+
name: Linting
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: pnpm/action-setup@v2.0.1
20+
with:
21+
version: ${{ env.PNPM_VERSION }}
22+
- uses: actions/setup-node@v2
23+
with:
24+
node-version: 16.x
25+
cache: pnpm
26+
- run: pnpm install
27+
- run: pnpm run lint
28+
29+
test:
30+
name: Testing
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: pnpm/action-setup@v2.0.1
35+
with:
36+
version: ${{ env.PNPM_VERSION }}
37+
- uses: actions/setup-node@v2
38+
with:
39+
node-version: 16.x
40+
cache: pnpm
41+
- run: pnpm install
42+
- run: pnpm run test

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v2
16+
with:
17+
node-version: 14.x
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- run: npm publish
21+
env:
22+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.gitignore
2+
.pnpm-lock.yaml
3+
.prettierignore
4+
.prettierrc.js
5+
.release-it.js
6+
node_modules
7+
RELEASE.md
8+
rollup.config.js

.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# compiled output
2+
/dist/
3+
4+
# dependencies
5+
/node_modules/
6+
7+
# misc
8+
/coverage/
9+
!.*
10+
.eslintcache

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
module.exports = {
4+
singleQuote: true,
5+
printWidth: 100,
6+
};

.release-it.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
plugins: {
3+
'release-it-lerna-changelog': {
4+
infile: 'CHANGELOG.md',
5+
},
6+
},
7+
git: {
8+
commitMessage: 'v${version}',
9+
tagName: 'v${version}',
10+
},
11+
github: {
12+
release: true,
13+
releaseName: 'v${version}',
14+
tokenRef: 'GITHUB_AUTH',
15+
},
16+
npm: {
17+
publish: false,
18+
},
19+
};

README.md

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,93 @@
1-
# JavaScriptSDK
2-
JavaScript Package to send TelemetryDeck signals
1+
# Telemetry Deck JavaScript SDK
2+
3+
This package allows you to send signals to [TelemetryDeck](https://telemetrydeck.com) from your JavaScript code.
4+
5+
It has no package dependencies and supports modern evergreen browsers which support [cryptography](https://caniuse.com/cryptography).
6+
7+
Signals sent with this version of the SDK automatically send the following payload items:
8+
9+
- url
10+
- useragent
11+
- locale
12+
- platform
13+
14+
You can filter and show these values in the TelemetryDeck dashboard.
15+
16+
Test Mode is currently not supported.
17+
18+
## Usage
19+
20+
### 📄 Usage via Script Tag
21+
22+
For regular websites and to try out the code quickly, you can use [UNPKG](https://unpkg.com), a free CDN which allows you to load files from any npm package.
23+
24+
Include the following snippet in your page header:
25+
26+
```html
27+
<script src="https://unpkg.com/@telemtrydeck/sdk/dist/telemetrydeck.min.js">
28+
```
29+
30+
then include a script tag at the bottom of your page like this to send a signal once every time the page loads:
31+
32+
```html
33+
<script>
34+
signal(
35+
// required options to identify your app and the user
36+
{
37+
appID: 'YOUR_APP_ID',
38+
userIdentifier: 'ANONYMOUS',
39+
},
40+
// optional: custom payload stored with the signal
41+
{
42+
route: 'some/page/path',
43+
}
44+
);
45+
</script>
46+
```
47+
48+
Please replace `YOUR_APP_ID` with the app ID you received from TelemetryDeck, and set a user identifier if possible.
49+
50+
### 📦 Usage for applications that use a bundler (like Webpack, Rollup, …)
51+
52+
After installing the package via NPM, use it like this:
53+
54+
```js
55+
import { signal } from 'telemetry-deck';
56+
57+
//
58+
signal(
59+
// required options to identify your app and the user
60+
{
61+
appID: 'YOUR_APP_ID',
62+
userIdentifier: 'ANONYMOUS',
63+
},
64+
// custom payload stored with the signal
65+
{
66+
route: 'some/page/path',
67+
}
68+
);
69+
```
70+
71+
Please replace `YOUR_APP_ID` with the app ID you received from TelemetryDeck. If you have any string that identifies your user, such as an email address, pass it into `userIdentifier` – it will be cryptographically anonymized with a hash function.
72+
73+
If you want to pass optional parameters to the signal being sent, add them to the optional paylaod object.
74+
75+
## More Info
76+
77+
### 📱 You need an App ID
78+
79+
Every application and website registered to TelemetryDeck has its own unique ID that we use to assign incoming signals to the correct app. To get started, create a new app in the TelemetryDeck UI and copy its ID.
80+
81+
### 👤 Optional: User Identifiers
82+
83+
TelemetryDeck can count users if you assign it a unique identifier for each user that doesn't change. This identifier can be any string that is unique to the user, such as their email address, or a randomly generated UUID.
84+
85+
Feel free to use personally identifiable information as the user identifier: We use a cryptographically secure double-hasing process on client and server to make sure the data that arrives at our servers is anonymized and can not be traced back to individual users via their identifiers. A user's identifier is hashed inside the library, and then salted+hashed again on arrival at the server. This way the data is anonymized as defined by the GDPR and you don't have to ask for user consent for procesing or storing this data.
86+
87+
### 🚛 Optional: Payload
88+
89+
You can optionally attach an object with string values to the signal. This will allow you to filter and aggregate signal by these values in the dashboard.
90+
91+
### 📚 Full Docs
92+
93+
Go to [docs.telemetrydeck.com](https://docs.telemetrydeck.com) to see all documentation articles

RELEASE.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Release
2+
3+
Releases are mostly automated using
4+
[release-it](https://github.com/release-it/release-it/) and
5+
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
6+
7+
## Preparation
8+
9+
Since the majority of the actual release process is automated, the primary
10+
remaining task prior to releasing is confirming that all pull requests that
11+
have been merged since the last release have been labeled with the appropriate
12+
`lerna-changelog` labels and the titles have been updated to ensure they
13+
represent something that would make sense to our users. Some great information
14+
on why this is important can be found at
15+
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
16+
guiding principle here is that changelogs are for humans, not machines.
17+
18+
When reviewing merged PR's the labels to be used are:
19+
20+
- breaking - Used when the PR is considered a breaking change.
21+
- enhancement - Used when the PR adds a new feature or enhancement.
22+
- bug - Used when the PR fixes a bug included in a previous release.
23+
- documentation - Used when the PR adds or updates documentation.
24+
- internal - Used for internal changes that still require a mention in the
25+
changelog/release notes.
26+
27+
## Release
28+
29+
Once the prep work is completed, the actual release is straight forward:
30+
31+
- First, ensure that you have an environment variable with your GitHub token
32+
setup as `GITHUB_AUTH`. This token will be used for generating your changelog
33+
(unauthenticated requests to the GitHub API are heavily throttled) and for
34+
creating the GitHub release. Only "repo" access is needed; no "admin"
35+
or other scopes are required.
36+
37+
- Next, ensure that you have installed your projects dependencies:
38+
39+
```
40+
pnpm install
41+
```
42+
43+
- And last (but not least 😁) do your release:
44+
45+
```
46+
pnpm release
47+
```
48+
49+
[release-it](https://github.com/release-it/release-it/) manages the actual
50+
release process. It will prompt you to to choose the version number after which
51+
you will have the chance to hand tweak the changelog to be used (for the
52+
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
53+
pushing the tag and commits, etc. Finally GitHub Actions will build the commit
54+
and push the release to npm.
55+
56+
### Credits
57+
58+
Thie initial version of this document was copied from [ember-test-selectors](https://github.com/simplabs/ember-test-selectors/blob/master/RELEASE.md)

0 commit comments

Comments
 (0)