npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dbs-portal/tool-build

v1.0.0

Published

Build utilities and configurations for DBS Portal monorepo

Readme

@dbs-portal/tool-build

Build utilities and configurations for DBS Portal monorepo packages.

Features

  • 🏗️ Vite Configuration Factory: Pre-configured Vite setups for apps and libraries
  • 📦 Library Build Support: Optimized configurations for package libraries
  • 📊 Bundle Analysis: Tools to analyze and optimize bundle sizes
  • 🎨 Asset Optimization: Image, CSS, and JavaScript optimization utilities
  • 🌍 Environment Management: Configuration management for different environments

Installation

yarn add @dbs-portal/tool-build

Usage

Vite Configuration

// vite.config.ts
import { createViteConfig } from '@dbs-portal/tool-build'

export default createViteConfig({
  type: 'app',
  features: ['react', 'tailwind'],
  optimization: 'production'
})

Library Configuration

// vite.config.ts for a library package
import { createLibraryConfig } from '@dbs-portal/tool-build/library-config'

export default createLibraryConfig({
  name: 'MyLibrary',
  entry: 'src/index.ts',
  formats: ['es', 'cjs']
})

Bundle Analysis

import { bundleAnalyzer } from '@dbs-portal/tool-build'

const analysis = await bundleAnalyzer('./dist')
console.log(analysis.generateReport())

Asset Optimization

import { assetOptimizer } from '@dbs-portal/tool-build'

const optimizer = await assetOptimizer({
  images: { quality: 80, formats: ['webp', 'jpeg'] },
  css: { purge: true, minify: true },
  js: { minify: true, treeshake: true }
})

await optimizer.optimizeImages(['./src/assets/*.jpg'])

Environment Management

import { envManager } from '@dbs-portal/tool-build'

// Load from environment variables
envManager.loadFromEnv()

// Check feature flags
if (envManager.isFeatureEnabled('NEW_FEATURE')) {
  // Enable new feature
}

// Get Vite environment variables
const viteEnv = envManager.getViteEnv()

Presets

Application Presets

import { presets } from '@dbs-portal/tool-build/vite-config'

// React application with Tailwind
export default presets.reactApp()

// React application with custom options
export default presets.reactApp({
  optimization: 'production',
  analyze: true
})

Library Presets

import { libraryPresets } from '@dbs-portal/tool-build/library-config'

// Core utility library
export default libraryPresets.core('MyUtilLibrary')

// React component library
export default libraryPresets.reactComponent('MyComponentLibrary')

// Business module
export default libraryPresets.module('MyModule')

Configuration Options

ViteConfigOptions

interface ViteConfigOptions {
  type: 'app' | 'library'
  features?: ('react' | 'tailwind' | 'router' | 'query')[]
  optimization?: 'development' | 'production'
  analyze?: boolean
  sourcemap?: boolean
  minify?: boolean
  target?: string
  outDir?: string
  publicDir?: string
  base?: string
}

LibraryConfigOptions

interface LibraryConfigOptions {
  name: string
  entry: string
  formats?: ('es' | 'cjs' | 'umd' | 'iife')[]
  external?: string[]
  globals?: Record<string, string>
  fileName?: string | ((format: string) => string)
  cssCodeSplit?: boolean
  emptyOutDir?: boolean
}

Environment Variables

The environment manager supports the following variables:

  • NODE_ENV: Environment mode (development, production, test)
  • API_BASE_URL: Base URL for API calls
  • APP_NAME: Application name
  • APP_VERSION: Application version
  • FEATURE_*: Feature flags (e.g., FEATURE_NEW_UI=true)

Bundle Size Limits

Default bundle size limits:

  • Total bundle: 500KB
  • Gzipped bundle: 100KB

Override with bundle analysis:

const { passed, issues } = analyzer.checkSizeRequirements(
  1024 * 1024, // 1MB total
  200 * 1024   // 200KB gzipped
)

License

MIT