@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,486 @@
1
+ # Team Onboarding Script with Platform Detection (PowerShell)
2
+ # Automatically detects platform and guides developer through setup
3
+
4
+ param(
5
+ [switch]$Interactive,
6
+ [switch]$SkipPrerequisites,
7
+ [switch]$Verbose
8
+ )
9
+
10
+ # Set error action preference
11
+ $ErrorActionPreference = "Stop"
12
+
13
+ # Script configuration
14
+ $ScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
15
+ $ProjectRoot = Split-Path -Parent (Split-Path -Parent $ScriptRoot)
16
+
17
+ function Show-Banner {
18
+ Write-Host "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—" -ForegroundColor Cyan
19
+ Write-Host "โ•‘ Dynamics 365 Team Onboarding Assistant โ•‘" -ForegroundColor Cyan
20
+ Write-Host "โ•‘ Enterprise Consulting Edition โ•‘" -ForegroundColor Cyan
21
+ Write-Host "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•" -ForegroundColor Cyan
22
+ Write-Host ""
23
+ }
24
+
25
+ function Get-PlatformInfo {
26
+ $platform = [System.Environment]::OSVersion.Platform
27
+ $architecture = [System.Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
28
+ $osVersion = [System.Environment]::OSVersion.Version
29
+
30
+ return @{
31
+ Platform = "Windows"
32
+ Architecture = $architecture
33
+ Version = $osVersion.ToString()
34
+ PowerShellVersion = $PSVersionTable.PSVersion.ToString()
35
+ }
36
+ }
37
+
38
+ function Show-PlatformInfo {
39
+ param([hashtable]$PlatformInfo)
40
+
41
+ Write-Host "๐Ÿ” Platform Detection:" -ForegroundColor Blue
42
+ Write-Host " Platform: $($PlatformInfo.Platform)"
43
+ Write-Host " Architecture: $($PlatformInfo.Architecture)"
44
+ Write-Host " OS Version: $($PlatformInfo.Version)"
45
+ Write-Host " PowerShell: $($PlatformInfo.PowerShellVersion)"
46
+ Write-Host ""
47
+
48
+ Write-Host "โœ… Windows detected - You can use PowerShell or Bash scripts" -ForegroundColor Green
49
+ Write-Host " ๐Ÿ“– PowerShell Guide: deployment/QUICKSTART-WINDOWS.md"
50
+ Write-Host " ๐Ÿ“– Bash Alternative: deployment/QUICKSTART-MAC.md"
51
+ Write-Host ""
52
+ }
53
+
54
+ function Test-Prerequisites {
55
+ Write-Host "๐Ÿ”ง Checking Prerequisites..." -ForegroundColor Blue
56
+ Write-Host ""
57
+
58
+ $allGood = $true
59
+ $missingTools = @()
60
+
61
+ # Check Node.js
62
+ try {
63
+ $nodeVersion = node --version 2>$null
64
+ Write-Host " โœ… Node.js - $nodeVersion" -ForegroundColor Green
65
+ }
66
+ catch {
67
+ Write-Host " โŒ Node.js - Not installed" -ForegroundColor Red
68
+ $missingTools += "Node.js"
69
+ $allGood = $false
70
+ }
71
+
72
+ # Check npm
73
+ try {
74
+ $npmVersion = npm --version 2>$null
75
+ Write-Host " โœ… npm - $npmVersion" -ForegroundColor Green
76
+ }
77
+ catch {
78
+ Write-Host " โŒ npm - Not installed" -ForegroundColor Red
79
+ $missingTools += "npm"
80
+ $allGood = $false
81
+ }
82
+
83
+ # Check Git
84
+ try {
85
+ $gitVersion = git --version 2>$null
86
+ Write-Host " โœ… Git - $gitVersion" -ForegroundColor Green
87
+ }
88
+ catch {
89
+ Write-Host " โŒ Git - Not installed" -ForegroundColor Red
90
+ $missingTools += "Git"
91
+ $allGood = $false
92
+ }
93
+
94
+ # Check PowerShell modules
95
+ $requiredModules = @(
96
+ "Microsoft.PowerApps.Administration.PowerShell",
97
+ "Microsoft.PowerApps.PowerShell"
98
+ )
99
+
100
+ foreach ($module in $requiredModules) {
101
+ if (Get-Module -Name $module -ListAvailable -ErrorAction SilentlyContinue) {
102
+ Write-Host " โœ… $module - Installed" -ForegroundColor Green
103
+ }
104
+ else {
105
+ Write-Host " โŒ $module - Not installed" -ForegroundColor Red
106
+ $missingTools += $module
107
+ $allGood = $false
108
+ }
109
+ }
110
+
111
+ # Check optional tools
112
+ try {
113
+ $jqVersion = jq --version 2>$null
114
+ Write-Host " โœ… jq - $jqVersion" -ForegroundColor Green
115
+ }
116
+ catch {
117
+ Write-Host " โš ๏ธ jq - Not installed (optional)" -ForegroundColor Yellow
118
+ }
119
+
120
+ Write-Host ""
121
+
122
+ if ($allGood) {
123
+ Write-Host "๐ŸŽ‰ All prerequisites are installed!" -ForegroundColor Green
124
+ return $true
125
+ }
126
+ else {
127
+ Write-Host "โŒ Missing tools detected" -ForegroundColor Red
128
+ Show-InstallationInstructions -MissingTools $missingTools
129
+ return $false
130
+ }
131
+ }
132
+
133
+ function Show-InstallationInstructions {
134
+ param([array]$MissingTools)
135
+
136
+ Write-Host "๐Ÿ“ฆ Installation Instructions:" -ForegroundColor Yellow
137
+ Write-Host ""
138
+
139
+ Write-Host "Install missing tools using Chocolatey (recommended):" -ForegroundColor White
140
+ Write-Host ""
141
+
142
+ if ($MissingTools -contains "Node.js" -or $MissingTools -contains "npm") {
143
+ Write-Host " choco install nodejs" -ForegroundColor Cyan
144
+ }
145
+
146
+ if ($MissingTools -contains "Git") {
147
+ Write-Host " choco install git" -ForegroundColor Cyan
148
+ }
149
+
150
+ if ($MissingTools -contains "jq") {
151
+ Write-Host " choco install jq" -ForegroundColor Cyan
152
+ }
153
+
154
+ foreach ($module in $MissingTools | Where-Object { $_ -like "Microsoft.PowerApps*" }) {
155
+ Write-Host " Install-Module -Name $module -Force" -ForegroundColor Cyan
156
+ }
157
+
158
+ Write-Host ""
159
+ Write-Host "If Chocolatey is not installed:" -ForegroundColor White
160
+ Write-Host " Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" -ForegroundColor Cyan
161
+ Write-Host ""
162
+ Write-Host "Alternative manual installations:" -ForegroundColor White
163
+ Write-Host " Node.js: https://nodejs.org/"
164
+ Write-Host " Git: https://git-scm.com/"
165
+ Write-Host ""
166
+ }
167
+
168
+ function Test-ProjectSetup {
169
+ Write-Host "๐Ÿ“ Checking Project Setup..." -ForegroundColor Blue
170
+ Write-Host ""
171
+
172
+ # Check if we're in a project directory
173
+ $packageJsonPath = Join-Path $ProjectRoot "package.json"
174
+ if (-not (Test-Path $packageJsonPath)) {
175
+ Write-Host "โŒ Not in a Dynamics 365 project directory" -ForegroundColor Red
176
+ Write-Host " Please navigate to your project root directory"
177
+ return $false
178
+ }
179
+
180
+ Write-Host "โœ… Project directory detected" -ForegroundColor Green
181
+
182
+ # Check package.json
183
+ if (Test-Path $packageJsonPath) {
184
+ Write-Host "โœ… package.json found" -ForegroundColor Green
185
+ }
186
+ else {
187
+ Write-Host "โŒ package.json not found" -ForegroundColor Red
188
+ return $false
189
+ }
190
+
191
+ # Check node_modules
192
+ $nodeModulesPath = Join-Path $ProjectRoot "node_modules"
193
+ if (Test-Path $nodeModulesPath) {
194
+ Write-Host "โœ… node_modules exists" -ForegroundColor Green
195
+ }
196
+ else {
197
+ Write-Host "โš ๏ธ node_modules not found - run 'npm install'" -ForegroundColor Yellow
198
+ }
199
+
200
+ # Check deployment scripts
201
+ $bashScriptPath = Join-Path $ProjectRoot "deployment\scripts\deploy.sh"
202
+ $psScriptPath = Join-Path $ProjectRoot "deployment\scripts\deploy.ps1"
203
+
204
+ if (Test-Path $psScriptPath) {
205
+ Write-Host "โœ… PowerShell deployment script found" -ForegroundColor Green
206
+ }
207
+ else {
208
+ Write-Host "โŒ PowerShell deployment script missing" -ForegroundColor Red
209
+ }
210
+
211
+ if (Test-Path $bashScriptPath) {
212
+ Write-Host "โœ… Bash deployment script found" -ForegroundColor Green
213
+ }
214
+ else {
215
+ Write-Host "โš ๏ธ Bash deployment script missing" -ForegroundColor Yellow
216
+ }
217
+
218
+ # Check configuration directory
219
+ $configPath = Join-Path $ProjectRoot "config\environments"
220
+ if (Test-Path $configPath) {
221
+ Write-Host "โœ… Environment configuration directory found" -ForegroundColor Green
222
+
223
+ # List available environments
224
+ $envFiles = Get-ChildItem -Path $configPath -Filter "*.json" | ForEach-Object { $_.BaseName }
225
+ if ($envFiles.Count -gt 0) {
226
+ Write-Host " Available environments: $($envFiles -join ', ')"
227
+ }
228
+ else {
229
+ Write-Host " โš ๏ธ No environment configurations found" -ForegroundColor Yellow
230
+ }
231
+ }
232
+ else {
233
+ Write-Host "โŒ Environment configuration directory missing" -ForegroundColor Red
234
+ }
235
+
236
+ Write-Host ""
237
+ return $true
238
+ }
239
+
240
+ function Initialize-DeveloperEnvironment {
241
+ Write-Host "โš™๏ธ Setting up developer environment..." -ForegroundColor Blue
242
+ Write-Host ""
243
+
244
+ # Install npm dependencies if needed
245
+ $nodeModulesPath = Join-Path $ProjectRoot "node_modules"
246
+ if (-not (Test-Path $nodeModulesPath)) {
247
+ Write-Host "Installing npm dependencies..."
248
+ Push-Location $ProjectRoot
249
+ try {
250
+ npm install
251
+ Write-Host "โœ… Dependencies installed" -ForegroundColor Green
252
+ }
253
+ catch {
254
+ Write-Host "โŒ Failed to install dependencies: $_" -ForegroundColor Red
255
+ }
256
+ finally {
257
+ Pop-Location
258
+ }
259
+ }
260
+
261
+ # Create .env.local template if it doesn't exist
262
+ $envLocalPath = Join-Path $ProjectRoot ".env.local"
263
+ if (-not (Test-Path $envLocalPath)) {
264
+ Write-Host "Creating .env.local template..."
265
+
266
+ $envContent = @"
267
+ # Local environment variables (not committed to git)
268
+ # Add your personal configuration here
269
+
270
+ # Development environment
271
+ D365_ENVIRONMENT=dev
272
+ D365_CLIENT_ID=your-client-id-here
273
+ D365_CLIENT_SECRET=your-client-secret-here
274
+
275
+ # Optional: Custom settings
276
+ NODE_ENV=development
277
+ DEBUG=true
278
+ "@
279
+
280
+ Set-Content -Path $envLocalPath -Value $envContent -Encoding UTF8
281
+ Write-Host "โœ… .env.local template created" -ForegroundColor Green
282
+ Write-Host " ๐Ÿ“ Please edit .env.local with your configuration" -ForegroundColor Yellow
283
+ }
284
+
285
+ Write-Host ""
286
+ }
287
+
288
+ function New-PowerShellAliases {
289
+ Write-Host "๐Ÿ”ง Setting up PowerShell aliases..." -ForegroundColor Blue
290
+ Write-Host ""
291
+
292
+ # Check if profile exists
293
+ if (-not (Test-Path $PROFILE)) {
294
+ Write-Host "Creating PowerShell profile..."
295
+ New-Item -Type File -Path $PROFILE -Force | Out-Null
296
+ Write-Host "โœ… PowerShell profile created" -ForegroundColor Green
297
+ }
298
+
299
+ # Check if aliases already exist
300
+ $profileContent = Get-Content $PROFILE -ErrorAction SilentlyContinue
301
+ if ($profileContent -notcontains "# Dynamics 365 Development Aliases") {
302
+ Write-Host "Adding aliases to PowerShell profile..."
303
+
304
+ $aliases = @"
305
+
306
+ # Dynamics 365 Development Aliases
307
+ Set-Alias d365deploy '$ProjectRoot\deployment\scripts\deploy.ps1'
308
+ Set-Alias d365health '$ProjectRoot\deployment\scripts\health-check.ps1'
309
+ Set-Alias d365rollback '$ProjectRoot\deployment\scripts\rollback.ps1'
310
+
311
+ function Set-D365Project { Set-Location '$ProjectRoot' }
312
+ Set-Alias d365cd Set-D365Project
313
+
314
+ function Start-D365Build { npm run build:prod }
315
+ Set-Alias d365build Start-D365Build
316
+
317
+ function Start-D365Dev { npm run build:dev }
318
+ Set-Alias d365dev Start-D365Dev
319
+
320
+ function Start-D365Quality { npm run quality }
321
+ Set-Alias d365quality Start-D365Quality
322
+ "@
323
+
324
+ Add-Content -Path $PROFILE -Value $aliases
325
+ Write-Host "โœ… Aliases added to PowerShell profile" -ForegroundColor Green
326
+ Write-Host " ๐Ÿ“ Restart PowerShell or run '. `$PROFILE' to load aliases" -ForegroundColor Yellow
327
+ }
328
+ else {
329
+ Write-Host " โš ๏ธ Aliases already exist in PowerShell profile" -ForegroundColor Yellow
330
+ }
331
+
332
+ Write-Host ""
333
+ }
334
+
335
+ function Show-NextSteps {
336
+ Write-Host "๐Ÿš€ Next Steps:" -ForegroundColor Cyan
337
+ Write-Host ""
338
+
339
+ Write-Host "1. ๐Ÿ“– Read the Windows Quick Start Guide:"
340
+ Write-Host " start deployment\QUICKSTART-WINDOWS.md" -ForegroundColor Cyan
341
+ Write-Host ""
342
+
343
+ Write-Host "2. ๐Ÿ”ง Install PowerShell modules (run as Administrator):"
344
+ Write-Host " Install-Module Microsoft.PowerApps.Administration.PowerShell" -ForegroundColor Cyan
345
+ Write-Host " Install-Module Microsoft.PowerApps.PowerShell" -ForegroundColor Cyan
346
+ Write-Host ""
347
+
348
+ Write-Host "3. โš™๏ธ Configure your environment:"
349
+ Write-Host " Copy-Item config\environments\template.json config\environments\dev.json" -ForegroundColor Cyan
350
+ Write-Host " # Edit dev.json with your D365 settings"
351
+ Write-Host ""
352
+
353
+ Write-Host "4. ๐Ÿงช Test your setup:"
354
+ Write-Host " .\deployment\scripts\test-connection.ps1 -Environment dev" -ForegroundColor Cyan
355
+ Write-Host ""
356
+
357
+ Write-Host "5. ๐Ÿš€ Deploy to development:"
358
+ Write-Host " .\deployment\scripts\deploy.ps1 -Environment dev -DryRun" -ForegroundColor Cyan
359
+ Write-Host " .\deployment\scripts\deploy.ps1 -Environment dev" -ForegroundColor Cyan
360
+ Write-Host ""
361
+
362
+ Write-Host "6. ๐Ÿ”จ Generate your first entity:"
363
+ Write-Host ' npm run generate:entity -- --entity "customentity" --display-name "Custom Entity"' -ForegroundColor Cyan
364
+ Write-Host ""
365
+
366
+ Write-Host "๐Ÿ“š Additional Resources:" -ForegroundColor Magenta
367
+ Write-Host " โ€ข Team Standards: docs\team-standards\"
368
+ Write-Host " โ€ข Deployment Guide: deployment\README.md"
369
+ Write-Host " โ€ข Architecture Overview: docs\ARCHITECTURE_OVERVIEW.md"
370
+ Write-Host " โ€ข Code Review Checklist: docs\team-standards\code-review-checklist.md"
371
+ Write-Host ""
372
+
373
+ Write-Host "๐ŸŽ‰ Welcome to the team! Happy coding!" -ForegroundColor Green
374
+ }
375
+
376
+ function Start-InteractiveSetup {
377
+ if ($Interactive) {
378
+ Write-Host "๐Ÿง™โ€โ™‚๏ธ Starting interactive setup wizard..." -ForegroundColor Blue
379
+ Write-Host ""
380
+
381
+ # Environment configuration
382
+ Write-Host "Environment Configuration:" -ForegroundColor Yellow
383
+ Write-Host "Which environment would you like to configure first?"
384
+ Write-Host "1) Development (dev)"
385
+ Write-Host "2) Testing (test)"
386
+ Write-Host "3) Production (prod)"
387
+ Write-Host "4) Skip for now"
388
+
389
+ $choice = Read-Host "Enter your choice (1-4)"
390
+
391
+ switch ($choice) {
392
+ "1" {
393
+ Write-Host "Setting up development environment..."
394
+ New-EnvironmentConfig -Environment "dev"
395
+ }
396
+ "2" {
397
+ Write-Host "Setting up testing environment..."
398
+ New-EnvironmentConfig -Environment "test"
399
+ }
400
+ "3" {
401
+ Write-Host "Setting up production environment..."
402
+ New-EnvironmentConfig -Environment "prod"
403
+ }
404
+ default {
405
+ Write-Host "Skipping environment configuration"
406
+ }
407
+ }
408
+ }
409
+ }
410
+
411
+ function New-EnvironmentConfig {
412
+ param([string]$Environment)
413
+
414
+ $configFile = Join-Path $ProjectRoot "config\environments\$Environment.json"
415
+
416
+ if (Test-Path $configFile) {
417
+ Write-Host "Configuration file already exists: $configFile" -ForegroundColor Yellow
418
+ $overwrite = Read-Host "Would you like to overwrite it? (y/n)"
419
+ if ($overwrite -ne "y" -and $overwrite -ne "Y") {
420
+ return
421
+ }
422
+ }
423
+
424
+ Write-Host "Please provide the following information for $Environment environment:"
425
+
426
+ # Get basic information
427
+ $orgUrl = Read-Host "Organization URL (e.g., https://yourorg.crm.dynamics.com)"
428
+ $tenantId = Read-Host "Tenant ID"
429
+ $clientId = Read-Host "Client ID"
430
+ $clientSecret = Read-Host "Client Secret" -AsSecureString
431
+ $clientSecretPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($clientSecret))
432
+
433
+ # Create configuration
434
+ $config = @{
435
+ name = $Environment.Substring(0,1).ToUpper() + $Environment.Substring(1)
436
+ type = $Environment
437
+ dynamics365 = @{
438
+ orgUrl = $orgUrl
439
+ webApiUrl = "$orgUrl/api/data/v9.2"
440
+ tenantId = $tenantId
441
+ }
442
+ authentication = @{
443
+ type = "oauth2"
444
+ clientId = $clientId
445
+ clientSecret = $clientSecretPlain
446
+ }
447
+ deployment = @{
448
+ strategy = "blue-green"
449
+ rollbackEnabled = $true
450
+ }
451
+ }
452
+
453
+ $config | ConvertTo-Json -Depth 3 | Set-Content -Path $configFile -Encoding UTF8
454
+ Write-Host "โœ… Configuration created: $configFile" -ForegroundColor Green
455
+ }
456
+
457
+ # Main execution
458
+ function Main {
459
+ Show-Banner
460
+
461
+ $platformInfo = Get-PlatformInfo
462
+ Show-PlatformInfo -PlatformInfo $platformInfo
463
+
464
+ if (-not $SkipPrerequisites) {
465
+ if (-not (Test-Prerequisites)) {
466
+ Write-Host "Please install missing prerequisites and run this script again." -ForegroundColor Red
467
+ return
468
+ }
469
+ }
470
+
471
+ if (-not (Test-ProjectSetup)) {
472
+ Write-Host "Project setup issues detected. Please resolve them and try again." -ForegroundColor Red
473
+ return
474
+ }
475
+
476
+ Initialize-DeveloperEnvironment
477
+ New-PowerShellAliases
478
+
479
+ # Run interactive setup if requested
480
+ Start-InteractiveSetup
481
+
482
+ Show-NextSteps
483
+ }
484
+
485
+ # Run main function
486
+ Main