1.0.6 • Published 4 months ago

abyz-back-components v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

abyz-back-components

A collection of reusable NestJS backend components and utilities.

npm version License: MIT

Installation

# Using npm
npm install abyz-back-components

# Using yarn
yarn add abyz-back-components

Core Features

  • DTOs: Pagination, filtering, data validation
  • Guards: Authentication and authorization
  • Utils: Date, number, format helpers
  • Loggers: Structured logging
  • Error Handling: HTTP and RPC exception filters

Quick Usage

// Import components directly
import { PaginationParamsNoStatus, CustomLogger } from 'abyz-back-components';

// Or import the module for automatic setup
import { AbyzComponentsModule } from 'abyz-back-components';

@Module({
  imports: [AbyzComponentsModule],
})
export class AppModule {}

Example: Pagination

import { Controller, Get, Query } from '@nestjs/common';
import { PaginationParamsNoStatus } from 'abyz-back-components';

@Controller('items')
export class ItemsController {
  @Get()
  async findAll(@Query() query: PaginationParamsNoStatus) {
    return this.itemsService.findAll({
      skip: query.offset,
      take: query.limit,
      filter: query.filter,
    });
  }
}

Manual Publishing

  1. Update version:

    # Increment patch version (1.0.0 → 1.0.1)
    npm version patch
    
    # OR increment minor version (1.0.0 → 1.1.0)
    npm version minor
    
    # OR increment major version (1.0.0 → 2.0.0)
    npm version major
  2. Build and publish:

    # Build package
    npm run build
    
    # Publish to npm (requires npm account and login)
    npm login  # if not already logged in
    npm publish
  3. Push changes:

    git push
    git push --tags

License

MIT