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

dvdt-erd-generator

v0.0.8

Published

Generate Entity Relationship Diagrams (ERD) for Dataverse solutions - VS Code WebView integration for DVDT

Readme

ERD Generator for Dataverse

Generate Entity Relationship Diagrams (ERD) from Dataverse solutions. Designed as a VS Code WebView panel for seamless integration with Dataverse DevTools (DVDT).

Features

  • 🎨 VS Code WebView Panel: Complete UI with modern dropdown controls and configuration options
  • Minimal Integration: Just call one function - no command registration needed
  • Fetch metadata automatically: Retrieve solution, table, attribute, and relationship metadata from Dataverse
  • Generate ERD from Dataverse solution metadata
  • Support for multiple diagram formats:
    • Mermaid
    • PlantUML
    • Graphviz DOT
  • Configurable output (via UI):
    • Include/exclude attributes
    • Include/exclude relationships
    • Limit number of attributes per table
  • Download options:
    • Source code (.mmd, .puml, .dot)
    • Copy to clipboard

Installation

npm install dvdt-erd-generator

Development & Testing

Building the Project

The project uses a single unified build command that compiles both the extension code and webview bundle:

npm run build

This runs two build processes sequentially:

  1. TypeScript compiler (tsc) - Compiles extension code for Node.js/VS Code environment

    • Compiles: src/vscode-integration.ts, DataverseClient.ts, ERDGenerator.ts, etc.
    • Output: dist/src/*.js files
    • Target: Node.js runtime (used by VS Code extension host)
  2. Webpack - Bundles webview code for browser environment

    • Bundles: src/webview.ts with all dependencies (DataverseClient, ERDGenerator, Mermaid)
    • Output: dist/webview/webview.js (single bundled file)
    • Target: Browser runtime (runs in VS Code WebView panel)

Why two separate build processes?

We need both because the extension and webview run in different environments:

  • Extension code runs in Node.js (VS Code extension host) and needs access to VS Code APIs
  • Webview code runs in a browser context (Chrome-based webview) and needs all dependencies bundled together

The builds cannot be merged into a single tool because they target fundamentally different JavaScript runtimes.

Standalone Testing (Without DVDT Integration)

You can test the ERD Generator without integrating it into DVDT:

  1. Build the project:

    npm run build
  2. Open the test page: Open packages/erd-generator/ui/test.html in your browser

  3. Enter credentials:

    • Environment URL: Your Dataverse environment (e.g., https://contoso.crm.dynamics.com)
    • Access Token: Your Dataverse access token
  4. Click "Load ERD Generator" to test the full functionality

The standalone test page simulates VS Code's WebView environment and allows you to:

  • List and select solutions
  • Generate ERDs in all formats
  • Test visual rendering (Mermaid)
  • Download diagrams
  • Copy to clipboard

Integration with Dataverse DevTools

VS Code WebView Panel Integration

Simple function call - no command registration needed:

import { showERDPanel } from 'dvdt-erd-generator';

// Call this when you want to show the ERD panel
showERDPanel(context.extensionUri, environmentUrl, accessToken);

Complete example:

import { showERDPanel } from 'dvdt-erd-generator';
import * as vscode from 'vscode';

// In your DVDT menu handler or button click
async function openERDGenerator() {
    try {
        const environmentUrl = dvdtConfig.getCurrentEnvironment();
        const accessToken = await dvdtAuth.getAccessToken();

        if (!environmentUrl || !accessToken) {
            vscode.window.showErrorMessage('Please connect to Dataverse first');
            return;
        }

        // Open ERD tool panel
        showERDPanel(context.extensionUri, environmentUrl, accessToken);
    } catch (error) {
        vscode.window.showErrorMessage(`Failed to open ERD Generator: ${error.message}`);
    }
}

That's it! The ERD tool will:

  • Open as a panel when called
  • List all solutions in a dropdown control
  • Allow users to select and generate ERDs
  • Handle downloading and copying
  • Provide a complete UI experience with configuration options

See ../../VSCODE_INTEGRATION.md for complete integration guide.

API

showERDPanel()

Opens the ERD Generator panel in VS Code.

Parameters:

  • extensionUri: vscode.Uri - VS Code extension URI from context
  • environmentUrl: string - Dataverse environment URL
  • accessToken: string - Dataverse access token

Example:

showERDPanel(context.extensionUri, environmentUrl, accessToken);

DataverseClient

Handles communication with Dataverse Web API.

Constructor:

new DataverseClient({
  environmentUrl: string,
  accessToken: string,
  apiVersion?: string  // Optional, defaults to '9.2'
})

Methods:

  • listSolutions(): Promise<Solution[]> - Lists all solutions
  • fetchSolution(uniqueName: string): Promise<DataverseSolution> - Fetches complete solution metadata

ERDGenerator

Generates ERD diagrams from solution metadata.

Constructor:

new ERDGenerator({
  format: 'mermaid' | 'plantuml' | 'graphviz',
  includeAttributes?: boolean,      // Default: true
  includeRelationships?: boolean,   // Default: true
  maxAttributesPerTable?: number    // Default: 10, 0 = all
})

Methods:

  • generate(solution: DataverseSolution): string - Generates ERD diagram

Architecture

The ERD tool is self-contained:

DVDT Extension
    ↓ (provides credentials)
ERD Tool WebView Panel
    ↓ (uses)
DataverseClient → Dataverse Web API
    ↓ (fetches metadata)
ERDGenerator → Generates diagrams

License

GPL-2.0