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

df-cc

v1.0.1

Published

DataFlex Custom Component CLI — scaffold and generate components for DataFlex webapps

Readme

df-cc — DataFlex Custom Component CLI

A CLI tool for scaffolding and generating custom components for DataFlex webapps. Write modern JavaScript classes, bundle them with Vite, and have them available in your DataFlex application.

Features

  • Modern JavaScript — write ES2024 class syntax with full ESLint checking
  • Vite bundler — fast builds, watch mode for development
  • IIFE output — components are bundled into AppHtml/Custom/DFCC.js and loaded as a global namespace object
  • Multiple components — all components share a single bundle
  • Per-component CSS — each component gets its own stylesheet

Prerequisites

Install NodeJS if you haven't already:

winget install OpenJS.NodeJS.LTS

Usage

Step 1 — Initialise a DataFlex workspace

Navigate to your DataFlex project folder and run:

npx df-cc init

This creates the build setup in the current directory:

  • package.json — Vite + ESLint dependencies and build scripts
  • vite.config.js — Vite IIFE bundle configuration
  • eslint.config.js — ESLint 10 flat config
  • src/index.js — entry point that exports all components

Dependencies are installed automatically.

Options:

npx df-cc init --name MyApp

Use --name to set the global namespace (default: DFCC). All components will be available as window.MyApp.<ComponentName> in the browser.

Step 2 — Create a component

npx df-cc create MyCustomComponent

This generates:

  • src/MyCustomComponent.js — JavaScript class extending df.WebBaseControl
  • src/MyCustomComponent.css — stylesheet for the component
  • AppSrc/cMyCustomComponent.pkg — DataFlex class with psJSClass pre-set

And updates src/index.js to export the new component.

Run create again for each additional component you want in the bundle:

npx df-cc create MyOtherComponent

Step 3 — Build

Build for production (runs ESLint first):

npm run build

Watch mode during development (rebuilds on file changes):

npm run watch

Step 4 — Add to Index.html

Add the bundled files to your Index.html:

<script src="Custom/DFCC.js"></script>
<link rel="stylesheet" href="Custom/DFCC.css">

Step 5 — Use the component in DataFlex

In your DataFlex program, use the generated .pkg file like any other web control:

Use AppSrc\cMyCustomComponent.pkg

Object oMyWidget is a cMyCustomComponent
End_Object

How it works

Each JavaScript component class is exported by name from src/index.js. Vite bundles everything as an IIFE and assigns the exports to a global namespace object (e.g. window.DFCC). The DataFlex psJSClass property points to the class using dot notation, e.g. "DFCC.MyCustomComponent".

Writing a component

The generated JavaScript class template looks like this:

export class MyCustomComponent extends df.WebBaseControl {
    constructor(sName, oParent) {
        super(sName, oParent);
        this._sControlClass = 'my-custom-component';
    }

    openHtml(aHtml) {
        super.openHtml(aHtml);
        aHtml.push(`<div class="my-custom-component-wrapper" id="${this._sControlId}">`);
        aHtml.push('<h1>Hello DataFlex!</h1>');
        aHtml.push('</div>');
    }

    afterRender() {
        this._eControl = df.dom.query(this._eElem, `#${this._sControlId}`);
        super.afterRender();
    }
}

You can install and use npm packages inside your component files. They will be included in the bundle automatically.

License

MIT