Skip to content

Commit

Permalink
feat: setup ci (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
auto200 authored Apr 10, 2024
1 parent 4f740fa commit ab9ada4
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 12 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish

on:
release:
types: [released]

jobs:
publish:
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install modules
run: npm ci

- name: Run tests
run: npm run test

- name: Build
run: npm run build

- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint and Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
run-tests:
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install modules
run: npm ci

- name: Check formatting
run: npm run format

- name: Lint
run: npm run lint

- name: Run tests
run: npm run test
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ PiwikPro.initialize('container-id', 'container-url');

### Setup with nonce

The nonce attribute is useful to allow-list specific elements, such as a particular inline script or style elements. It can help you to avoid using the CSP unsafe-inline directive, which would allow-l
ist all inline scripts or styles.
The nonce attribute is useful to allow-list specific elements, such as a particular inline script or style elements. It can help you to avoid using the CSP unsafe-inline directive, which would allow-list all inline scripts or styles.

If you want your nonce to be passed to the script, pass it as the third argument when calling the script initialization method.

Expand All @@ -42,6 +41,15 @@ import PiwikPro from '@piwikpro/tracking-base-library';
PiwikPro.initialize('container-id', 'container-url', 'nonce-string');
```

### Basic usage
```ts
import { PageViews, GoalConversions } from "@piwikpro/tracking-base-library"

PageViews.trackPageView();

GoalConversions.trackGoal(1, 100);
```


<a name="modulesmd"></a>

Expand Down
14 changes: 11 additions & 3 deletions docs/README_BASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ PiwikPro.initialize('container-id', 'container-url');

### Setup with nonce

The nonce attribute is useful to allow-list specific elements, such as a particular inline script or style elements. It can help you to avoid using the CSP unsafe-inline directive, which would allow-l
ist all inline scripts or styles.
The nonce attribute is useful to allow-list specific elements, such as a particular inline script or style elements. It can help you to avoid using the CSP unsafe-inline directive, which would allow-list all inline scripts or styles.

If you want your nonce to be passed to the script, pass it as the third argument when calling the script initialization method.

```ts
import PiwikPro from '@piwikpro/tracking-base-library';

PiwikPro.initialize('container-id', 'container-url', 'nonce-string');
```
```

### Basic usage
```ts
import { PageViews, GoalConversions } from "@piwikpro/tracking-base-library"

PageViews.trackPageView();

GoalConversions.trackGoal(1, 100);
```
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "@piwikpro/tracking-base-library",
"private": true,
"version": "1.0.0",
"description": "Piwik PRO basic tracking library for the frontend.",
"author": "Piwik Pro Integration Team <[email protected]>",
"license": "MIT",
"description": "Piwik PRO basic tracking library for the frontend.",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/PiwikPRO/tracking-base-library.git"
},
"type": "module",
"main": "dist/index.umd.cjs",
"module": "dist/index.js",
Expand All @@ -16,7 +19,7 @@
}
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"files": [
"dist"
Expand Down

0 comments on commit ab9ada4

Please sign in to comment.