A scaffolding tool for creating Dataverse client-side web resource projects with TypeScript, ESLint, Prettier, and Rollup.
npm install -g scaffold-dataverse-client-uinpx scaffold-dataverse-client-uiThe tool will prompt you for:
- Project name (must be lowercase with hyphens only)
- Package manager preference (npm, yarn, or pnpm) - if multiple are detected
The generated project includes:
- TypeScript - Type-safe JavaScript
- ESLint - Code linting with TypeScript support
- Prettier - Code formatting
- Rollup - Module bundler optimized for libraries
- @types/xrm - TypeScript definitions for Dynamics 365/Dataverse
your-project/
├── src/
│ ├── index.ts # Main entry point
│ └── EntityName/ # Entity-specific handlers
│ ├── index.ts
│ ├── OnLoad/ # Form OnLoad handlers
│ │ ├── index.ts
│ │ └── HandleSomethingOnLoad.ts
│ ├── OnChange/ # Field OnChange handlers
│ │ ├── index.ts
│ │ └── HandleFieldChange.ts
│ └── OnSave/ # Form OnSave handlers
│ ├── index.ts
│ └── HandleFormSave.ts
├── package.json
├── tsconfig.json
├── rollup.config.mjs
├── eslint.config.mjs
└── README.md # Comprehensive development guide
Each generated project includes:
- Example handlers for OnLoad, OnChange, and OnSave events
- Best practices guide with multiple export patterns
- TypeScript examples with proper type safety
- Error handling patterns and validation examples
- Dataverse Web API usage examples
- Debugging and deployment instructions
<package-manager> run build- Build the project<package-manager> run lint- Run ESLint<package-manager> run lint:fix- Fix ESLint issues<package-manager> run format- Format code with Prettier<package-manager> run format:check- Check formatting
Note: <package-manager> will be replaced with your chosen package manager (npm, yarn, or pnpm)
-
Create your project:
npx scaffold-dataverse-client-ui cd your-project-name -
Develop your web resource handlers in the
src/directory -
Build your project:
<package-manager> run build
-
The built files will be in the
dist/directory, ready to upload to Dataverse
Note: Replace <package-manager> with npm, yarn, or pnpm based on your selection
The template includes example handlers that you can customize:
// src/EntityName/OnLoad/HandleSomethingOnLoad.ts
export function handleSomethingOnLoad(context: Xrm.Events.EventContext): void {
const formContext = context.getFormContext();
const entityName = formContext.data.entity.getEntityName();
console.debug("handleSomethingOnLoad", `Entity Name: ${entityName}`);
}MIT