diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b6dec38 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish Package + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file diff --git a/README.md b/README.md index 87b0cea..d407b06 100644 --- a/README.md +++ b/README.md @@ -36,22 +36,17 @@ npm run test:e2e ## Publishing -1. Bump the version in `package.json`: +First, update the version in package.json. -```json -"version": "0.0.XX" -``` - -2. Build the package: +Then, commit the version change and create and push a new tag: ```bash -npm run build +git add package.json +git commit -m "Release vX.Y.Z" +git tag vX.Y.Z # where X.Y.Z matches the version in package.json +git push origin main --tags ``` -3. Publish the package: - -```bash -npm publish -``` +This will trigger the GitHub Actions workflow to automatically build and publish the package to `npm`. -4. Go to the [jsdelivr repo](https://github.com/tinfoilanalytics/jsdelivr) and follow the README there to update the hosted version at js.tinfoil.sh. \ No newline at end of file +Finally, go to the [jsdelivr repo](https://github.com/tinfoilanalytics/jsdelivr) and follow the README there to update the hosted version at js.tinfoil.sh. \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fc2f205..27ac167 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,16 @@ { "name": "tinfoil", - "version": "0.1.0", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tinfoil", - "version": "0.1.0", + "version": "0.1.2", "license": "MIT", "dependencies": { - "@divviup/common": "^0.2.2", - "@divviup/dap": "^0.9.0", - "@divviup/prio3": "^0.8.0", - "@divviup/vdaf": "^0.8.0", - "ua-parser-js": "^1.0.39" + "@divviup/dap": "^0.9.1", + "ua-parser-js": "^2.0.0" }, "devDependencies": { "@eslint/js": "^9.13.0", @@ -120,13 +117,15 @@ } }, "node_modules/@divviup/dap": { - "version": "0.9.0", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@divviup/dap/-/dap-0.9.1.tgz", + "integrity": "sha512-XdNtsk6813SVN1smVY9WTzrscZyNzxiVDXR/wh6O7DvXeGXTxxKgeoA3ibX4KcKqs4qdN9f+8pAanRyF2rxmQg==", "license": "MPL-2.0", "dependencies": { "@divviup/common": "^0.2.2", "@divviup/prio3": "^0.8.0", "@divviup/vdaf": "^0.8.0", - "hpke-js": "^1.2.7" + "hpke-js": "^1.6.1" } }, "node_modules/@divviup/field": { @@ -301,7 +300,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.1", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -312,52 +313,62 @@ } }, "node_modules/@hpke/chacha20poly1305": { - "version": "1.5.0", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@hpke/chacha20poly1305/-/chacha20poly1305-1.6.1.tgz", + "integrity": "sha512-VpuZs9EGZDpvcgLsXsSlpDbrc8MVJCXsEPI/BmvweVtGAjFBimPh4rV7X1Pl2Ch/Ay+cQw929UAt5ennq2RAEA==", "license": "MIT", "dependencies": { - "@hpke/common": "^1.4.3", - "@noble/ciphers": "^0.5.3" + "@hpke/common": "^1.6.1", + "@noble/ciphers": "^1.0.0" }, "engines": { "node": ">=16.0.0" } }, "node_modules/@hpke/common": { - "version": "1.5.0", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@hpke/common/-/common-1.7.1.tgz", + "integrity": "sha512-/PBcoBsgr/bWBwJfAF1vKFBRa8tFu1g7mSuCDgpjBlRABXvLbWSF07Rb4rI5PlO8Ng16pjgvI7fgHzaLyZ9lmw==", "license": "MIT", "engines": { "node": ">=16.0.0" } }, "node_modules/@hpke/core": { - "version": "1.5.0", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@hpke/core/-/core-1.7.1.tgz", + "integrity": "sha512-1cup0EARfFY7ZIIcPXBBs+LmEi7s4xghcQWVjtVUgdVzp5ZDrNpfn6iH7UbV26ZvTcinMU+NFaCfUk0G1rvfjA==", "license": "MIT", "dependencies": { - "@hpke/common": "^1.4.3" + "@hpke/common": "^1.7.1" }, "engines": { "node": ">=16.0.0" } }, "node_modules/@hpke/dhkem-x25519": { - "version": "1.5.0", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@hpke/dhkem-x25519/-/dhkem-x25519-1.6.1.tgz", + "integrity": "sha512-SUZWdplu9tNgVXkjN6+sRbZWVGAM22p1pM5a91ApWzW6G5QLpan5NH5I/Cy7AwiBYDYrzTepuIseaewawt4YWw==", "license": "MIT", "dependencies": { - "@hpke/common": "^1.4.3", - "@noble/curves": "^1.4.2", - "@noble/hashes": "^1.4.0" + "@hpke/common": "^1.6.1", + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0" }, "engines": { "node": ">=16.0.0" } }, "node_modules/@hpke/dhkem-x448": { - "version": "1.5.0", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@hpke/dhkem-x448/-/dhkem-x448-1.6.1.tgz", + "integrity": "sha512-HYOAK8Ff/hlCdTQee8Khgd0A1GFSInGAZsjHImckeb8oDJg6JejDTOARaXULolXsZwPeS/N0UZOH2au4qtfMMg==", "license": "MIT", "dependencies": { - "@hpke/common": "^1.4.3", - "@noble/curves": "^1.4.2", - "@noble/hashes": "^1.4.0" + "@hpke/common": "^1.6.1", + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0" }, "engines": { "node": ">=16.0.0" @@ -548,17 +559,24 @@ } }, "node_modules/@noble/ciphers": { - "version": "0.5.3", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.1.0.tgz", + "integrity": "sha512-gwcX7IKSuCtlepJVa6sDLMB2EDaoLguFL6HxagKeFIzWGRfFE3mwcHs8mjx4yQY+rV736XGBhfl6Lw80YrTDTw==", "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@noble/curves": { - "version": "1.6.0", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz", + "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", "license": "MIT", "dependencies": { - "@noble/hashes": "1.5.0" + "@noble/hashes": "1.6.0" }, "engines": { "node": "^14.21.3 || >=16" @@ -568,7 +586,9 @@ } }, "node_modules/@noble/hashes": { - "version": "1.5.0", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz", + "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -1353,7 +1373,9 @@ "license": "MIT" }, "node_modules/cross-spawn": { - "version": "7.0.3", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -1453,6 +1475,26 @@ "node": ">=0.4.0" } }, + "node_modules/detect-europe-js": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/detect-europe-js/-/detect-europe-js-0.1.2.tgz", + "integrity": "sha512-lgdERlL3u0aUdHocoouzT10d9I89VVhk0qNRmll7mXdGfJT1/wqZ2ZLA4oJAjeACPY5fT1wsbq2AT+GkuInsow==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ], + "license": "MIT" + }, "node_modules/diff": { "version": "4.0.2", "dev": true, @@ -1991,15 +2033,17 @@ } }, "node_modules/hpke-js": { - "version": "1.5.0", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/hpke-js/-/hpke-js-1.6.1.tgz", + "integrity": "sha512-lIYfHM7jxUBamBHFxuy7iZbDMgDhIqW/T9DTg1dNnIZbwheZ9p3MWe+5IZXj2p2Jmqcixkh9IdAhjv/H4CMY2A==", "license": "MIT", "dependencies": { - "@hpke/chacha20poly1305": "^1.4.3", - "@hpke/common": "^1.4.3", - "@hpke/core": "^1.4.3", - "@hpke/dhkem-x25519": "^1.4.3", - "@hpke/dhkem-x448": "^1.4.3", - "@noble/hashes": "^1.4.0" + "@hpke/chacha20poly1305": "^1.6.0", + "@hpke/common": "^1.6.1", + "@hpke/core": "^1.6.0", + "@hpke/dhkem-x25519": "^1.6.0", + "@hpke/dhkem-x448": "^1.6.0", + "@noble/hashes": "^1.5.0" }, "engines": { "node": ">=16.0.0" @@ -2164,6 +2208,26 @@ "optional": true, "peer": true }, + "node_modules/is-standalone-pwa": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.1.tgz", + "integrity": "sha512-9Cbovsa52vNQCjdXOzeQq5CnCbAcRk05aU62K20WO372NrTv0NxibLFCK6lQ4/iZEFdEA3p3t2VNOn8AJ53F5g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ], + "license": "MIT" + }, "node_modules/isexe": { "version": "2.0.0", "dev": true, @@ -3219,8 +3283,30 @@ } } }, + "node_modules/ua-is-frozen": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.2.tgz", + "integrity": "sha512-RwKDW2p3iyWn4UbaxpP2+VxwqXh0jpvdxsYpZ5j/MLLiQOfbsV5shpgQiw93+KMYQPcteeMQ289MaAFzs3G9pw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ], + "license": "MIT" + }, "node_modules/ua-parser-js": { - "version": "1.0.39", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-2.0.0.tgz", + "integrity": "sha512-SASgD4RlB7+SCMmlVNqrhPw0f/2pGawWBzJ2+LwGTD0GgNnrKGzPJDiraGHJDwW9Zm5DH2lTmUpqDpbZjJY4+Q==", "funding": [ { "type": "opencollective", @@ -3235,7 +3321,12 @@ "url": "https://github.com/sponsors/faisalman" } ], - "license": "MIT", + "license": "AGPL-3.0-or-later", + "dependencies": { + "detect-europe-js": "^0.1.2", + "is-standalone-pwa": "^0.1.1", + "ua-is-frozen": "^0.1.2" + }, "bin": { "ua-parser-js": "script/cli.js" }, diff --git a/package.json b/package.json index d545f5b..c16bbb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "tinfoil", - "version": "0.1.1", + "version": "0.1.3", + "description": "Web analytics client for Tinfoil", "main": "dist/index.js", "types": "dist/index.d.ts", "browser": "dist/browser.js", @@ -13,17 +14,14 @@ "clean": "rimraf dist", "test": "vitest", "test:cover": "vitest run --coverage", - "test:e2e": "playwright test", - "test:e2e:ui": "playwright test --ui", + "test:e2e": "playwright test --project=chromium", + "test:e2e:ui": "playwright test --ui --project=chromium", "lint": "eslint ./src ./tests", "serve": "python3 -m http.server 8223" }, "dependencies": { - "@divviup/common": "^0.2.2", - "@divviup/dap": "^0.9.0", - "@divviup/prio3": "^0.8.0", - "@divviup/vdaf": "^0.8.0", - "ua-parser-js": "^1.0.39" + "@divviup/dap": "^0.9.1", + "ua-parser-js": "^2.0.0" }, "devDependencies": { "@eslint/js": "^9.13.0", @@ -44,5 +42,9 @@ }, "directories": { "test": "tests" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/tinfoilanalytics/tinfoil-ts.git" } } diff --git a/tsconfig.json b/tsconfig.json index 5307fab..192d1a8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,16 @@ { - "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { "rootDir": "src", "outDir": "dist", "resolveJsonModule": true, "sourceMap": true, - "target": "ES2022", + "target": "esnext", "lib": [ "dom", - "es2020" + "esnext" ], "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "strict": true, "preserveConstEnums": true, "esModuleInterop": true,