@khester/create-dynamics-app 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/bin/create-dynamics-app.js +1 -1
  2. package/dist/index.js +140 -15
  3. package/dist/index.js.map +1 -1
  4. package/dist/utils/consultingHelpers.d.ts +13 -0
  5. package/dist/utils/consultingHelpers.d.ts.map +1 -0
  6. package/dist/utils/consultingHelpers.js +569 -0
  7. package/dist/utils/consultingHelpers.js.map +1 -0
  8. package/dist/utils/copyTemplate.d.ts.map +1 -1
  9. package/dist/utils/copyTemplate.js.map +1 -1
  10. package/dist/utils/initGit.d.ts.map +1 -1
  11. package/dist/utils/initGit.js.map +1 -1
  12. package/dist/utils/installDependencies.d.ts.map +1 -1
  13. package/dist/utils/installDependencies.js +3 -2
  14. package/dist/utils/installDependencies.js.map +1 -1
  15. package/dist/utils/updatePackageJson.d.ts +1 -1
  16. package/dist/utils/updatePackageJson.d.ts.map +1 -1
  17. package/dist/utils/updatePackageJson.js +11 -1
  18. package/dist/utils/updatePackageJson.js.map +1 -1
  19. package/package.json +1 -1
  20. package/templates/dynamics-365-starter/INTEGRATION_TEST_RESULTS.md +302 -0
  21. package/templates/dynamics-365-starter/PHASE_4_COMPLETION_SUMMARY.md +305 -0
  22. package/templates/dynamics-365-starter/README.md +566 -137
  23. package/templates/dynamics-365-starter/deployment/QUICKSTART-MAC.md +507 -0
  24. package/templates/dynamics-365-starter/deployment/QUICKSTART-WINDOWS.md +372 -0
  25. package/templates/dynamics-365-starter/deployment/README.md +484 -0
  26. package/templates/dynamics-365-starter/deployment/pipelines/README.md +375 -0
  27. package/templates/dynamics-365-starter/deployment/pipelines/azure-pipelines.yml +330 -0
  28. package/templates/dynamics-365-starter/deployment/pipelines/github-actions.yml +422 -0
  29. package/templates/dynamics-365-starter/deployment/pipelines/jenkins.groovy +636 -0
  30. package/templates/dynamics-365-starter/deployment/scripts/deploy.ps1 +417 -0
  31. package/templates/dynamics-365-starter/deployment/scripts/deploy.sh +582 -0
  32. package/templates/dynamics-365-starter/deployment/scripts/team-onboarding.ps1 +486 -0
  33. package/templates/dynamics-365-starter/deployment/scripts/team-onboarding.sh +567 -0
  34. package/templates/dynamics-365-starter/deployment/scripts/validate-setup.ps1 +703 -0
  35. package/templates/dynamics-365-starter/deployment/scripts/validate-setup.sh +671 -0
  36. package/templates/dynamics-365-starter/docs/ARCHITECTURE_OVERVIEW.md +506 -0
  37. package/templates/dynamics-365-starter/docs/BEST_PRACTICES.md +723 -0
  38. package/templates/dynamics-365-starter/docs/MIGRATION_GUIDE.md +447 -0
  39. package/templates/dynamics-365-starter/docs/team-standards/README.md +273 -0
  40. package/templates/dynamics-365-starter/docs/team-standards/client-onboarding.md +577 -0
  41. package/templates/dynamics-365-starter/docs/team-standards/code-review-checklist.md +359 -0
  42. package/templates/dynamics-365-starter/docs/team-standards/coding-standards.md +700 -0
  43. package/templates/dynamics-365-starter/docs/team-standards/cross-platform-team-guide.md +736 -0
  44. package/templates/dynamics-365-starter/docs/team-standards/development-workflows.md +727 -0
  45. package/templates/dynamics-365-starter/docs/troubleshooting/common-errors.md +758 -0
  46. package/templates/dynamics-365-starter/docs/troubleshooting/platform-specific-issues.md +878 -0
  47. package/templates/dynamics-365-starter/package.json +22 -1
  48. package/templates/dynamics-365-starter/public/index.html +8 -11
  49. package/templates/dynamics-365-starter/scripts/custom-build.js +255 -0
  50. package/templates/dynamics-365-starter/src/client-project-template/README.md +234 -0
  51. package/templates/dynamics-365-starter/src/client-project-template/config/client.template.json +114 -0
  52. package/templates/dynamics-365-starter/src/client-project-template/config/environments/template.json +186 -0
  53. package/templates/dynamics-365-starter/src/client-project-template/scripts/client-setup.js +667 -0
  54. package/templates/dynamics-365-starter/src/components/AccountForm.css +71 -0
  55. package/templates/dynamics-365-starter/src/components/AccountForm.tsx +541 -0
  56. package/templates/dynamics-365-starter/src/components/AccountManagement.css +86 -0
  57. package/templates/dynamics-365-starter/src/components/AccountManagement.tsx +370 -0
  58. package/templates/dynamics-365-starter/src/components/ContactForm.tsx +149 -63
  59. package/templates/dynamics-365-starter/src/components/ContactManagement.tsx +153 -63
  60. package/templates/dynamics-365-starter/src/components/Logging/LogDialog.tsx +291 -0
  61. package/templates/dynamics-365-starter/src/components/Logging/LoggingContext.tsx +166 -0
  62. package/templates/dynamics-365-starter/src/components/Logging/LoggingDebugPanel.css +192 -0
  63. package/templates/dynamics-365-starter/src/components/Logging/LoggingDebugPanel.tsx +177 -0
  64. package/templates/dynamics-365-starter/src/components/Logging/LoggingProvider.tsx +3 -0
  65. package/templates/dynamics-365-starter/src/components/Logging/logger.ts +193 -0
  66. package/templates/dynamics-365-starter/src/constants/account.ts +410 -0
  67. package/templates/dynamics-365-starter/src/constants/contact.ts +362 -0
  68. package/templates/dynamics-365-starter/src/examples/README.md +52 -0
  69. package/templates/dynamics-365-starter/src/examples/component-examples/opportunity-management.tsx +625 -0
  70. package/templates/dynamics-365-starter/src/examples/entity-examples/opportunity-model.ts +545 -0
  71. package/templates/dynamics-365-starter/src/examples/integration-examples/custom-pcf-wrapper.tsx +722 -0
  72. package/templates/dynamics-365-starter/src/examples/workflow-examples/sales-workflow.ts +662 -0
  73. package/templates/dynamics-365-starter/src/index.tsx +107 -19
  74. package/templates/dynamics-365-starter/src/models/Account.ts +480 -0
  75. package/templates/dynamics-365-starter/src/models/BaseEntity.ts +204 -0
  76. package/templates/dynamics-365-starter/src/models/Contact.ts +580 -0
  77. package/templates/dynamics-365-starter/src/page-templates/EntityDashboard.tsx +519 -0
  78. package/templates/dynamics-365-starter/src/page-templates/EntityDetailPage.tsx +456 -0
  79. package/templates/dynamics-365-starter/src/page-templates/EntityListPage.tsx +406 -0
  80. package/templates/dynamics-365-starter/src/page-templates/RelatedEntitiesPage.tsx +578 -0
  81. package/templates/dynamics-365-starter/src/page-templates/SearchPage.tsx +629 -0
  82. package/templates/dynamics-365-starter/src/pcf/ContactControlWrapper.tsx +75 -22
  83. package/templates/dynamics-365-starter/src/pcf/MultiEntityControlWrapper.tsx +205 -0
  84. package/templates/dynamics-365-starter/src/providers/DynamicsProvider.tsx +297 -80
  85. package/templates/dynamics-365-starter/src/services/MockApiService.ts +260 -0
  86. package/templates/dynamics-365-starter/src/services/ServiceFactory.ts +65 -0
  87. package/templates/dynamics-365-starter/src/services/XrmApiService.ts +213 -0
  88. package/templates/dynamics-365-starter/src/styles/index.css +74 -7
  89. package/templates/dynamics-365-starter/tools/entity-generator/index.js +168 -0
  90. package/templates/dynamics-365-starter/tools/entity-generator/templates/constants.template.ts +124 -0
  91. package/templates/dynamics-365-starter/tools/entity-generator/templates/form.template.css +283 -0
  92. package/templates/dynamics-365-starter/tools/entity-generator/templates/form.template.tsx +275 -0
  93. package/templates/dynamics-365-starter/tools/entity-generator/templates/management.template.css +204 -0
  94. package/templates/dynamics-365-starter/tools/entity-generator/templates/management.template.tsx +413 -0
  95. package/templates/dynamics-365-starter/tools/entity-generator/templates/model.template.ts +250 -0
  96. package/templates/dynamics-365-starter/tools/metadata-sync/d365-client.js +410 -0
  97. package/templates/dynamics-365-starter/tools/metadata-sync/index.js +512 -0
  98. package/templates/dynamics-365-starter/tools/metadata-sync/type-generator.js +675 -0
  99. package/templates/dynamics-365-starter/tsconfig.json +11 -8
  100. package/templates/dynamics-365-starter/webpack.config.js +8 -9
  101. package/templates/power-pages-starter/README.md +7 -1
  102. package/templates/power-pages-starter/public/index.html +8 -11
  103. package/templates/power-pages-starter/src/components/ContactForm.tsx +60 -41
  104. package/templates/power-pages-starter/src/index.tsx +3 -3
  105. package/templates/power-pages-starter/src/providers/PowerPagesProvider.tsx +46 -23
  106. package/templates/power-pages-starter/tsconfig.json +3 -9
  107. package/templates/power-pages-starter/webpack.config.js +8 -3
@@ -0,0 +1,375 @@
1
+ # CI/CD Pipelines - Cross-Platform Team Support
2
+
3
+ This directory contains CI/CD pipeline configurations that support mixed Windows/Mac development
4
+ teams working on Dynamics 365 projects.
5
+
6
+ ## Overview
7
+
8
+ The pipeline configurations demonstrate how to create robust, cross-platform CI/CD workflows that
9
+ allow Windows and Mac developers to work seamlessly on the same project while using their preferred
10
+ platform and tooling.
11
+
12
+ ## Pipeline Files
13
+
14
+ ### 🔷 Azure DevOps Pipeline
15
+
16
+ **File**: `azure-pipelines.yml`
17
+
18
+ - **Build**: Linux agent (ubuntu-latest) for optimal performance
19
+ - **Dev Deploy**: Linux + Bash scripts (Mac developer experience)
20
+ - **Test Deploy**: Windows + PowerShell scripts (enterprise validation)
21
+ - **Prod Deploy**: Linux + Bash scripts (production stability)
22
+
23
+ ```yaml
24
+ # Example stage configuration
25
+ - stage: DeployDev
26
+ jobs:
27
+ - deployment: DeployToDev
28
+ pool:
29
+ vmImage: 'ubuntu-latest' # Linux for Bash scripts
30
+ strategy:
31
+ runOnce:
32
+ deploy:
33
+ steps:
34
+ - bash: ./deployment/scripts/deploy.sh dev --verbose
35
+ ```
36
+
37
+ ### 🟢 GitHub Actions Workflow
38
+
39
+ **File**: `github-actions.yml`
40
+
41
+ - **Build**: Ubuntu runner for speed and consistency
42
+ - **Dev Deploy**: Ubuntu + Bash (Mac compatibility)
43
+ - **Test Deploy**: Windows + PowerShell (Windows compatibility)
44
+ - **Prod Deploy**: Flexible platform choice via workflow dispatch
45
+
46
+ ```yaml
47
+ # Example job configuration
48
+ deploy-dev:
49
+ runs-on: ubuntu-latest # Linux for Bash scripts
50
+ steps:
51
+ - name: Deploy to Development
52
+ run: ./deployment/scripts/deploy.sh dev --verbose
53
+ ```
54
+
55
+ ### 🔵 Jenkins Pipeline
56
+
57
+ **File**: `jenkins.groovy`
58
+
59
+ - **Build**: Linux agents for optimal build performance
60
+ - **Dev Deploy**: Linux + Bash scripts
61
+ - **Test Deploy**: Windows + PowerShell scripts
62
+ - **Prod Deploy**: Manual platform selection with approval gates
63
+
64
+ ```groovy
65
+ // Example stage configuration
66
+ stage('Deploy to Development') {
67
+ agent { label 'linux && docker' }
68
+ steps {
69
+ sh './deployment/scripts/deploy.sh dev --verbose'
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Cross-Platform Strategy
75
+
76
+ ### 🎯 Design Principles
77
+
78
+ 1. **Platform Optimization**: Use the best platform for each stage
79
+ - **Linux**: Build performance, Mac developer experience
80
+ - **Windows**: Enterprise PowerShell workflows, Windows compatibility
81
+
82
+ 2. **Team Compatibility**: Support both development environments
83
+ - **Windows Developers**: PowerShell scripts locally + Windows CI/CD stages
84
+ - **Mac Developers**: Bash scripts locally + Linux CI/CD stages
85
+
86
+ 3. **Deployment Consistency**: Identical results regardless of platform
87
+ - Same build artifacts
88
+ - Same configuration files
89
+ - Same deployment outcomes
90
+
91
+ ### 📋 Platform Selection Matrix
92
+
93
+ | Stage | Platform | Script Type | Rationale |
94
+ | --------------- | -------- | ----------------- | -------------------------------------------------- |
95
+ | **Build** | Linux | npm/Node.js | Fastest performance, consistent environment |
96
+ | **Dev Deploy** | Linux | Bash (.sh) | Mac developer local experience |
97
+ | **Test Deploy** | Windows | PowerShell (.ps1) | Enterprise validation, Windows workflows |
98
+ | **Prod Deploy** | Flexible | User choice | Allows team preference or environment requirements |
99
+
100
+ ## Team Member Experience
101
+
102
+ ### 🖥️ Windows Developers
103
+
104
+ **Local Development**:
105
+
106
+ ```powershell
107
+ # Use PowerShell scripts locally
108
+ .\deployment\scripts\deploy.ps1 -Environment dev
109
+ .\deployment\scripts\health-check.ps1 -Environment dev
110
+
111
+ # Follow Windows-specific guide
112
+ Get-Content deployment\QUICKSTART-WINDOWS.md
113
+
114
+ # Run team onboarding
115
+ .\deployment\scripts\team-onboarding.ps1
116
+ ```
117
+
118
+ **CI/CD Experience**:
119
+
120
+ - Build stage runs on Linux (faster)
121
+ - Test deployment uses Windows runners with PowerShell
122
+ - Production deployment can use Windows if preferred
123
+ - All pipeline results match local PowerShell deployment results
124
+
125
+ ### 🍎 Mac Developers
126
+
127
+ **Local Development**:
128
+
129
+ ```bash
130
+ # Use Bash scripts locally
131
+ ./deployment/scripts/deploy.sh dev
132
+ ./deployment/scripts/health-check.sh dev
133
+
134
+ # Follow Mac-specific guide
135
+ open deployment/QUICKSTART-MAC.md
136
+
137
+ # Run team onboarding
138
+ ./deployment/scripts/team-onboarding.sh
139
+ ```
140
+
141
+ **CI/CD Experience**:
142
+
143
+ - Build stage runs on Linux (compatible)
144
+ - Development deployment uses Linux runners with Bash
145
+ - Production deployment uses Linux by default
146
+ - All pipeline results match local Bash deployment results
147
+
148
+ ## Configuration Examples
149
+
150
+ ### Azure DevOps Variable Groups
151
+
152
+ Create these variable groups in Azure DevOps:
153
+
154
+ ```yaml
155
+ # dynamics-365-dev-secrets
156
+ D365_DEV_CLIENT_ID: 'your-dev-client-id'
157
+ D365_DEV_CLIENT_SECRET: 'your-dev-client-secret'
158
+ D365_DEV_TENANT_ID: 'your-dev-tenant-id'
159
+ D365_DEV_ORG_URL: 'https://yourdev.crm.dynamics.com'
160
+
161
+ # dynamics-365-test-secrets
162
+ D365_TEST_CLIENT_ID: 'your-test-client-id'
163
+ D365_TEST_CLIENT_SECRET: 'your-test-client-secret'
164
+ D365_TEST_TENANT_ID: 'your-test-tenant-id'
165
+ D365_TEST_ORG_URL: 'https://yourtest.crm.dynamics.com'
166
+ ```
167
+
168
+ ### GitHub Actions Secrets
169
+
170
+ Add these secrets to your GitHub repository:
171
+
172
+ ```yaml
173
+ # Development environment
174
+ D365_DEV_CLIENT_ID
175
+ D365_DEV_CLIENT_SECRET
176
+ D365_DEV_TENANT_ID
177
+
178
+ # Test environment
179
+ D365_TEST_CLIENT_ID
180
+ D365_TEST_CLIENT_SECRET
181
+ D365_TEST_TENANT_ID
182
+
183
+ # Production environment
184
+ D365_PROD_CLIENT_ID
185
+ D365_PROD_CLIENT_SECRET
186
+ D365_PROD_TENANT_ID
187
+ ```
188
+
189
+ ### Jenkins Credentials
190
+
191
+ Create these credential entries in Jenkins:
192
+
193
+ ```groovy
194
+ // Username/Password credentials
195
+ d365-dev-credentials: [username: client-id, password: client-secret]
196
+ d365-test-credentials: [username: client-id, password: client-secret]
197
+ d365-prod-credentials: [username: client-id, password: client-secret]
198
+ ```
199
+
200
+ ## Platform-Specific Features
201
+
202
+ ### Azure DevOps Highlights
203
+
204
+ - **Mixed Agents**: Linux for builds, Windows for PowerShell validation
205
+ - **Variable Groups**: Centralized secret management
206
+ - **Environment Gates**: Manual approvals for production
207
+ - **Cross-Platform Validation**: Parallel validation on both platforms
208
+
209
+ ### GitHub Actions Highlights
210
+
211
+ - **Workflow Dispatch**: Manual triggers with platform selection
212
+ - **Matrix Builds**: Cross-platform validation in pull requests
213
+ - **Environment Protection**: Branch protection and approval workflows
214
+ - **Platform Detection**: Automatic runner selection based on strategy
215
+
216
+ ### Jenkins Highlights
217
+
218
+ - **Agent Labels**: Flexible agent selection (linux, windows, docker)
219
+ - **Manual Approval**: Production deployment approval with platform choice
220
+ - **Parallel Validation**: Cross-platform validation stages
221
+ - **Artifact Management**: Centralized build artifact sharing
222
+
223
+ ## Troubleshooting Cross-Platform Issues
224
+
225
+ ### Common Platform-Specific Problems
226
+
227
+ #### Windows PowerShell Issues
228
+
229
+ ```powershell
230
+ # Module installation problems
231
+ Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber -Scope CurrentUser
232
+
233
+ # Execution policy issues
234
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
235
+
236
+ # Path separator issues (use either)
237
+ .\deployment\scripts\deploy.ps1 # Windows style
238
+ ./deployment/scripts/deploy.ps1 # Cross-platform style
239
+ ```
240
+
241
+ #### Linux/Mac Bash Issues
242
+
243
+ ```bash
244
+ # Script permissions
245
+ chmod +x deployment/scripts/*.sh
246
+
247
+ # Missing dependencies
248
+ # Ubuntu/Debian:
249
+ sudo apt-get install jq curl nodejs npm
250
+
251
+ # macOS:
252
+ brew install jq curl node npm
253
+
254
+ # Path issues (always use forward slashes)
255
+ ./deployment/scripts/deploy.sh
256
+ ```
257
+
258
+ ### Pipeline-Specific Debugging
259
+
260
+ #### Azure DevOps
261
+
262
+ ```yaml
263
+ # Enable verbose logging
264
+ - bash: ./deployment/scripts/deploy.sh dev --verbose
265
+ displayName: 'Deploy with verbose output'
266
+
267
+ # Platform detection
268
+ - bash: |
269
+ echo "Runner OS: $(Agent.OS)"
270
+ echo "Agent Name: $(Agent.Name)"
271
+ uname -a
272
+ displayName: 'Show platform information'
273
+ ```
274
+
275
+ #### GitHub Actions
276
+
277
+ ```yaml
278
+ # Debug runner environment
279
+ - name: Debug Platform
280
+ run: |
281
+ echo "Runner OS: ${{ runner.os }}"
282
+ echo "Runner Name: ${{ runner.name }}"
283
+ uname -a || systeminfo
284
+ ```
285
+
286
+ #### Jenkins
287
+
288
+ ```groovy
289
+ // Debug agent information
290
+ sh '''
291
+ echo "Node Name: ${NODE_NAME}"
292
+ echo "Agent OS: $(uname -a || systeminfo)"
293
+ echo "Available Scripts:"
294
+ ls -la deployment/scripts/ || dir deployment\\scripts\\
295
+ '''
296
+ ```
297
+
298
+ ## Best Practices
299
+
300
+ ### 1. Script Compatibility
301
+
302
+ - ✅ Maintain parallel PowerShell (.ps1) and Bash (.sh) scripts
303
+ - ✅ Use identical command-line interfaces where possible
304
+ - ✅ Share JSON configuration files between platforms
305
+ - ✅ Test both script types produce identical results
306
+
307
+ ### 2. Pipeline Strategy
308
+
309
+ - ✅ Use Linux for build performance
310
+ - ✅ Use Windows for PowerShell module testing
311
+ - ✅ Provide platform choice for production deployments
312
+ - ✅ Include cross-platform validation for pull requests
313
+
314
+ ### 3. Team Onboarding
315
+
316
+ - ✅ Provide platform-specific quick start guides
317
+ - ✅ Include team onboarding scripts for both platforms
318
+ - ✅ Document command equivalents in team documentation
319
+ - ✅ Set up platform-specific development environments
320
+
321
+ ### 4. Error Handling
322
+
323
+ - ✅ Include platform detection in error messages
324
+ - ✅ Provide platform-specific troubleshooting steps
325
+ - ✅ Log platform information in deployment logs
326
+ - ✅ Include rollback procedures for both platforms
327
+
328
+ ## Command Equivalents Reference
329
+
330
+ | Task | Windows PowerShell | Mac/Linux Bash | Result |
331
+ | ------------------- | --------------------------------------------------------- | ---------------------------------- | ----------------------- |
332
+ | **Deploy to Dev** | `.\deploy.ps1 -Environment dev` | `./deploy.sh dev` | Identical deployment |
333
+ | **Health Check** | `.\health-check.ps1 -Environment prod` | `./health-check.sh prod` | Same validation |
334
+ | **Rollback** | `.\rollback.ps1 -Environment prod -BackupFile backup.zip` | `./rollback.sh prod backup.tar.gz` | Same rollback |
335
+ | **Team Onboarding** | `.\team-onboarding.ps1` | `./team-onboarding.sh` | Platform-specific setup |
336
+
337
+ ## Getting Started
338
+
339
+ ### For New Projects
340
+
341
+ 1. **Choose Your Pipeline**: Select Azure DevOps, GitHub Actions, or Jenkins
342
+ 2. **Copy Configuration**: Use the appropriate pipeline file as a starting point
343
+ 3. **Configure Secrets**: Set up environment-specific credentials
344
+ 4. **Test Cross-Platform**: Run validation on both Windows and Linux agents
345
+ 5. **Document Team Process**: Share platform-specific guides with your team
346
+
347
+ ### For Existing Projects
348
+
349
+ 1. **Assess Current Setup**: Determine current platform dependencies
350
+ 2. **Create Parallel Scripts**: Add missing PowerShell or Bash scripts
351
+ 3. **Update Pipeline**: Modify existing pipeline for cross-platform support
352
+ 4. **Validate Compatibility**: Test deployment results across platforms
353
+ 5. **Train Team**: Provide platform-specific training and documentation
354
+
355
+ ## Support and Troubleshooting
356
+
357
+ ### Documentation Resources
358
+
359
+ - **Windows Setup**: `../QUICKSTART-WINDOWS.md`
360
+ - **Mac Setup**: `../QUICKSTART-MAC.md`
361
+ - **Deployment Guide**: `../README.md`
362
+ - **Team Standards**: `../../docs/team-standards/`
363
+
364
+ ### Getting Help
365
+
366
+ - Check platform-specific logs in `../logs/`
367
+ - Review deployment scripts in `../scripts/`
368
+ - Consult team onboarding scripts for environment setup
369
+ - Contact DevOps team with platform and error details
370
+
371
+ ---
372
+
373
+ This cross-platform CI/CD approach ensures that Windows and Mac developers can work together
374
+ seamlessly while leveraging the strengths of each platform for optimal build and deployment
375
+ performance.
@@ -0,0 +1,330 @@
1
+ # Azure DevOps Pipeline - Dual Platform Support
2
+ # Supports both Windows and Linux agents for mixed development teams
3
+
4
+ trigger:
5
+ branches:
6
+ include:
7
+ - main
8
+ - develop
9
+ - feature/*
10
+ paths:
11
+ exclude:
12
+ - docs/*
13
+ - "*.md"
14
+
15
+ pr:
16
+ branches:
17
+ include:
18
+ - main
19
+ - develop
20
+
21
+ variables:
22
+ - group: dynamics-365-variables # Variable group with environment configs
23
+ - name: node.version
24
+ value: "18.x"
25
+ - name: npm.cache
26
+ value: $(Pipeline.Workspace)/.npm
27
+
28
+ stages:
29
+ # Build Stage - Run on Linux for faster execution
30
+ - stage: Build
31
+ displayName: "Build Application"
32
+ jobs:
33
+ - job: BuildJob
34
+ displayName: "Build and Test"
35
+ pool:
36
+ vmImage: "ubuntu-latest" # Linux agent for faster builds
37
+ steps:
38
+ - task: NodeTool@0
39
+ displayName: "Install Node.js"
40
+ inputs:
41
+ versionSpec: $(node.version)
42
+
43
+ - task: Cache@2
44
+ displayName: "Cache npm dependencies"
45
+ inputs:
46
+ key: 'npm | "$(Agent.OS)" | package-lock.json'
47
+ restoreKeys: |
48
+ npm | "$(Agent.OS)"
49
+ path: $(npm.cache)
50
+
51
+ - script: |
52
+ npm config set cache $(npm.cache)
53
+ npm ci
54
+ displayName: "Install dependencies"
55
+
56
+ - script: npm run lint
57
+ displayName: "Run linting"
58
+
59
+ - script: npm run typecheck
60
+ displayName: "TypeScript validation"
61
+
62
+ - script: npm run test
63
+ displayName: "Run unit tests"
64
+
65
+ - script: npm run build:prod
66
+ displayName: "Build production bundle"
67
+
68
+ - task: PublishTestResults@2
69
+ displayName: "Publish test results"
70
+ inputs:
71
+ testResultsFormat: "JUnit"
72
+ testResultsFiles: "test-results.xml"
73
+ mergeTestResults: true
74
+ condition: succeededOrFailed()
75
+
76
+ - task: PublishCodeCoverageResults@1
77
+ displayName: "Publish code coverage"
78
+ inputs:
79
+ codeCoverageTool: "Cobertura"
80
+ summaryFileLocation: "coverage/cobertura-coverage.xml"
81
+ reportDirectory: "coverage"
82
+ condition: succeededOrFailed()
83
+
84
+ - task: PublishBuildArtifacts@1
85
+ displayName: "Publish build artifacts"
86
+ inputs:
87
+ PathtoPublish: "dist"
88
+ ArtifactName: "build-artifacts"
89
+
90
+ - task: PublishBuildArtifacts@1
91
+ displayName: "Publish deployment scripts"
92
+ inputs:
93
+ PathtoPublish: "deployment"
94
+ ArtifactName: "deployment-scripts"
95
+
96
+ # Development Deployment - Linux Agent with Bash
97
+ - stage: DeployDev
98
+ displayName: "Deploy to Development"
99
+ dependsOn: Build
100
+ condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
101
+ jobs:
102
+ - deployment: DeployToDev
103
+ displayName: "Deploy to Development Environment"
104
+ pool:
105
+ vmImage: "ubuntu-latest" # Linux agent for Bash scripts
106
+ environment: "Dynamics365-Dev"
107
+ variables:
108
+ - group: dynamics-365-dev-secrets
109
+ strategy:
110
+ runOnce:
111
+ deploy:
112
+ steps:
113
+ - download: current
114
+ artifact: build-artifacts
115
+ displayName: "Download build artifacts"
116
+
117
+ - download: current
118
+ artifact: deployment-scripts
119
+ displayName: "Download deployment scripts"
120
+
121
+ - task: CopyFiles@2
122
+ displayName: "Copy build artifacts"
123
+ inputs:
124
+ SourceFolder: "$(Pipeline.Workspace)/build-artifacts"
125
+ TargetFolder: "$(System.DefaultWorkingDirectory)/dist"
126
+
127
+ - task: CopyFiles@2
128
+ displayName: "Copy deployment scripts"
129
+ inputs:
130
+ SourceFolder: "$(Pipeline.Workspace)/deployment-scripts"
131
+ TargetFolder: "$(System.DefaultWorkingDirectory)/deployment"
132
+
133
+ - bash: |
134
+ # Make scripts executable
135
+ chmod +x deployment/scripts/*.sh
136
+
137
+ # Set up environment variables from Azure DevOps variable group
138
+ export D365_CLIENT_ID="$(D365_DEV_CLIENT_ID)"
139
+ export D365_CLIENT_SECRET="$(D365_DEV_CLIENT_SECRET)"
140
+ export D365_TENANT_ID="$(D365_DEV_TENANT_ID)"
141
+ export D365_ORG_URL="$(D365_DEV_ORG_URL)"
142
+
143
+ # Run deployment using Bash script
144
+ ./deployment/scripts/deploy.sh dev --verbose
145
+ displayName: "Deploy to Development (Bash)"
146
+ env:
147
+ D365_DEV_CLIENT_ID: $(D365_DEV_CLIENT_ID)
148
+ D365_DEV_CLIENT_SECRET: $(D365_DEV_CLIENT_SECRET)
149
+ D365_DEV_TENANT_ID: $(D365_DEV_TENANT_ID)
150
+ D365_DEV_ORG_URL: $(D365_DEV_ORG_URL)
151
+
152
+ # Test Deployment - Windows Agent with PowerShell
153
+ - stage: DeployTest
154
+ displayName: "Deploy to Test"
155
+ dependsOn: Build
156
+ condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
157
+ jobs:
158
+ - deployment: DeployToTest
159
+ displayName: "Deploy to Test Environment"
160
+ pool:
161
+ vmImage: "windows-latest" # Windows agent for PowerShell scripts
162
+ environment: "Dynamics365-Test"
163
+ variables:
164
+ - group: dynamics-365-test-secrets
165
+ strategy:
166
+ runOnce:
167
+ deploy:
168
+ steps:
169
+ - download: current
170
+ artifact: build-artifacts
171
+ displayName: "Download build artifacts"
172
+
173
+ - download: current
174
+ artifact: deployment-scripts
175
+ displayName: "Download deployment scripts"
176
+
177
+ - task: CopyFiles@2
178
+ displayName: "Copy build artifacts"
179
+ inputs:
180
+ SourceFolder: "$(Pipeline.Workspace)/build-artifacts"
181
+ TargetFolder: "$(System.DefaultWorkingDirectory)/dist"
182
+
183
+ - task: CopyFiles@2
184
+ displayName: "Copy deployment scripts"
185
+ inputs:
186
+ SourceFolder: "$(Pipeline.Workspace)/deployment-scripts"
187
+ TargetFolder: "$(System.DefaultWorkingDirectory)/deployment"
188
+
189
+ - task: PowerShell@2
190
+ displayName: "Install PowerShell modules"
191
+ inputs:
192
+ targetType: "inline"
193
+ script: |
194
+ Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber
195
+ Install-Module -Name Microsoft.PowerApps.PowerShell -Force -AllowClobber
196
+
197
+ - task: PowerShell@2
198
+ displayName: "Deploy to Test (PowerShell)"
199
+ inputs:
200
+ filePath: "$(System.DefaultWorkingDirectory)/deployment/scripts/deploy.ps1"
201
+ arguments: "-Environment test -Verbose"
202
+ env:
203
+ D365_TEST_CLIENT_ID: $(D365_TEST_CLIENT_ID)
204
+ D365_TEST_CLIENT_SECRET: $(D365_TEST_CLIENT_SECRET)
205
+ D365_TEST_TENANT_ID: $(D365_TEST_TENANT_ID)
206
+ D365_TEST_ORG_URL: $(D365_TEST_ORG_URL)
207
+
208
+ # Production Deployment - Support both platforms with approval gates
209
+ - stage: DeployProd
210
+ displayName: "Deploy to Production"
211
+ dependsOn: [DeployTest]
212
+ condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
213
+ jobs:
214
+ - deployment: DeployToProd
215
+ displayName: "Deploy to Production Environment"
216
+ pool:
217
+ # Allow either Windows or Linux agents based on availability
218
+ vmImage: "ubuntu-latest" # Default to Linux for consistency
219
+ environment: "Dynamics365-Production"
220
+ variables:
221
+ - group: dynamics-365-prod-secrets
222
+ strategy:
223
+ runOnce:
224
+ deploy:
225
+ steps:
226
+ - download: current
227
+ artifact: build-artifacts
228
+ displayName: "Download build artifacts"
229
+
230
+ - download: current
231
+ artifact: deployment-scripts
232
+ displayName: "Download deployment scripts"
233
+
234
+ - task: CopyFiles@2
235
+ displayName: "Copy build artifacts"
236
+ inputs:
237
+ SourceFolder: "$(Pipeline.Workspace)/build-artifacts"
238
+ TargetFolder: "$(System.DefaultWorkingDirectory)/dist"
239
+
240
+ - task: CopyFiles@2
241
+ displayName: "Copy deployment scripts"
242
+ inputs:
243
+ SourceFolder: "$(Pipeline.Workspace)/deployment-scripts"
244
+ TargetFolder: "$(System.DefaultWorkingDirectory)/deployment"
245
+
246
+ # Production deployment with enhanced validation
247
+ - bash: |
248
+ # Make scripts executable
249
+ chmod +x deployment/scripts/*.sh
250
+
251
+ # Set up environment variables
252
+ export D365_CLIENT_ID="$(D365_PROD_CLIENT_ID)"
253
+ export D365_CLIENT_SECRET="$(D365_PROD_CLIENT_SECRET)"
254
+ export D365_TENANT_ID="$(D365_PROD_TENANT_ID)"
255
+ export D365_ORG_URL="$(D365_PROD_ORG_URL)"
256
+
257
+ echo "Starting production deployment..."
258
+
259
+ # Run pre-deployment validation
260
+ ./deployment/scripts/validate-setup.sh
261
+
262
+ # Create backup before deployment
263
+ ./deployment/scripts/backup.sh prod
264
+
265
+ # Deploy with backup enabled
266
+ ./deployment/scripts/deploy.sh prod --verbose
267
+
268
+ # Post-deployment health check
269
+ ./deployment/scripts/health-check.sh prod
270
+
271
+ echo "Production deployment completed successfully"
272
+ displayName: "Deploy to Production with Validation"
273
+ env:
274
+ D365_PROD_CLIENT_ID: $(D365_PROD_CLIENT_ID)
275
+ D365_PROD_CLIENT_SECRET: $(D365_PROD_CLIENT_SECRET)
276
+ D365_PROD_TENANT_ID: $(D365_PROD_TENANT_ID)
277
+ D365_PROD_ORG_URL: $(D365_PROD_ORG_URL)
278
+
279
+ # Rollback capability
280
+ - bash: |
281
+ echo "##vso[task.setvariable variable=BACKUP_FILE;isOutput=true]$(ls deployment/backups/backup-prod-*.tar.gz | tail -n1)"
282
+ displayName: "Set backup file variable"
283
+ name: backupInfo
284
+ condition: succeededOrFailed()
285
+
286
+ # Cross-Platform Development Support Documentation
287
+ - stage: Documentation
288
+ displayName: "Platform Compatibility Info"
289
+ dependsOn: Build
290
+ condition: always()
291
+ jobs:
292
+ - job: PlatformInfo
293
+ displayName: "Cross-Platform Development Information"
294
+ pool:
295
+ vmImage: "ubuntu-latest"
296
+ steps:
297
+ - script: |
298
+ echo "=== CROSS-PLATFORM DEVELOPMENT TEAM SUPPORT ==="
299
+ echo ""
300
+ echo "This pipeline supports mixed Windows/Mac development teams:"
301
+ echo ""
302
+ echo "🖥️ WINDOWS DEVELOPERS:"
303
+ echo " • Use PowerShell scripts: deployment/scripts/*.ps1"
304
+ echo " • Follow guide: deployment/QUICKSTART-WINDOWS.md"
305
+ echo " • Run: deployment/scripts/team-onboarding.ps1"
306
+ echo ""
307
+ echo "🍎 MAC/LINUX DEVELOPERS:"
308
+ echo " • Use Bash scripts: deployment/scripts/*.sh"
309
+ echo " • Follow guide: deployment/QUICKSTART-MAC.md"
310
+ echo " • Run: deployment/scripts/team-onboarding.sh"
311
+ echo ""
312
+ echo "✅ COMPATIBILITY GUARANTEE:"
313
+ echo " • Same deployment results across all platforms"
314
+ echo " • Shared JSON configuration files"
315
+ echo " • Identical entity generation and builds"
316
+ echo " • Compatible log formats for troubleshooting"
317
+ echo ""
318
+ echo "🔧 PIPELINE STRATEGY:"
319
+ echo " • Build: Linux agent (faster performance)"
320
+ echo " • Dev Deploy: Linux + Bash (developer testing)"
321
+ echo " • Test Deploy: Windows + PowerShell (integration testing)"
322
+ echo " • Prod Deploy: Linux + Bash (production stability)"
323
+ echo ""
324
+ echo "Command Equivalents:"
325
+ echo "Windows: .\\deploy.ps1 -Environment dev"
326
+ echo "Mac: ./deploy.sh dev"
327
+ echo "Result: Identical deployment to D365"
328
+ echo ""
329
+ echo "=== END PLATFORM INFO ==="
330
+ displayName: "Show Platform Compatibility Information"