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

@asaidimu/blueprint

v1.1.1

Published

Project template manager

Downloads

14

Readme

BluePrint: A Component Generation Library

Overview

This library provides a flexible, extensible system for generating and managing project components with support for templating, hooks, and nested component structures.

Features

  • Dynamic Component Generation: Create components with customizable templates
  • Nested Component Support: Build complex project structures with hierarchical components
  • Lifecycle Hooks: Execute custom logic before and after component operations
  • Template Rendering: Use Handlebars for dynamic template generation
  • Flexible Configuration: Supports various project and component configurations

Installation

npm install @asaidimu/blueprint

Core Concepts

Project

The Project class represents the root of your project structure. It manages top-level components and provides initialization capabilities.

const project = new Project('/path/to/project');
await project.initialize({
  components: {
    // Define your component types
  },
  hooks: {
    // Optional project-level hooks
  }
});

Component

Component represents individual project elements that can:

  • Generate files from templates
  • Create sub-components
  • Apply lifecycle hooks
  • Update and remove themselves

Basic Usage

Creating a Project

const project = new Project('/my-project');
await project.initialize({
  components: {
    'service': {
      name: 'service',
      path: 'src/services',
      templates: [
        {
          source: 'service.ts.hbs',
          target: '{{name}}.ts'
        }
      ]
    }
  }
});

Creating a Component

// Create a top-level component
const userService = await project.create('service', {
  name: 'UserService'
});

// Add a sub-component to an existing component
const helperMethod = await userService.add('method', {
  name: 'validateUser'
});

Advanced Features

Hooks

Define lifecycle hooks for granular control:

const serviceConfig = {
  name: 'service',
  path: 'src/services',
  templates: [...],
  hooks: {
    beforeCreate: async (context) => {
      // Validate options
      // Perform pre-creation logic
    },
    afterCreate: async (context) => {
      // Log creation
      // Trigger additional processes
    }
  }
};

Validation

Component options can be validated using Zod schemas:

  • Define validation rules when adding components
  • Prevent invalid component creation
  • Transform and normalize input data
  • Provides detailed error messages
component.addComponent({
  schema: z.object({
      name: z.string().min(3),
      type: z.enum(['service', 'model'])
  })
})

Template Rendering

Use Handlebars for dynamic template generation:

// service.ts.hbs
export class {{pascalCase name}} {
  constructor(private config: {{configType}}) {}

  async {{methodName}}() {
    // Generated method
  }
}

API Reference

Project Methods

  • initialize(config?): Set up project structure
  • addComponent(config): Register a component type
  • create(type, options): Create a top-level component

Component Methods

  • create(options): Create the component
  • update(options): Update component files
  • remove(): Delete the component
  • add(type, options): Create a nested sub-component

Template File Configuration

  • source: Path to the Handlebars template
  • target: Output file path (supports Handlebars interpolation)
  • required: Whether the file must always be generated

Error Handling

The library throws descriptive errors for:

  • Unknown component types
  • Invalid configurations
  • File system issues

Performance Considerations

  • Uses async/await for non-blocking file operations
  • Supports recursive directory creation
  • Minimal overhead for template rendering

Limitations

  • Requires Node.js with native fs/promises support
  • Template paths must be resolvable

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push and submit a Pull Request

License

MIT License

Contact

For questions, issues, or support, please open a GitHub issue.