Skip to content

Commit c2abe1d

Browse files
committed
feat(svelte-integration): set up svelte package workspace
- Create packages/svelte with TypeScript and Vite configuration - Configure workspace to use local @hawk.so/javascript sources - Add minimal package structure with build support
1 parent 001c8ab commit c2abe1d

File tree

7 files changed

+89
-0
lines changed

7 files changed

+89
-0
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@hawk.so/javascript",
33
"type": "commonjs",
44
"version": "3.2.11",
5+
"workspaces": [
6+
"packages/*"
7+
],
58
"description": "JavaScript errors tracking for Hawk.so",
69
"files": [
710
"dist"

packages/svelte/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Hawk JavaScript Catcher: Svelte Integration
2+
3+
Hawk Error Tracker integration for Svelte applications.
4+
5+
## Usage
6+
7+
Install package:
8+
9+
```shell
10+
npm install @hawk.so/javascript --save
11+
```
12+
13+
Svelte is supported out of the box. Initialize HawkCatcher in app's client hooks.
14+
15+
Create or update `src/hooks.client.ts`:
16+
17+
```ts
18+
import HawkCatcher from '@hawk.so/javascript';
19+
20+
new HawkCatcher({
21+
token: 'YOUR_INTEGRATION_TOKEN'
22+
});
23+
```

packages/svelte/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@hawk.so/svelte",
3+
"version": "1.0.0",
4+
"description": "Svelte/SvelteKit integration for Hawk Error Tracker",
5+
"main": "./dist/hawk-svelte.umd.js",
6+
"module": "./dist/hawk-svelte.mjs",
7+
"types": "dist/index.d.ts",
8+
"scripts": {
9+
"build": "vite build"
10+
},
11+
"dependencies": {
12+
"@hawk.so/javascript": "file:../.."
13+
}
14+
}

packages/svelte/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @hawk.so/javascript-svelte
3+
* Svelte/SvelteKit integration for Hawk.so JavaScript error tracker
4+
*/
5+
6+
// Just verification that main sources may be used in current workspace
7+
// TODO: should be replaced with actual code during further implementation
8+
export * from '@hawk.so/javascript';
9+
export { default } from '@hawk.so/javascript';

packages/svelte/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "src"
6+
},
7+
"include": [
8+
"src/**/*"
9+
]
10+
}

packages/svelte/vite.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import path from 'path';
2+
import dts from 'vite-plugin-dts';
3+
import { defineConfig } from 'vite';
4+
5+
export default defineConfig(() => {
6+
return {
7+
build: {
8+
lib: {
9+
entry: path.resolve(__dirname, 'src', 'index.ts'),
10+
name: 'HawkSvelte',
11+
fileName: 'hawk-svelte',
12+
},
13+
rollupOptions: {
14+
external: ['svelte', '@hawk.so/javascript'],
15+
},
16+
},
17+
plugins: [
18+
dts({
19+
tsconfigPath: './tsconfig.json',
20+
}),
21+
],
22+
};
23+
});

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@
316316
minimatch "^3.0.4"
317317
strip-json-comments "^3.1.1"
318318

319+
"@hawk.so/javascript@file:.":
320+
version "3.2.11"
321+
dependencies:
322+
"@hawk.so/types" "^0.1.36"
323+
error-stack-parser "^2.1.4"
324+
vite-plugin-dts "^4.2.4"
325+
319326
"@hawk.so/types@^0.1.36":
320327
version "0.1.36"
321328
resolved "https://registry.yarnpkg.com/@hawk.so/types/-/types-0.1.36.tgz#234b0e4c81bf5f50b1208910d45fc4ffb62e8ae1"

0 commit comments

Comments
 (0)