diff --git a/.github/workflows/analyze-commits.yml b/.github/workflows/analyze-commits.yml
new file mode 100644
index 0000000..6c78cb9
--- /dev/null
+++ b/.github/workflows/analyze-commits.yml
@@ -0,0 +1,11 @@
+name: Analyze Commit Messages
+on:
+ pull_request:
+
+permissions:
+ pull-requests: write
+ contents: write
+jobs:
+ analyze-commits:
+ name: Generate docs and coverage report
+ uses: fingerprintjs/dx-team-toolkit/.github/workflows/analyze-commits.yml@v1
diff --git a/.github/workflows/coverage-diff.yml b/.github/workflows/coverage-diff.yml
new file mode 100644
index 0000000..02c9521
--- /dev/null
+++ b/.github/workflows/coverage-diff.yml
@@ -0,0 +1,12 @@
+name: Check coverage for PR
+
+on:
+ pull_request:
+
+jobs:
+ run-tests-check-coverage:
+ name: Run tests & check coverage
+ permissions:
+ checks: write
+ pull-requests: write
+ uses: fingerprintjs/dx-team-toolkit/.github/workflows/coverage-diff.yml@v1
diff --git a/.github/workflows/docs-and-coverage.yml b/.github/workflows/docs-and-coverage.yml
new file mode 100644
index 0000000..19f8bd3
--- /dev/null
+++ b/.github/workflows/docs-and-coverage.yml
@@ -0,0 +1,15 @@
+name: Generate docs and coverage report
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ generate-docs-and-coverage:
+ name: Generate docs and coverage report
+ uses: fingerprintjs/dx-team-toolkit/.github/workflows/docs-and-coverage.yml@v1
+ with:
+ prepare-gh-pages-commands: |
+ mv docs/* ./gh-pages
+ mv coverage/lcov-report ./gh-pages/coverage
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
deleted file mode 100644
index 80362f3..0000000
--- a/.github/workflows/docs.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: Generate docs
-
-on:
- push:
- branches:
- - main
-
-jobs:
- generate-docs:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout the repository
- uses: actions/checkout@v2
-
- - name: Install dependencies
- run: yarn install
-
- - name: Create the docs
- run: yarn run docs
-
- - name: Deploy 🚀
- uses: JamesIves/github-pages-deploy-action@8817a56e5bfec6e2b08345c81f4d422db53a2cdc
- with:
- branch: gh-pages
- folder: docs
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 82bdd15..b0b7b14 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,5 +1,4 @@
-name: Release
-
+name: release
on:
push:
branches:
@@ -7,24 +6,9 @@ on:
- test
jobs:
- release:
- environment: production
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- persist-credentials: false
-
- - name: Install dependencies
- run: yarn install
-
- - name: Build library
- run: yarn run package
-
- - name: Release
- run: yarn release
- env:
- GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
- NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- HUSKY: 0
+ build-and-release:
+ name: 'Build project, run CI checks and publish new release'
+ uses: fingerprintjs/dx-team-toolkit/.github/workflows/release-typescript-project.yml@v1
+ secrets:
+ GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
+ NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9528e89..9af5ac4 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,32 +1,12 @@
-# Reference on this file: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Lint, build and test
on:
- pull_request:
+ push:
+ branches-ignore:
+ - main
+ paths-ignore:
+ - '**.md'
+
jobs:
- build:
- name: Lint, build and test
- runs-on: ubuntu-latest
- timeout-minutes: 3
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Cache
- uses: actions/cache@v2
- with:
- path: |
- **/node_modules
- !**/dist/node_modules
- key: nodemodules-${{ hashFiles('**/yarn.lock') }}
- restore-keys: nodemodules-
- - name: Install Node packages
- run: yarn install
- - name: Build
- run: yarn build-all
- env:
- VITE_API_KEY: ${{ secrets.API_KEY }}
- - name: Lint
- run: yarn lint && yarn check
- - name: Tests
- run: yarn test
- - name: Typecheck
- run: yarn test:dts
+ build-and-check:
+ name: Build project and run CI checks
+ uses: fingerprintjs/dx-team-toolkit/.github/workflows/build-typescript-project.yml@v1
diff --git a/README.md b/README.md
index f674106..df2f5a5 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,9 @@
+
+
+
@@ -125,7 +128,7 @@ Fingerprint Pro usage is billed per API call. To reduce API calls, it is a good
## Documentation
-See the [generated SDK API reference here](https://fingerprintjs.github.io/fingerprintjs-pro-react/).
+See the [generated SDK API reference here](https://fingerprintjs.github.io/fingerprintjs-pro-svelte/).
This library uses Fingerprint Pro JavaScript agent under the hood. See our documentation for the full [JavaScript Agent API reference](https://dev.fingerprint.com/docs/js-agent).
@@ -136,6 +139,6 @@ The `getData` function throws errors directly from the JS Agent without changing
## License
-This project is licensed under the MIT license. See the [LICENSE](https://github.com/fingerprintjs/fingerprintjs-pro-react/blob/main/LICENSE) file for more info.
+This project is licensed under the MIT license. See the [LICENSE](https://github.com/fingerprintjs/fingerprintjs-pro-svelte/blob/main/LICENSE) file for more info.
diff --git a/jest.config.js b/jest.config.js
index 009f044..f891a3a 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -13,4 +13,6 @@ export default {
},
moduleFileExtensions: ['svelte', 'js', 'ts'],
setupFilesAfterEnv: ['/__tests__/setup.ts'],
+ collectCoverageFrom: ['./src/**/**.{ts,tsx}'],
+ coverageReporters: ['lcov', 'json-summary', ['text', { file: 'coverage.txt', path: './' }]],
};
diff --git a/package.json b/package.json
index 5030bbf..d326a79 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
],
"scripts": {
"prepare": "husky install && yarn sync-pkg-version && yarn --cwd examples/svelte-kit-ts && yarn --cwd examples/svelte-kit && yarn --cwd examples/spa",
+ "build": "yarn package",
"package": "svelte-kit package",
"package:watch": "svelte-kit package --watch",
"check": "svelte-check --tsconfig tsconfig.json",
@@ -38,6 +39,7 @@
"lint:fix": "yarn format && yarn lint -- --fix .",
"format": "prettier --write .",
"test": "jest",
+ "test:coverage": "jest --coverage",
"test:dts": "tsc --noEmit --isolatedModules dist/index.d.ts",
"sync-pkg-version": "node scripts/syncVersion.js && yarn format",
"build-all": "yarn package && yarn --cwd examples/svelte-kit build && yarn --cwd examples/spa build && yarn --cwd examples/svelte-kit-ts",
diff --git a/tsconfig.json b/tsconfig.json
index 5c56cee..5b03c9a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,8 @@
{
- "extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
+ "importsNotUsedAsValues": "error",
+ "isolatedModules": true,
+ "preserveValueImports": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
@@ -8,6 +10,17 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
- "strict": true
- }
+ "strict": true,
+ "moduleResolution": "node",
+ "module": "esnext",
+ "target": "esnext"
+ },
+ "include": [
+ "src/**/*.js",
+ "src/**/*.ts",
+ "src/**/*.svelte"
+ ],
+ "exclude": [
+ "node_modules/**",
+ ]
}