How crptbddst/typescriptwebresourcetemplate works
The project is a template designed for Dynamics 365 Customer Engagement (CE) webresource development using TypeScript. It is split into two main parts:
1. TSWebresourceTemplate – This directory houses the actual webresource code written in TypeScript. It contains source files for various components such as forms, ribbons, data models, constants, and services. The presence of multiple webpack configuration files (webpack.common.js, webpack.dev.js, webpack.prod.js) as well as ESLint and Prettier configuration files indicate that the template leverages modern front-end build pipelines. The “dist” folder contains the compiled JavaScript that will become the webresource.
2. spklSolution – This part of the project handles the Dynamics 365 packaging and deployment. It contains deployment scripts (e.g., deploy-webresources.bat, deploy-plugins.bat), configuration files like spkl.json, and references to Dynamics SDK tools (e.g., CrmSvcUtil.exe, SolutionPackager.exe). The inclusion of spkl packages points to an integration with the spkl framework, which manages Dynamics 365 solution creation, webresource deployment, and early-bound class generation.
A. Identify the Main Components:
• Webresource Development Module (TSWebresourceTemplate):
• Source Code Component: Contains folders for services, forms, ribbons, data models, and constants.
• Build and Deployment Configuration: Webpack configurations (webpack.common.js, webpack.dev.js, webpack.prod.js) along with TypeScript compiler (tsconfig.json) and linting (ESLint, Prettier).
• Build Artifacts: Precompiled files in the “dist” folder, notably the main output (WebresourceToName.js).
• Deployment / Packaging Module (spklSolution):
• Deployment Scripts: Batch files for deploying plugins, webresources, and workflows.
• Configuration: spkl.json defining solution-specific settings.
• Dynamics SDK Tools: External tools located in the “bin/coretools” (e.g., CrmSvcUtil.exe, SolutionPackager.exe).
• Integrated Packages: spkl packages and Microsoft.CrmSdk.CoreTools are referenced.
B. Define Relationships and Data Flow:
• Source Code Flow: Write code in TSWebresourceTemplate → Build using webpack → Output into “dist” folder.
• Deployment Flow: Use spklSolution scripts (e.g., deploy-webresources.bat) which pick up the compiled webresource files and deploy them into Dynamics 365 CE.
• Configuration/Authorization: The process includes authentication with Dynamics 365 (using “npx dataverse-auth”) and generating early-bound classes (“npx dataverse-gen init”), aligning the development with the target CRM environment.
C. Highlight Architectural Patterns/Design Principles:
• Separation of Concerns: Notice the clear division between development (TSWebresourceTemplate) and deployment (spklSolution).
• Build Pipeline Integration: A modern JavaScript/TypeScript build setup is implemented with webpack and TypeScript.
• External Tool Integration: spkl and Dynamics SDK tools provide an abstraction layer for packaging and deploying solutions into Dynamics 365.
D. Relevant Technologies & Frameworks:
• TypeScript for writing robust, strongly typed code.
• Webpack for bundling and asset management.
• ESLint and Prettier for code quality and formatting.
• Dynamics 365 CE as the target environment.
• spkl Framework and Microsoft.CrmSdk.CoreTools for solution packaging and deployment.
• The Deployment/Integration Side (spklSolution): Represent deployment scripts, spkl.json configuration, and the integration with Dynamics SDK Tools leading to the target Dynamics 365 environment.
• From the “Source Code Component” → “Build Process” → “Compiled Artifacts” → “Deployment Scripts in spklSolution”.
• A reverse feedback loop from the deployed Dynamics 365 environment back to the development cycle for future updates.
3. Use clear labels for each component:
• External services (Dynamics 365 CE, spkl tools).
5. To include integration points:
• Authentication and early-bound generation process (using tools like “dataverse-auth” and “dataverse-gen”) as part of the cycle, showing their connection between the development and deployment modules.
• Since this is not a typical full-stack web application but a Dynamics 365 webresource template, focus on:
• The toolchain and process from authoring to deployment.
• Separation between code development (with a modular structure in TSWebresourceTemplate) and the Dynamics solution packaging (spklSolution).
• The use of spkl and Dynamics SDK tools as crucial linking components.