Skip to content

Commit 5159504

Browse files
committed
feat!: migrate package to vite-plus and require Node 24
Align the repository with the shared put.io package workflow by switching from tsdx and yarn to vite-plus, pnpm, and GitHub Actions. This also refreshes the docs, updates the test setup, and standardizes packaging and release automation. BREAKING CHANGE: development and verification now require Node 24.14.0 or newer within the 24.x line.
1 parent f07b181 commit 5159504

21 files changed

+3034
-6792
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
env:
10+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11+
12+
concurrency:
13+
group: ci-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
verify:
18+
if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]')
19+
name: Verify package
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
permissions:
23+
contents: read
24+
25+
steps:
26+
- name: Check out repository
27+
uses: actions/checkout@v6
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Set up Vite+
32+
uses: voidzero-dev/setup-vp@v1
33+
with:
34+
node-version-file: ".node-version"
35+
cache: true
36+
37+
- name: Install dependencies
38+
run: vp install
39+
40+
- name: Verify repository
41+
run: vp run verify
42+
43+
release:
44+
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip ci]')
45+
name: Release package
46+
needs:
47+
- verify
48+
runs-on: ubuntu-latest
49+
timeout-minutes: 20
50+
permissions:
51+
contents: write
52+
issues: write
53+
pull-requests: write
54+
55+
steps:
56+
- name: Check out repository
57+
uses: actions/checkout@v6
58+
with:
59+
fetch-depth: 0
60+
61+
- name: Set up Vite+
62+
uses: voidzero-dev/setup-vp@v1
63+
with:
64+
node-version-file: ".node-version"
65+
cache: true
66+
67+
- name: Install dependencies
68+
run: vp install
69+
70+
- name: Release package
71+
uses: cycjimmy/semantic-release-action@v4
72+
with:
73+
extra_plugins: |
74+
@semantic-release/commit-analyzer
75+
@semantic-release/release-notes-generator
76+
@semantic-release/npm
77+
@semantic-release/github
78+
@semantic-release/git
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1+
*.log
2+
.DS_Store
13
node_modules
24
dist
3-
*.log
45
coverage
5-
.DS_Store
6-
example

.node-version

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

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributing
2+
3+
Thanks for contributing to `@putdotio/pas-js`
4+
5+
## Setup
6+
7+
Install dependencies with Vite+:
8+
9+
```bash
10+
vp install
11+
```
12+
13+
## Validation
14+
15+
Run the repo guardrail before opening or updating a pull request:
16+
17+
```bash
18+
vp run verify
19+
```
20+
21+
That command runs formatting, linting, package build, unit tests, and coverage using the same entrypoint CI relies on.
22+
23+
## Development Notes
24+
25+
- Prefer `vp` for day-to-day commands
26+
- Put end-user package usage in [README.md](./README.md)
27+
- Keep contributor workflow changes in this file and security reporting guidance in [SECURITY.md](./SECURITY.md)
28+
29+
## Pull Requests
30+
31+
- Keep changes focused
32+
- Add or update tests when behavior changes
33+
- Update docs when package usage, validation, or release behavior changes

README.md

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
11
<div align="center">
22
<p>
3-
<img src="https://static.put.io/images/putio-boncuk.png" width="72">
3+
<img src="https://static.put.io/images/putio-boncuk.png" width="72" alt="put.io boncuk">
44
</p>
55

66
<h1>pas-js</h1>
77

8+
<p>Browser analytics client for the put.io Analytics System.</p>
9+
810
<p>
9-
JavaScript SDK for <a href="https://github.com/putdotio/pas">put.io Analytics System.</a>
11+
<a href="https://github.com/putdotio/pas-js/actions/workflows/ci.yml?query=branch%3Amaster" style="text-decoration:none;"><img src="https://img.shields.io/github/actions/workflow/status/putdotio/pas-js/ci.yml?branch=master&style=flat&label=ci&colorA=000000&colorB=000000" alt="CI"></a>
12+
<a href="https://www.npmjs.com/package/@putdotio/pas-js" style="text-decoration:none;"><img src="https://img.shields.io/npm/v/%40putdotio%2Fpas-js?style=flat&colorA=000000&colorB=000000" alt="npm version"></a>
13+
<a href="https://github.com/putdotio/pas-js/blob/master/LICENSE" style="text-decoration:none;"><img src="https://img.shields.io/github/license/putdotio/pas-js?style=flat&colorA=000000&colorB=000000" alt="license"></a>
1014
</p>
11-
12-
<p><a href="https://travis-ci.org/putdotio/pas-js"><img src="https://travis-ci.org/putdotio/pas-js.svg?branch=master" alt="Build Status"></a>
13-
<a href="https://coveralls.io/github/putdotio/pas-js?branch=master"><img src="https://coveralls.io/repos/github/putdotio/pas-js/badge.svg?branch=master" alt="Coverage Status"></a>
14-
<img src="https://img.shields.io/npm/v/@putdotio/pas-js" alt="npm (scoped)">
15-
<img src="https://img.shields.io/bundlephobia/minzip/@putdotio/pas-js" alt="npm bundle size (scoped)">
16-
<img src="https://img.shields.io/github/license/putdotio/pas-js" alt="GitHub"></p>
1715
</div>
1816

1917
## Installation
2018

21-
```bash
22-
yarn add @putdotio/pas-js
19+
Install with npm:
2320

21+
```bash
2422
npm install @putdotio/pas-js
2523
```
2624

27-
### Module
25+
## Quick Start
2826

29-
```js
30-
import Pas from '@putdotio/pas-js'
27+
```ts
28+
import createPasClient from "@putdotio/pas-js";
29+
30+
const pas = createPasClient();
31+
32+
pas.identify({
33+
id: "42",
34+
hash: "signed-user-hash",
35+
properties: {
36+
plan: "pro",
37+
},
38+
});
39+
40+
pas.track("transfer_completed", {
41+
transfer_id: 123,
42+
});
3143
```
3244

33-
### CommonJS
45+
## Browser Tracking
46+
47+
The default client keeps an anonymous identifier in browser cookies and can send identity, event, and page-view payloads to PAS:
3448

35-
```js
36-
const Pas = require('@putdotio/pas-js').default
49+
```ts
50+
import createPasClient from "@putdotio/pas-js";
51+
52+
const pas = createPasClient();
53+
54+
pas.alias({ id: "42", hash: "signed-user-hash" });
55+
pas.pageView();
3756
```
3857

3958
## API
@@ -44,3 +63,16 @@ const Pas = require('@putdotio/pas-js').default
4463
| **identify** | `({ id: string/number, hash: string, properties?: object })` |
4564
| **track** | `(name: string, properties?: object)` |
4665
| **pageView** | - |
66+
67+
## Docs
68+
69+
- [CONTRIBUTING.md](./CONTRIBUTING.md)
70+
- [SECURITY.md](./SECURITY.md)
71+
72+
## Contributing
73+
74+
See [CONTRIBUTING.md](./CONTRIBUTING.md)
75+
76+
## License
77+
78+
[MIT](./LICENSE)

SECURITY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Security
2+
3+
If you believe you have found a security or privacy issue in this project, please report it privately.
4+
5+
## Contact
6+
7+
- email: ui@put.io
8+
9+
Please do not open a public issue for vulnerabilities or sensitive reports.
10+
11+
## Scope
12+
13+
Useful reports usually include issues involving:
14+
15+
- analytics event or identity spoofing
16+
- token, credential, or secret exposure
17+
- private or user data exposure
18+
- unsafe request handling in the browser client
19+
20+
## Disclosure
21+
22+
Please allow reasonable time to investigate and fix the issue before sharing details publicly.

package.json

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,52 @@
11
{
22
"name": "@putdotio/pas-js",
33
"version": "2.9.0",
4-
"description": "Client-side JS client for Putio Analytics System",
4+
"description": "Browser analytics client for the put.io Analytics System.",
55
"keywords": [
6-
"putio",
6+
"analytics",
7+
"pas",
78
"put.io",
8-
"Putio Analytics System"
9+
"putio"
910
],
10-
"main": "dist/index.js",
11-
"module": "dist/pas-js.esm.js",
12-
"typings": "dist/index.d.ts",
13-
"files": [
14-
"dist",
15-
"src"
16-
],
17-
"scripts": {
18-
"start": "tsdx watch",
19-
"build": "tsdx build",
20-
"test": "tsdx test",
21-
"lint": "tsdx lint",
22-
"prepare": "tsdx build",
23-
"coveralls": "tsdx test --coverage && cat ./coverage/lcov.info | coveralls"
24-
},
25-
"husky": {
26-
"hooks": {
27-
"pre-commit": "tsdx lint"
28-
}
11+
"homepage": "https://github.com/putdotio/pas-js",
12+
"bugs": {
13+
"url": "https://github.com/putdotio/pas-js/issues"
2914
},
30-
"author": "Put.io <devs@put.io>",
3115
"license": "MIT",
32-
"homepage": "https://github.com/putdotio/pas-js",
16+
"author": "put.io <ui@put.io>",
3317
"repository": {
3418
"type": "git",
3519
"url": "https://github.com/putdotio/pas-js.git"
3620
},
37-
"bugs": {
38-
"url": "https://github.com/putdotio/pas-js/issues"
21+
"files": [
22+
"dist"
23+
],
24+
"type": "module",
25+
"sideEffects": false,
26+
"main": "./dist/index.cjs",
27+
"module": "./dist/index.js",
28+
"types": "./dist/index.d.ts",
29+
"exports": {
30+
".": {
31+
"types": "./dist/index.d.ts",
32+
"import": "./dist/index.js",
33+
"require": "./dist/index.cjs",
34+
"default": "./dist/index.js"
35+
}
36+
},
37+
"publishConfig": {
38+
"access": "public"
39+
},
40+
"scripts": {
41+
"build": "vp pack",
42+
"check": "vp check .",
43+
"clean": "rm -rf coverage dist",
44+
"coverage": "vp test --coverage",
45+
"dev": "vp pack --watch",
46+
"prepack": "vp pack",
47+
"test": "vp test",
48+
"verify": "vp check . && vp pack && vp test && vp test --coverage"
3949
},
40-
"prettier": "@putdotio/prettier-config",
4150
"dependencies": {
4251
"js-cookie": "^2.2.1",
4352
"query-string": "^5.1.1",
@@ -47,17 +56,25 @@
4756
"devDependencies": {
4857
"@putdotio/prettier-config": "^1.0.0",
4958
"@types/js-cookie": "^2.2.4",
59+
"@types/node": "^24.0.0",
5060
"@types/query-string": "^5",
5161
"@types/uuid": "^8.3.0",
52-
"coveralls": "^3.1.0",
53-
"husky": "^4.2.5",
54-
"jest-mock-extended": "^1.0.10",
55-
"tsdx": "^0.13.2",
56-
"tslib": "^2.0.1",
57-
"typescript": "^4.0.2",
62+
"@vitest/coverage-v8": "4.1.0",
63+
"jsdom": "^26.1.0",
64+
"typescript": "^5.9.3",
65+
"vite-plus": "^0.1.12",
66+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.12",
5867
"xhr-mock": "^2.5.1"
5968
},
60-
"publishConfig": {
61-
"access": "public"
69+
"prettier": "@putdotio/prettier-config",
70+
"engines": {
71+
"node": ">=24.14.0 <25"
72+
},
73+
"packageManager": "pnpm@10.32.1",
74+
"pnpm": {
75+
"overrides": {
76+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.12",
77+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.12"
78+
}
6279
}
6380
}

0 commit comments

Comments
 (0)