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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fliidotdev/codegen

v0.1.2

Published

Production-ready code generation library for React, Vue, Angular, and vanilla JavaScript. Transform visual designs and component configurations into clean, maintainable code.

Readme

@fliidotdev/codegen

Production-ready code generation library for React, Vue, Angular, and vanilla JavaScript. Transform visual designs and component configurations into clean, maintainable code.

Installation

npm install @fliidotdev/codegen
# or
yarn add @fliidotdev/codegen
# or
pnpm add @fliidotdev/codegen

Features

  • Multi-Framework Support: Generate code for React, Vue, Angular, and vanilla JS
  • Smart Imports: Automatically manages and optimizes import statements
  • Type-Safe Generation: Full TypeScript support with proper type definitions
  • Prettier Integration: All generated code is automatically formatted
  • Component Composition: Build complex components from simple configurations
  • Style Management: Handle CSS-in-JS, CSS modules, and inline styles
  • Performance Optimized: Generate production-ready, optimized code

Usage

React Code Generation

import { ReactGenerator } from '@fliidotdev/codegen';

const generator = new ReactGenerator();

const components = [
  {
    id: 'hero-section',
    type: 'div',
    props: { 
      className: 'hero-container' 
    },
    style: {
      padding: '48px',
      background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'
    },
    children: [
      {
        id: 'hero-title',
        type: 'h1',
        props: { 
          className: 'hero-title' 
        },
        children: [{
          id: 'text-1',
          type: 'text',
          props: { value: 'Welcome to Flii' }
        }]
      },
      {
        id: 'hero-button',
        type: 'Button',
        props: { 
          variant: 'primary',
          onClick: '() => console.log("Clicked")'
        },
        children: [{
          id: 'button-text',
          type: 'text',
          props: { value: 'Get Started' }
        }]
      }
    ]
  }
];

const code = generator.generate(components);
console.log(code);

Generated Output

import React from 'react';
import { Button } from '@/components/ui/button';

export default function GeneratedComponent() {
  return (
    <>
      <div 
        className="hero-container" 
        style={{
          padding: '48px',
          background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'
        }}
      >
        <h1 className="hero-title">
          Welcome to Flii
        </h1>
        <Button 
          variant="primary" 
          onClick={() => console.log("Clicked")}
        >
          Get Started
        </Button>
      </div>
    </>
  );
}

Vue Code Generation

import { VueGenerator } from '@fliidotdev/codegen';

const generator = new VueGenerator();

const config = {
  template: components,
  script: {
    setup: true,
    imports: ['ref', 'computed'],
    state: {
      count: 0
    }
  }
};

const vueComponent = generator.generate(config);

Angular Code Generation

import { AngularGenerator } from '@fliidotdev/codegen';

const generator = new AngularGenerator();

const config = {
  selector: 'app-hero',
  components: components,
  styles: ['./hero.component.css']
};

const angularComponent = generator.generate(config);

API Reference

ReactGenerator

Generates React component code from configuration objects.

Methods

generate(components: ComponentConfig[]): string

Generates a complete React component.

Parameters:

  • components: Array of component configurations

Returns:

  • Formatted React component code as string

ComponentConfig

interface ComponentConfig {
  id: string;                      // Unique identifier
  type: string;                    // HTML element or component name
  props: Record<string, any>;      // Component properties
  children: ComponentConfig[];     // Nested components
  style?: Record<string, any>;     // Inline styles
}

Framework Generators

  • ReactGenerator: React/Next.js code generation
  • VueGenerator: Vue 3 composition API generation
  • AngularGenerator: Angular component generation
  • VanillaGenerator: Plain JavaScript generation

Advanced Features

Custom Component Mapping

import { ReactGenerator } from '@fliidotdev/codegen';

const generator = new ReactGenerator({
  componentMap: {
    'CustomButton': '@/components/CustomButton',
    'Card': '@/components/Card'
  }
});

Template Customization

const generator = new ReactGenerator({
  template: 'functional', // 'functional' | 'class' | 'arrow'
  typescript: true,
  prettier: {
    semi: false,
    singleQuote: true
  }
});

Integration with Flii Platform

This package powers the code generation capabilities of the Flii visual development platform:

  • Visual to code transformation
  • Live code preview
  • Framework switching
  • Export to production-ready projects
  • Component library integration

Development

# Install dependencies
pnpm install

# Build the package
pnpm build

# Run tests
pnpm test

# Development mode
pnpm dev

License

MIT © fliidotdev

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Support