From 9f97509b0646f9cf461b84bc4bedd4d758a9cbed Mon Sep 17 00:00:00 2001 From: imfozilbek Date: Mon, 24 Nov 2025 02:54:13 +0500 Subject: [PATCH] chore: remove core package Remove the @puaros/core package as it has been superseded by guardian package. --- packages/core/.gitignore | 13 ----- packages/core/.npmignore | 38 ------------- packages/core/package.json | 38 ------------- .../core/src/application/dtos/ResponseDto.ts | 31 ---------- packages/core/src/application/index.ts | 3 - .../core/src/application/interfaces/.gitkeep | 0 .../core/src/application/mappers/Mapper.ts | 20 ------- .../core/src/application/use-cases/UseCase.ts | 13 ----- .../core/src/domain/entities/BaseEntity.ts | 44 -------------- .../core/src/domain/events/DomainEvent.ts | 25 -------- packages/core/src/domain/index.ts | 4 -- .../src/domain/repositories/IRepository.ts | 14 ----- .../src/domain/value-objects/ValueObject.ts | 23 -------- packages/core/src/index.ts | 4 -- .../core/src/infrastructure/git/GitService.ts | 42 -------------- packages/core/src/infrastructure/index.ts | 3 - .../src/infrastructure/parsers/CodeParser.ts | 56 ------------------ .../repositories/BaseRepository.ts | 39 ------------- packages/core/src/shared/constants/index.ts | 12 ---- packages/core/src/shared/errors/BaseError.ts | 39 ------------- packages/core/src/shared/index.ts | 4 -- packages/core/src/shared/types/Result.ts | 29 ---------- packages/core/src/shared/utils/Guards.ts | 44 -------------- .../tests/fixtures/code-samples/sample.ts | 16 ------ .../core/tests/unit/domain/BaseEntity.test.ts | 46 --------------- .../core/tests/unit/shared/Guards.test.ts | 57 ------------------- packages/core/tsconfig.json | 20 ------- packages/core/vitest.config.ts | 28 --------- 28 files changed, 705 deletions(-) delete mode 100644 packages/core/.gitignore delete mode 100644 packages/core/.npmignore delete mode 100644 packages/core/package.json delete mode 100644 packages/core/src/application/dtos/ResponseDto.ts delete mode 100644 packages/core/src/application/index.ts delete mode 100644 packages/core/src/application/interfaces/.gitkeep delete mode 100644 packages/core/src/application/mappers/Mapper.ts delete mode 100644 packages/core/src/application/use-cases/UseCase.ts delete mode 100644 packages/core/src/domain/entities/BaseEntity.ts delete mode 100644 packages/core/src/domain/events/DomainEvent.ts delete mode 100644 packages/core/src/domain/index.ts delete mode 100644 packages/core/src/domain/repositories/IRepository.ts delete mode 100644 packages/core/src/domain/value-objects/ValueObject.ts delete mode 100644 packages/core/src/index.ts delete mode 100644 packages/core/src/infrastructure/git/GitService.ts delete mode 100644 packages/core/src/infrastructure/index.ts delete mode 100644 packages/core/src/infrastructure/parsers/CodeParser.ts delete mode 100644 packages/core/src/infrastructure/repositories/BaseRepository.ts delete mode 100644 packages/core/src/shared/constants/index.ts delete mode 100644 packages/core/src/shared/errors/BaseError.ts delete mode 100644 packages/core/src/shared/index.ts delete mode 100644 packages/core/src/shared/types/Result.ts delete mode 100644 packages/core/src/shared/utils/Guards.ts delete mode 100644 packages/core/tests/fixtures/code-samples/sample.ts delete mode 100644 packages/core/tests/unit/domain/BaseEntity.test.ts delete mode 100644 packages/core/tests/unit/shared/Guards.test.ts delete mode 100644 packages/core/tsconfig.json delete mode 100644 packages/core/vitest.config.ts diff --git a/packages/core/.gitignore b/packages/core/.gitignore deleted file mode 100644 index aa95ec3..0000000 --- a/packages/core/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Build output -dist/ -*.tsbuildinfo - -# Dependencies -node_modules/ - -# Test coverage -coverage/ - -# Logs -*.log -npm-debug.log* diff --git a/packages/core/.npmignore b/packages/core/.npmignore deleted file mode 100644 index 825186b..0000000 --- a/packages/core/.npmignore +++ /dev/null @@ -1,38 +0,0 @@ -# Source files (only publish dist/) -src/ -*.ts -!*.d.ts - -# Build artifacts -tsconfig.json -tsconfig.*.json -tsconfig.tsbuildinfo -*.tsbuildinfo - -# Tests -**/*.spec.ts -**/*.test.ts -__tests__/ -coverage/ - -# Development -node_modules/ -.env -.env.* - -# IDE -.vscode/ -.idea/ -*.swp -*.swo - -# Git -.git/ -.gitignore - -# Other -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.DS_Store diff --git a/packages/core/package.json b/packages/core/package.json deleted file mode 100644 index a42f5b7..0000000 --- a/packages/core/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@puaros/core", - "version": "0.0.1", - "private": true, - "description": "Core business logic for Puaros", - "keywords": [ - "puaros" - ], - "main": "dist/index.js", - "types": "dist/index.d.ts", - "author": "Fozilbek Samiyev ", - "license": "MIT", - "scripts": { - "build": "tsc", - "watch": "tsc --watch", - "clean": "rm -rf dist", - "test": "vitest", - "test:ui": "vitest --ui", - "test:watch": "vitest --watch", - "test:coverage": "vitest run --coverage", - "test:run": "vitest run" - }, - "dependencies": { - "simple-git": "^3.30.0", - "tree-sitter": "^0.21.1", - "tree-sitter-javascript": "^0.23.0", - "tree-sitter-typescript": "^0.23.0", - "uuid": "^13.0.0" - }, - "devDependencies": { - "@types/node": "^22.10.7", - "@types/uuid": "^11.0.0", - "@vitest/coverage-v8": "^4.0.10", - "@vitest/ui": "^4.0.10", - "typescript": "^5.7.3", - "vitest": "^4.0.10" - } -} diff --git a/packages/core/src/application/dtos/ResponseDto.ts b/packages/core/src/application/dtos/ResponseDto.ts deleted file mode 100644 index 1a1e587..0000000 --- a/packages/core/src/application/dtos/ResponseDto.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Standard response wrapper for use cases - */ -export interface IResponseDto { - success: boolean; - data?: T; - error?: string; - timestamp: Date; -} - -export class ResponseDto implements IResponseDto { - public readonly success: boolean; - public readonly data?: T; - public readonly error?: string; - public readonly timestamp: Date; - - private constructor(success: boolean, data?: T, error?: string) { - this.success = success; - this.data = data; - this.error = error; - this.timestamp = new Date(); - } - - public static ok(data: T): ResponseDto { - return new ResponseDto(true, data); - } - - public static fail(error: string): ResponseDto { - return new ResponseDto(false, undefined, error); - } -} \ No newline at end of file diff --git a/packages/core/src/application/index.ts b/packages/core/src/application/index.ts deleted file mode 100644 index ea26bfd..0000000 --- a/packages/core/src/application/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './use-cases/UseCase'; -export * from './dtos/ResponseDto'; -export * from './mappers/Mapper'; diff --git a/packages/core/src/application/interfaces/.gitkeep b/packages/core/src/application/interfaces/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/packages/core/src/application/mappers/Mapper.ts b/packages/core/src/application/mappers/Mapper.ts deleted file mode 100644 index 40644a9..0000000 --- a/packages/core/src/application/mappers/Mapper.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Generic mapper interface for converting between domain entities and DTOs - */ -export interface IMapper { - toDto(domain: TDomain): TDto; - toDomain(dto: TDto): TDomain; -} - -export abstract class Mapper implements IMapper { - public abstract toDto(domain: TDomain): TDto; - public abstract toDomain(dto: TDto): TDomain; - - public toDtoList(domains: TDomain[]): TDto[] { - return domains.map((domain) => this.toDto(domain)); - } - - public toDomainList(dtos: TDto[]): TDomain[] { - return dtos.map((dto) => this.toDomain(dto)); - } -} diff --git a/packages/core/src/application/use-cases/UseCase.ts b/packages/core/src/application/use-cases/UseCase.ts deleted file mode 100644 index 6301e69..0000000 --- a/packages/core/src/application/use-cases/UseCase.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Base interface for all use cases - */ -export interface IUseCase { - execute(request: TRequest): Promise; -} - -/** - * Abstract base class for use cases - */ -export abstract class UseCase implements IUseCase { - public abstract execute(request: TRequest): Promise; -} \ No newline at end of file diff --git a/packages/core/src/domain/entities/BaseEntity.ts b/packages/core/src/domain/entities/BaseEntity.ts deleted file mode 100644 index 5d77ae2..0000000 --- a/packages/core/src/domain/entities/BaseEntity.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { v4 as uuidv4 } from 'uuid'; - -/** - * Base entity class with ID and timestamps - */ -export abstract class BaseEntity { - protected readonly _id: string; - protected readonly _createdAt: Date; - protected _updatedAt: Date; - - constructor(id?: string) { - this._id = id ?? uuidv4(); - this._createdAt = new Date(); - this._updatedAt = new Date(); - } - - public get id(): string { - return this._id; - } - - public get createdAt(): Date { - return this._createdAt; - } - - public get updatedAt(): Date { - return this._updatedAt; - } - - protected touch(): void { - this._updatedAt = new Date(); - } - - public equals(entity: BaseEntity): boolean { - if (entity === null || entity === undefined) { - return false; - } - - if (this === entity) { - return true; - } - - return this._id === entity._id; - } -} \ No newline at end of file diff --git a/packages/core/src/domain/events/DomainEvent.ts b/packages/core/src/domain/events/DomainEvent.ts deleted file mode 100644 index afdf9eb..0000000 --- a/packages/core/src/domain/events/DomainEvent.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { v4 as uuidv4 } from 'uuid'; - -/** - * Base interface for all domain events - */ -export interface IDomainEvent { - readonly eventId: string; - readonly occurredOn: Date; - readonly eventType: string; -} - -/** - * Base class for domain events - */ -export abstract class DomainEvent implements IDomainEvent { - public readonly eventId: string; - public readonly occurredOn: Date; - public readonly eventType: string; - - constructor(eventType: string) { - this.eventId = uuidv4(); - this.occurredOn = new Date(); - this.eventType = eventType; - } -} \ No newline at end of file diff --git a/packages/core/src/domain/index.ts b/packages/core/src/domain/index.ts deleted file mode 100644 index a164700..0000000 --- a/packages/core/src/domain/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './entities/BaseEntity'; -export * from './value-objects/ValueObject'; -export * from './repositories/IRepository'; -export * from './events/DomainEvent'; \ No newline at end of file diff --git a/packages/core/src/domain/repositories/IRepository.ts b/packages/core/src/domain/repositories/IRepository.ts deleted file mode 100644 index 56bb5d7..0000000 --- a/packages/core/src/domain/repositories/IRepository.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { BaseEntity } from '../entities/BaseEntity'; - -/** - * Generic repository interface - * Defines standard CRUD operations for entities - */ -export interface IRepository { - findById(id: string): Promise; - findAll(): Promise; - save(entity: T): Promise; - update(entity: T): Promise; - delete(id: string): Promise; - exists(id: string): Promise; -} \ No newline at end of file diff --git a/packages/core/src/domain/value-objects/ValueObject.ts b/packages/core/src/domain/value-objects/ValueObject.ts deleted file mode 100644 index 503f7e2..0000000 --- a/packages/core/src/domain/value-objects/ValueObject.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Base class for Value Objects - * Value objects are immutable and compared by value, not identity - */ -export abstract class ValueObject { - protected readonly props: T; - - constructor(props: T) { - this.props = Object.freeze(props); - } - - public equals(vo?: ValueObject): boolean { - if (vo === null || vo === undefined) { - return false; - } - - if (vo.props === undefined) { - return false; - } - - return JSON.stringify(this.props) === JSON.stringify(vo.props); - } -} \ No newline at end of file diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts deleted file mode 100644 index a5b90fc..0000000 --- a/packages/core/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './domain'; -export * from './application'; -export * from './infrastructure'; -export * from './shared'; diff --git a/packages/core/src/infrastructure/git/GitService.ts b/packages/core/src/infrastructure/git/GitService.ts deleted file mode 100644 index 615bfec..0000000 --- a/packages/core/src/infrastructure/git/GitService.ts +++ /dev/null @@ -1,42 +0,0 @@ -import simpleGit, { SimpleGit, SimpleGitOptions } from 'simple-git'; - -/** - * Git operations service using simple-git - */ -export class GitService { - private readonly git: SimpleGit; - - constructor(baseDir: string, options?: Partial) { - this.git = simpleGit(baseDir, options); - } - - public async clone(repoUrl: string, localPath: string): Promise { - await this.git.clone(repoUrl, localPath); - } - - public async status(): Promise { - const statusSummary = await this.git.status(); - return JSON.stringify(statusSummary, null, 2); - } - - public async log(maxCount: number = 10): Promise { - const logResult = await this.git.log({ maxCount }); - return JSON.stringify(logResult, null, 2); - } - - public async add(files: string | string[]): Promise { - await this.git.add(files); - } - - public async commit(message: string): Promise { - await this.git.commit(message); - } - - public async push(remote: string = 'origin', branch: string = 'main'): Promise { - await this.git.push(remote, branch); - } - - public async pull(remote: string = 'origin', branch: string = 'main'): Promise { - await this.git.pull(remote, branch); - } -} \ No newline at end of file diff --git a/packages/core/src/infrastructure/index.ts b/packages/core/src/infrastructure/index.ts deleted file mode 100644 index c0bad36..0000000 --- a/packages/core/src/infrastructure/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './repositories/BaseRepository'; -export * from './git/GitService'; -export * from './parsers/CodeParser'; \ No newline at end of file diff --git a/packages/core/src/infrastructure/parsers/CodeParser.ts b/packages/core/src/infrastructure/parsers/CodeParser.ts deleted file mode 100644 index aefd137..0000000 --- a/packages/core/src/infrastructure/parsers/CodeParser.ts +++ /dev/null @@ -1,56 +0,0 @@ -import Parser from 'tree-sitter'; -import JavaScript from 'tree-sitter-javascript'; -import TypeScript from 'tree-sitter-typescript'; - -/** - * Code parser service using tree-sitter - */ -export class CodeParser { - private readonly parser: Parser; - - constructor() { - this.parser = new Parser(); - } - - public parseJavaScript(code: string): Parser.Tree { - this.parser.setLanguage(JavaScript); - return this.parser.parse(code); - } - - public parseTypeScript(code: string): Parser.Tree { - this.parser.setLanguage(TypeScript.typescript); - return this.parser.parse(code); - } - - public parseTsx(code: string): Parser.Tree { - this.parser.setLanguage(TypeScript.tsx); - return this.parser.parse(code); - } - - public extractFunctions(tree: Parser.Tree): string[] { - const functions: string[] = []; - const cursor = tree.walk(); - - const visit = (): void => { - const node = cursor.currentNode; - - if ( - node.type === 'function_declaration' || - node.type === 'arrow_function' || - node.type === 'function_expression' - ) { - functions.push(node.text); - } - - if (cursor.gotoFirstChild()) { - do { - visit(); - } while (cursor.gotoNextSibling()); - cursor.gotoParent(); - } - }; - - visit(); - return functions; - } -} \ No newline at end of file diff --git a/packages/core/src/infrastructure/repositories/BaseRepository.ts b/packages/core/src/infrastructure/repositories/BaseRepository.ts deleted file mode 100644 index 10bb878..0000000 --- a/packages/core/src/infrastructure/repositories/BaseRepository.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { BaseEntity } from '../../domain/entities/BaseEntity'; -import { IRepository } from '../../domain/repositories/IRepository'; - -/** - * Abstract base repository implementation - * Provides common repository functionality - */ -export abstract class BaseRepository implements IRepository { - protected readonly items: Map = new Map(); - - public async findById(id: string): Promise { - return this.items.get(id) ?? null; - } - - public async findAll(): Promise { - return Array.from(this.items.values()); - } - - public async save(entity: T): Promise { - this.items.set(entity.id, entity); - return entity; - } - - public async update(entity: T): Promise { - if (!this.items.has(entity.id)) { - throw new Error(`Entity with id ${entity.id} not found`); - } - this.items.set(entity.id, entity); - return entity; - } - - public async delete(id: string): Promise { - return this.items.delete(id); - } - - public async exists(id: string): Promise { - return this.items.has(id); - } -} \ No newline at end of file diff --git a/packages/core/src/shared/constants/index.ts b/packages/core/src/shared/constants/index.ts deleted file mode 100644 index a9671b7..0000000 --- a/packages/core/src/shared/constants/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const APP_CONSTANTS = { - DEFAULT_TIMEOUT: 5000, - MAX_RETRIES: 3, - VERSION: '0.0.1', -} as const; - -export const ERROR_MESSAGES = { - VALIDATION_FAILED: 'Validation failed', - NOT_FOUND: 'Resource not found', - UNAUTHORIZED: 'Unauthorized access', - INTERNAL_ERROR: 'Internal server error', -} as const; diff --git a/packages/core/src/shared/errors/BaseError.ts b/packages/core/src/shared/errors/BaseError.ts deleted file mode 100644 index 68161be..0000000 --- a/packages/core/src/shared/errors/BaseError.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Base error class for custom application errors - */ -export abstract class BaseError extends Error { - public readonly timestamp: Date; - public readonly code: string; - - constructor(message: string, code: string) { - super(message); - this.name = this.constructor.name; - this.code = code; - this.timestamp = new Date(); - Error.captureStackTrace(this, this.constructor); - } -} - -export class ValidationError extends BaseError { - constructor(message: string) { - super(message, 'VALIDATION_ERROR'); - } -} - -export class NotFoundError extends BaseError { - constructor(message: string) { - super(message, 'NOT_FOUND'); - } -} - -export class UnauthorizedError extends BaseError { - constructor(message: string) { - super(message, 'UNAUTHORIZED'); - } -} - -export class InternalError extends BaseError { - constructor(message: string) { - super(message, 'INTERNAL_ERROR'); - } -} diff --git a/packages/core/src/shared/index.ts b/packages/core/src/shared/index.ts deleted file mode 100644 index 4680489..0000000 --- a/packages/core/src/shared/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './types/Result'; -export * from './errors/BaseError'; -export * from './utils/Guards'; -export * from './constants'; diff --git a/packages/core/src/shared/types/Result.ts b/packages/core/src/shared/types/Result.ts deleted file mode 100644 index 974d9ef..0000000 --- a/packages/core/src/shared/types/Result.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Result type for handling success/failure scenarios - */ -export type Result = Success | Failure; - -export class Success { - public readonly isSuccess = true; - public readonly isFailure = false; - - constructor(public readonly value: T) {} - - public static create(value: T): Success { - return new Success(value); - } -} - -export class Failure { - public readonly isSuccess = false; - public readonly isFailure = true; - - constructor(public readonly error: E) {} - - public static create(error: E): Failure { - return new Failure(error); - } -} - -export const ok = (value: T): Result => new Success(value); -export const fail = (error: E): Result => new Failure(error); diff --git a/packages/core/src/shared/utils/Guards.ts b/packages/core/src/shared/utils/Guards.ts deleted file mode 100644 index f4bc37d..0000000 --- a/packages/core/src/shared/utils/Guards.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Type guard utilities for runtime type checking - */ -export class Guards { - public static isNullOrUndefined(value: unknown): value is null | undefined { - return value === null || value === undefined; - } - - public static isString(value: unknown): value is string { - return typeof value === 'string'; - } - - public static isNumber(value: unknown): value is number { - return typeof value === 'number' && !isNaN(value); - } - - public static isBoolean(value: unknown): value is boolean { - return typeof value === 'boolean'; - } - - public static isObject(value: unknown): value is object { - return typeof value === 'object' && value !== null && !Array.isArray(value); - } - - public static isArray(value: unknown): value is T[] { - return Array.isArray(value); - } - - public static isEmpty(value: string | unknown[] | object | null | undefined): boolean { - if (Guards.isNullOrUndefined(value)) { - return true; - } - - if (Guards.isString(value) || Guards.isArray(value)) { - return value.length === 0; - } - - if (Guards.isObject(value)) { - return Object.keys(value).length === 0; - } - - return false; - } -} diff --git a/packages/core/tests/fixtures/code-samples/sample.ts b/packages/core/tests/fixtures/code-samples/sample.ts deleted file mode 100644 index 90d0f1a..0000000 --- a/packages/core/tests/fixtures/code-samples/sample.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function add(a: number, b: number): number { - return a + b; -} - -export const multiply = (a: number, b: number): number => { - return a * b; -}; - -export class Calculator { - public divide(a: number, b: number): number { - if (b === 0) { - throw new Error('Division by zero'); - } - return a / b; - } -} \ No newline at end of file diff --git a/packages/core/tests/unit/domain/BaseEntity.test.ts b/packages/core/tests/unit/domain/BaseEntity.test.ts deleted file mode 100644 index 01fa698..0000000 --- a/packages/core/tests/unit/domain/BaseEntity.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { describe, it, expect } from 'vitest'; -import { BaseEntity } from '../../../src/domain/entities/BaseEntity'; - -class TestEntity extends BaseEntity { - constructor(id?: string) { - super(id); - } -} - -describe('BaseEntity', () => { - it('should create an entity with generated id', () => { - const entity = new TestEntity(); - expect(entity.id).toBeDefined(); - expect(typeof entity.id).toBe('string'); - }); - - it('should create an entity with provided id', () => { - const customId = 'custom-id-123'; - const entity = new TestEntity(customId); - expect(entity.id).toBe(customId); - }); - - it('should have createdAt and updatedAt timestamps', () => { - const entity = new TestEntity(); - expect(entity.createdAt).toBeInstanceOf(Date); - expect(entity.updatedAt).toBeInstanceOf(Date); - }); - - it('should return true when comparing same entity', () => { - const entity = new TestEntity(); - expect(entity.equals(entity)).toBe(true); - }); - - it('should return true when comparing entities with same id', () => { - const id = 'same-id'; - const entity1 = new TestEntity(id); - const entity2 = new TestEntity(id); - expect(entity1.equals(entity2)).toBe(true); - }); - - it('should return false when comparing entities with different ids', () => { - const entity1 = new TestEntity(); - const entity2 = new TestEntity(); - expect(entity1.equals(entity2)).toBe(false); - }); -}); \ No newline at end of file diff --git a/packages/core/tests/unit/shared/Guards.test.ts b/packages/core/tests/unit/shared/Guards.test.ts deleted file mode 100644 index 4dd0c9b..0000000 --- a/packages/core/tests/unit/shared/Guards.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { describe, it, expect } from 'vitest'; -import { Guards } from '../../../src/shared/utils/Guards'; - -describe('Guards', () => { - describe('isNullOrUndefined', () => { - it('should return true for null', () => { - expect(Guards.isNullOrUndefined(null)).toBe(true); - }); - - it('should return true for undefined', () => { - expect(Guards.isNullOrUndefined(undefined)).toBe(true); - }); - - it('should return false for other values', () => { - expect(Guards.isNullOrUndefined(0)).toBe(false); - expect(Guards.isNullOrUndefined('')).toBe(false); - expect(Guards.isNullOrUndefined(false)).toBe(false); - }); - }); - - describe('isString', () => { - it('should return true for strings', () => { - expect(Guards.isString('hello')).toBe(true); - expect(Guards.isString('')).toBe(true); - }); - - it('should return false for non-strings', () => { - expect(Guards.isString(123)).toBe(false); - expect(Guards.isString(null)).toBe(false); - }); - }); - - describe('isEmpty', () => { - it('should return true for empty strings', () => { - expect(Guards.isEmpty('')).toBe(true); - }); - - it('should return true for empty arrays', () => { - expect(Guards.isEmpty([])).toBe(true); - }); - - it('should return true for empty objects', () => { - expect(Guards.isEmpty({})).toBe(true); - }); - - it('should return true for null/undefined', () => { - expect(Guards.isEmpty(null)).toBe(true); - expect(Guards.isEmpty(undefined)).toBe(true); - }); - - it('should return false for non-empty values', () => { - expect(Guards.isEmpty('text')).toBe(false); - expect(Guards.isEmpty([1])).toBe(false); - expect(Guards.isEmpty({ key: 'value' })).toBe(false); - }); - }); -}); \ No newline at end of file diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index e0b9527..0000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./dist", - "rootDir": "./src", - "target": "ES2023", - "module": "CommonJS", - "moduleResolution": "node", - "declaration": true, - "declarationMap": true, - "composite": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "skipLibCheck": true, - "sourceMap": true, - "baseUrl": "./src" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"] -} diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts deleted file mode 100644 index ed4cd13..0000000 --- a/packages/core/vitest.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { defineConfig } from 'vitest/config'; - -export default defineConfig({ - resolve: { - extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'], - }, - test: { - globals: true, - environment: 'node', - coverage: { - provider: 'v8', - reporter: ['text', 'json', 'html', 'lcov'], - exclude: [ - '**/node_modules/**', - '**/dist/**', - '**/*.test.ts', - '**/*.spec.ts', - '**/tests/**', - ], - thresholds: { - lines: 80, - functions: 80, - branches: 80, - statements: 80, - }, - }, - }, -});