Skip to content

Commit

Permalink
Merge pull request #41 from fingerprintjs/feature/INTER-205-shared-wo…
Browse files Browse the repository at this point in the history
…rkflows

ci: use shared workflows
  • Loading branch information
ilfa authored Aug 29, 2023
2 parents 840873f + 7a75ee0 commit 2580e79
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 82 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/analyze-commits.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .github/workflows/docs-and-coverage.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 0 additions & 25 deletions .github/workflows/docs.yml

This file was deleted.

30 changes: 7 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
name: Release

name: release
on:
push:
branches:
- main
- 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 }}
38 changes: 9 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<a href="https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro-svelte">
<img src="https://img.shields.io/npm/dm/@fingerprintjs/fingerprintjs-pro-svelte.svg" alt="Monthly downloads from NPM">
</a>
<a href="https://fingerprintjs.github.io/fingerprintjs-pro-svelte/coverage/">
<img src="https://fingerprintjs.github.io/fingerprintjs-pro-svelte/coverage/badges.svg" alt="coverage">
</a>
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/:license-mit-blue.svg" alt="MIT license">
</a>
Expand Down Expand Up @@ -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).

Expand All @@ -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.


2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export default {
},
moduleFileExtensions: ['svelte', 'js', 'ts'],
setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
collectCoverageFrom: ['./src/**/**.{ts,tsx}'],
coverageReporters: ['lcov', 'json-summary', ['text', { file: 'coverage.txt', path: './' }]],
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
19 changes: 16 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"preserveValueImports": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"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/**",
]
}

0 comments on commit 2580e79

Please sign in to comment.