B2B-88: add starter kit structure and elements

This commit is contained in:
devmc-ee
2025-06-08 16:18:30 +03:00
parent 657a36a298
commit e7b25600cb
1280 changed files with 77893 additions and 5688 deletions

View File

@@ -0,0 +1,3 @@
import eslintConfigBase from '@kit/eslint-config/base.js';
export default eslintConfigBase;

View File

@@ -0,0 +1 @@
../../../../../tooling/eslint

View File

@@ -0,0 +1 @@
../../../../../tooling/prettier

1
packages/monitoring/core/node_modules/@kit/tsconfig generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../../../tooling/typescript

1
packages/monitoring/core/node_modules/@types/react generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../../../node_modules/.pnpm/@types+react@19.1.4/node_modules/@types/react

1
packages/monitoring/core/node_modules/react generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../../../../node_modules/.pnpm/react@19.1.0/node_modules/react

View File

@@ -0,0 +1,30 @@
{
"name": "@kit/monitoring-core",
"private": true,
"sideEffects": false,
"version": "0.1.0",
"scripts": {
"clean": "git clean -xdf .turbo node_modules",
"format": "prettier --check \"**/*.{ts,tsx}\"",
"lint": "eslint .",
"typecheck": "tsc --noEmit"
},
"prettier": "@kit/prettier-config",
"exports": {
".": "./src/index.ts"
},
"devDependencies": {
"@kit/eslint-config": "workspace:*",
"@kit/prettier-config": "workspace:*",
"@kit/tsconfig": "workspace:*",
"@types/react": "19.1.4",
"react": "19.1.0"
},
"typesVersions": {
"*": {
"*": [
"src/*"
]
}
}
}

View File

@@ -0,0 +1,21 @@
import { MonitoringService } from '@kit/monitoring-core';
export class ConsoleMonitoringService implements MonitoringService {
identifyUser(data: { id: string }) {
console.log(`[Console Monitoring] Identified user`, data);
}
captureException(error: Error) {
console.error(
`[Console Monitoring] Caught exception: ${JSON.stringify(error)}`,
);
}
captureEvent(event: string) {
console.log(`[Console Monitoring] Captured event: ${event}`);
}
ready() {
return Promise.resolve();
}
}

View File

@@ -0,0 +1,3 @@
export * from './monitoring.service';
export * from './monitoring.context';
export * from './console-monitoring.service';

View File

@@ -0,0 +1,10 @@
'use client';
import { createContext } from 'react';
import { ConsoleMonitoringService } from './console-monitoring.service';
import { MonitoringService } from './monitoring.service';
export const MonitoringContext = createContext<MonitoringService>(
new ConsoleMonitoringService(),
);

View File

@@ -0,0 +1,37 @@
/**
* Monitoring service interface
* @description This service is used to capture exceptions and identify users in the monitoring service
* @example
*/
export abstract class MonitoringService {
/**
* Capture an exception
* @param error
* @param extra
*/
abstract captureException<Extra extends object>(
error: Error & { digest?: string },
extra?: Extra,
): unknown;
/**
* Track an event
* @param event
* @param extra
*/
abstract captureEvent<Extra extends object>(
event: string,
extra?: Extra,
): unknown;
/**
* Identify a user in the monitoring service - used for tracking user actions
* @param info
*/
abstract identifyUser<Info extends { id: string }>(info: Info): unknown;
/**
* Wait for the monitoring service to be ready
*/
abstract ready(): Promise<unknown>;
}

View File

@@ -0,0 +1,8 @@
{
"extends": "@kit/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["*.ts", "src"],
"exclude": ["node_modules"]
}