@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,567 @@
1
+ #!/bin/bash
2
+
3
+ # Team Onboarding Script with Platform Detection
4
+ # Automatically detects platform and guides developer through setup
5
+
6
+ set -euo pipefail
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ MAGENTA='\033[0;35m'
14
+ CYAN='\033[0;36m'
15
+ NC='\033[0m' # No Color
16
+
17
+ # Script configuration
18
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
+ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
20
+
21
+ # Platform detection
22
+ detect_platform() {
23
+ case "$(uname -s)" in
24
+ Darwin*) echo "mac" ;;
25
+ Linux*) echo "linux" ;;
26
+ CYGWIN*|MINGW32*|MSYS*|MINGW*) echo "windows" ;;
27
+ *) echo "unknown" ;;
28
+ esac
29
+ }
30
+
31
+ # Architecture detection
32
+ detect_arch() {
33
+ case "$(uname -m)" in
34
+ x86_64|amd64) echo "x64" ;;
35
+ arm64|aarch64) echo "arm64" ;;
36
+ *) echo "unknown" ;;
37
+ esac
38
+ }
39
+
40
+ show_banner() {
41
+ echo -e "${CYAN}"
42
+ echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—"
43
+ echo "โ•‘ Dynamics 365 Team Onboarding Assistant โ•‘"
44
+ echo "โ•‘ Enterprise Consulting Edition โ•‘"
45
+ echo "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•"
46
+ echo -e "${NC}"
47
+ }
48
+
49
+ show_platform_info() {
50
+ local platform="$1"
51
+ local arch="$2"
52
+
53
+ echo -e "${BLUE}๐Ÿ” Platform Detection:${NC}"
54
+ echo " Platform: $platform"
55
+ echo " Architecture: $arch"
56
+ echo
57
+
58
+ case "$platform" in
59
+ mac)
60
+ echo -e "${GREEN}โœ… macOS detected - You'll use Bash scripts${NC}"
61
+ echo " ๐Ÿ“– Quick Start Guide: deployment/QUICKSTART-MAC.md"
62
+ ;;
63
+ linux)
64
+ echo -e "${GREEN}โœ… Linux detected - You'll use Bash scripts${NC}"
65
+ echo " ๐Ÿ“– Quick Start Guide: deployment/QUICKSTART-MAC.md (compatible)"
66
+ ;;
67
+ windows)
68
+ echo -e "${GREEN}โœ… Windows detected - You can use PowerShell or Bash scripts${NC}"
69
+ echo " ๐Ÿ“– PowerShell Guide: deployment/QUICKSTART-WINDOWS.md"
70
+ echo " ๐Ÿ“– Bash Alternative: deployment/QUICKSTART-MAC.md"
71
+ ;;
72
+ *)
73
+ echo -e "${YELLOW}โš ๏ธ Unknown platform - Please check system requirements${NC}"
74
+ ;;
75
+ esac
76
+ echo
77
+ }
78
+
79
+ check_prerequisites() {
80
+ local platform="$1"
81
+ local missing_tools=()
82
+ local all_good=true
83
+
84
+ echo -e "${BLUE}๐Ÿ”ง Checking Prerequisites...${NC}"
85
+ echo
86
+
87
+ # Common tools
88
+ local common_tools=("node" "npm" "git")
89
+
90
+ # Platform-specific tools
91
+ case "$platform" in
92
+ mac|linux)
93
+ local platform_tools=("jq" "curl")
94
+ ;;
95
+ windows)
96
+ local platform_tools=("jq" "curl")
97
+ ;;
98
+ *)
99
+ local platform_tools=()
100
+ ;;
101
+ esac
102
+
103
+ # Check common tools
104
+ for tool in "${common_tools[@]}"; do
105
+ if command -v "$tool" &> /dev/null; then
106
+ local version=$(eval "$tool --version" 2>/dev/null | head -n1 || echo "unknown")
107
+ echo -e " ${GREEN}โœ… $tool${NC} - $version"
108
+ else
109
+ echo -e " ${RED}โŒ $tool${NC} - Not installed"
110
+ missing_tools+=("$tool")
111
+ all_good=false
112
+ fi
113
+ done
114
+
115
+ # Check platform-specific tools
116
+ for tool in "${platform_tools[@]}"; do
117
+ if command -v "$tool" &> /dev/null; then
118
+ local version=$(eval "$tool --version" 2>/dev/null | head -n1 || echo "unknown")
119
+ echo -e " ${GREEN}โœ… $tool${NC} - $version"
120
+ else
121
+ echo -e " ${RED}โŒ $tool${NC} - Not installed"
122
+ missing_tools+=("$tool")
123
+ all_good=false
124
+ fi
125
+ done
126
+
127
+ # Check PowerShell on Windows
128
+ if [ "$platform" = "windows" ]; then
129
+ if command -v pwsh &> /dev/null; then
130
+ local ps_version=$(pwsh -c '$PSVersionTable.PSVersion.ToString()' 2>/dev/null || echo "unknown")
131
+ echo -e " ${GREEN}โœ… PowerShell Core${NC} - $ps_version"
132
+ elif command -v powershell &> /dev/null; then
133
+ local ps_version=$(powershell -c '$PSVersionTable.PSVersion.ToString()' 2>/dev/null || echo "unknown")
134
+ echo -e " ${GREEN}โœ… Windows PowerShell${NC} - $ps_version"
135
+ else
136
+ echo -e " ${YELLOW}โš ๏ธ PowerShell${NC} - Not detected (optional)"
137
+ fi
138
+ fi
139
+
140
+ echo
141
+
142
+ if [ "$all_good" = true ]; then
143
+ echo -e "${GREEN}๐ŸŽ‰ All prerequisites are installed!${NC}"
144
+ return 0
145
+ else
146
+ echo -e "${RED}โŒ Missing tools detected${NC}"
147
+ show_installation_instructions "$platform" "${missing_tools[@]}"
148
+ return 1
149
+ fi
150
+ }
151
+
152
+ show_installation_instructions() {
153
+ local platform="$1"
154
+ shift
155
+ local missing_tools=("$@")
156
+
157
+ echo -e "${YELLOW}๐Ÿ“ฆ Installation Instructions:${NC}"
158
+ echo
159
+
160
+ case "$platform" in
161
+ mac)
162
+ echo "Install missing tools using Homebrew:"
163
+ echo
164
+ if [[ " ${missing_tools[*]} " =~ " node " ]] || [[ " ${missing_tools[*]} " =~ " npm " ]]; then
165
+ echo " brew install node"
166
+ fi
167
+ if [[ " ${missing_tools[*]} " =~ " git " ]]; then
168
+ echo " brew install git"
169
+ fi
170
+ if [[ " ${missing_tools[*]} " =~ " jq " ]]; then
171
+ echo " brew install jq"
172
+ fi
173
+ if [[ " ${missing_tools[*]} " =~ " curl " ]]; then
174
+ echo " brew install curl"
175
+ fi
176
+ echo
177
+ echo "If Homebrew is not installed:"
178
+ echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
179
+ ;;
180
+ linux)
181
+ echo "Install missing tools using your package manager:"
182
+ echo
183
+ echo "Ubuntu/Debian:"
184
+ if [[ " ${missing_tools[*]} " =~ " node " ]] || [[ " ${missing_tools[*]} " =~ " npm " ]]; then
185
+ echo " sudo apt-get install nodejs npm"
186
+ fi
187
+ if [[ " ${missing_tools[*]} " =~ " git " ]]; then
188
+ echo " sudo apt-get install git"
189
+ fi
190
+ if [[ " ${missing_tools[*]} " =~ " jq " ]]; then
191
+ echo " sudo apt-get install jq"
192
+ fi
193
+ if [[ " ${missing_tools[*]} " =~ " curl " ]]; then
194
+ echo " sudo apt-get install curl"
195
+ fi
196
+ echo
197
+ echo "CentOS/RHEL:"
198
+ if [[ " ${missing_tools[*]} " =~ " node " ]] || [[ " ${missing_tools[*]} " =~ " npm " ]]; then
199
+ echo " sudo yum install nodejs npm"
200
+ fi
201
+ if [[ " ${missing_tools[*]} " =~ " git " ]]; then
202
+ echo " sudo yum install git"
203
+ fi
204
+ if [[ " ${missing_tools[*]} " =~ " jq " ]]; then
205
+ echo " sudo yum install jq"
206
+ fi
207
+ if [[ " ${missing_tools[*]} " =~ " curl " ]]; then
208
+ echo " sudo yum install curl"
209
+ fi
210
+ ;;
211
+ windows)
212
+ echo "Install missing tools using Chocolatey or manual installation:"
213
+ echo
214
+ echo "Using Chocolatey (recommended):"
215
+ if [[ " ${missing_tools[*]} " =~ " node " ]] || [[ " ${missing_tools[*]} " =~ " npm " ]]; then
216
+ echo " choco install nodejs"
217
+ fi
218
+ if [[ " ${missing_tools[*]} " =~ " git " ]]; then
219
+ echo " choco install git"
220
+ fi
221
+ if [[ " ${missing_tools[*]} " =~ " jq " ]]; then
222
+ echo " choco install jq"
223
+ fi
224
+ if [[ " ${missing_tools[*]} " =~ " curl " ]]; then
225
+ echo " choco install curl"
226
+ fi
227
+ echo
228
+ echo "Or download from official websites:"
229
+ echo " Node.js: https://nodejs.org/"
230
+ echo " Git: https://git-scm.com/"
231
+ ;;
232
+ esac
233
+ echo
234
+ }
235
+
236
+ check_project_setup() {
237
+ echo -e "${BLUE}๐Ÿ“ Checking Project Setup...${NC}"
238
+ echo
239
+
240
+ # Check if we're in a project directory
241
+ if [ ! -f "$PROJECT_ROOT/package.json" ]; then
242
+ echo -e "${RED}โŒ Not in a Dynamics 365 project directory${NC}"
243
+ echo " Please navigate to your project root directory"
244
+ return 1
245
+ fi
246
+
247
+ echo -e "${GREEN}โœ… Project directory detected${NC}"
248
+
249
+ # Check package.json
250
+ if [ -f "$PROJECT_ROOT/package.json" ]; then
251
+ echo -e "${GREEN}โœ… package.json found${NC}"
252
+ else
253
+ echo -e "${RED}โŒ package.json not found${NC}"
254
+ return 1
255
+ fi
256
+
257
+ # Check node_modules
258
+ if [ -d "$PROJECT_ROOT/node_modules" ]; then
259
+ echo -e "${GREEN}โœ… node_modules exists${NC}"
260
+ else
261
+ echo -e "${YELLOW}โš ๏ธ node_modules not found - run 'npm install'${NC}"
262
+ fi
263
+
264
+ # Check deployment scripts
265
+ if [ -f "$PROJECT_ROOT/deployment/scripts/deploy.sh" ]; then
266
+ echo -e "${GREEN}โœ… Bash deployment script found${NC}"
267
+ else
268
+ echo -e "${RED}โŒ Bash deployment script missing${NC}"
269
+ fi
270
+
271
+ if [ -f "$PROJECT_ROOT/deployment/scripts/deploy.ps1" ]; then
272
+ echo -e "${GREEN}โœ… PowerShell deployment script found${NC}"
273
+ else
274
+ echo -e "${YELLOW}โš ๏ธ PowerShell deployment script missing${NC}"
275
+ fi
276
+
277
+ # Check configuration directory
278
+ if [ -d "$PROJECT_ROOT/config/environments" ]; then
279
+ echo -e "${GREEN}โœ… Environment configuration directory found${NC}"
280
+
281
+ # List available environments
282
+ local env_files=($(find "$PROJECT_ROOT/config/environments" -name "*.json" -exec basename {} .json \; 2>/dev/null || true))
283
+ if [ ${#env_files[@]} -gt 0 ]; then
284
+ echo " Available environments: ${env_files[*]}"
285
+ else
286
+ echo -e "${YELLOW} โš ๏ธ No environment configurations found${NC}"
287
+ fi
288
+ else
289
+ echo -e "${RED}โŒ Environment configuration directory missing${NC}"
290
+ fi
291
+
292
+ echo
293
+ return 0
294
+ }
295
+
296
+ setup_developer_environment() {
297
+ local platform="$1"
298
+
299
+ echo -e "${BLUE}โš™๏ธ Setting up developer environment...${NC}"
300
+ echo
301
+
302
+ # Make scripts executable (Unix-like systems)
303
+ if [ "$platform" != "windows" ]; then
304
+ echo "Making deployment scripts executable..."
305
+ find "$PROJECT_ROOT/deployment/scripts" -name "*.sh" -exec chmod +x {} \; 2>/dev/null || true
306
+ echo -e "${GREEN}โœ… Scripts are now executable${NC}"
307
+ fi
308
+
309
+ # Install npm dependencies if needed
310
+ if [ ! -d "$PROJECT_ROOT/node_modules" ]; then
311
+ echo "Installing npm dependencies..."
312
+ cd "$PROJECT_ROOT"
313
+ npm install
314
+ echo -e "${GREEN}โœ… Dependencies installed${NC}"
315
+ fi
316
+
317
+ # Create .env.local template if it doesn't exist
318
+ if [ ! -f "$PROJECT_ROOT/.env.local" ]; then
319
+ echo "Creating .env.local template..."
320
+ cat > "$PROJECT_ROOT/.env.local" << 'EOF'
321
+ # Local environment variables (not committed to git)
322
+ # Add your personal configuration here
323
+
324
+ # Development environment
325
+ D365_ENVIRONMENT=dev
326
+ D365_CLIENT_ID=your-client-id-here
327
+ D365_CLIENT_SECRET=your-client-secret-here
328
+
329
+ # Optional: Custom settings
330
+ NODE_ENV=development
331
+ DEBUG=true
332
+ EOF
333
+ echo -e "${GREEN}โœ… .env.local template created${NC}"
334
+ echo -e "${YELLOW} ๐Ÿ“ Please edit .env.local with your configuration${NC}"
335
+ fi
336
+
337
+ echo
338
+ }
339
+
340
+ create_platform_aliases() {
341
+ local platform="$1"
342
+
343
+ echo -e "${BLUE}๐Ÿ”ง Setting up platform-specific aliases...${NC}"
344
+ echo
345
+
346
+ case "$platform" in
347
+ mac)
348
+ local shell_config=""
349
+ if [ -n "${ZSH_VERSION:-}" ] || [ "$SHELL" = "/bin/zsh" ]; then
350
+ shell_config="$HOME/.zshrc"
351
+ elif [ -n "${BASH_VERSION:-}" ] || [ "$SHELL" = "/bin/bash" ]; then
352
+ shell_config="$HOME/.bash_profile"
353
+ fi
354
+
355
+ if [ -n "$shell_config" ]; then
356
+ echo "Adding aliases to $shell_config..."
357
+
358
+ # Check if aliases already exist
359
+ if ! grep -q "# Dynamics 365 Development Aliases" "$shell_config" 2>/dev/null; then
360
+ cat >> "$shell_config" << EOF
361
+
362
+ # Dynamics 365 Development Aliases
363
+ alias d365deploy="./deployment/scripts/deploy.sh"
364
+ alias d365health="./deployment/scripts/health-check.sh"
365
+ alias d365rollback="./deployment/scripts/rollback.sh"
366
+ alias d365cd="cd $PROJECT_ROOT"
367
+ alias d365build="npm run build:prod"
368
+ alias d365dev="npm run build:dev"
369
+ alias d365quality="npm run quality"
370
+
371
+ EOF
372
+ echo -e "${GREEN}โœ… Aliases added to $shell_config${NC}"
373
+ echo -e "${YELLOW} ๐Ÿ“ Run 'source $shell_config' or restart your terminal${NC}"
374
+ else
375
+ echo -e "${YELLOW} โš ๏ธ Aliases already exist in $shell_config${NC}"
376
+ fi
377
+ fi
378
+ ;;
379
+ windows)
380
+ echo "For Windows, you can create PowerShell aliases in your profile:"
381
+ echo
382
+ echo "PowerShell Profile Setup:"
383
+ echo ' if (!(Test-Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }'
384
+ echo ' Add-Content $PROFILE "Set-Alias d365deploy .\deployment\scripts\deploy.ps1"'
385
+ echo ' Add-Content $PROFILE "Set-Alias d365health .\deployment\scripts\health-check.ps1"'
386
+ echo
387
+ ;;
388
+ esac
389
+
390
+ echo
391
+ }
392
+
393
+ show_next_steps() {
394
+ local platform="$1"
395
+
396
+ echo -e "${CYAN}๐Ÿš€ Next Steps:${NC}"
397
+ echo
398
+
399
+ case "$platform" in
400
+ mac|linux)
401
+ echo "1. ๐Ÿ“– Read the Mac/Linux Quick Start Guide:"
402
+ echo " open deployment/QUICKSTART-MAC.md"
403
+ echo
404
+ echo "2. ๐Ÿ”ง Configure your environment:"
405
+ echo " cp config/environments/template.json config/environments/dev.json"
406
+ echo " # Edit dev.json with your D365 settings"
407
+ echo
408
+ echo "3. ๐Ÿงช Test your setup:"
409
+ echo " ./deployment/scripts/test-connection.sh dev"
410
+ echo
411
+ echo "4. ๐Ÿš€ Deploy to development:"
412
+ echo " ./deployment/scripts/deploy.sh dev --dry-run"
413
+ echo " ./deployment/scripts/deploy.sh dev"
414
+ echo
415
+ echo "5. ๐Ÿ”จ Generate your first entity:"
416
+ echo ' npm run generate:entity -- --entity "customentity" --display-name "Custom Entity"'
417
+ ;;
418
+ windows)
419
+ echo "1. ๐Ÿ“– Read the Windows Quick Start Guide:"
420
+ echo " start deployment/QUICKSTART-WINDOWS.md"
421
+ echo
422
+ echo "2. ๐Ÿ”ง Install PowerShell modules (run as Administrator):"
423
+ echo " Install-Module Microsoft.PowerApps.Administration.PowerShell"
424
+ echo " Install-Module Microsoft.PowerApps.PowerShell"
425
+ echo
426
+ echo "3. โš™๏ธ Configure your environment:"
427
+ echo " Copy-Item config\\environments\\template.json config\\environments\\dev.json"
428
+ echo " # Edit dev.json with your D365 settings"
429
+ echo
430
+ echo "4. ๐Ÿงช Test your setup:"
431
+ echo " .\\deployment\\scripts\\test-connection.ps1 -Environment dev"
432
+ echo
433
+ echo "5. ๐Ÿš€ Deploy to development:"
434
+ echo " .\\deployment\\scripts\\deploy.ps1 -Environment dev -DryRun"
435
+ echo " .\\deployment\\scripts\\deploy.ps1 -Environment dev"
436
+ echo
437
+ echo "6. ๐Ÿ”จ Generate your first entity:"
438
+ echo ' npm run generate:entity -- --entity "customentity" --display-name "Custom Entity"'
439
+ ;;
440
+ esac
441
+
442
+ echo
443
+ echo -e "${MAGENTA}๐Ÿ“š Additional Resources:${NC}"
444
+ echo " โ€ข Team Standards: docs/team-standards/"
445
+ echo " โ€ข Deployment Guide: deployment/README.md"
446
+ echo " โ€ข Architecture Overview: docs/ARCHITECTURE_OVERVIEW.md"
447
+ echo " โ€ข Code Review Checklist: docs/team-standards/code-review-checklist.md"
448
+ echo
449
+ echo -e "${GREEN}๐ŸŽ‰ Welcome to the team! Happy coding!${NC}"
450
+ }
451
+
452
+ run_interactive_setup() {
453
+ echo -e "${YELLOW}Would you like to run the interactive setup wizard? (y/n)${NC}"
454
+ read -r response
455
+
456
+ if [[ "$response" =~ ^[Yy]$ ]]; then
457
+ echo
458
+ echo -e "${BLUE}๐Ÿง™โ€โ™‚๏ธ Starting interactive setup wizard...${NC}"
459
+ echo
460
+
461
+ # Environment configuration
462
+ echo -e "${YELLOW}Environment Configuration:${NC}"
463
+ echo "Which environment would you like to configure first?"
464
+ echo "1) Development (dev)"
465
+ echo "2) Testing (test)"
466
+ echo "3) Production (prod)"
467
+ echo "4) Skip for now"
468
+
469
+ read -r env_choice
470
+
471
+ case "$env_choice" in
472
+ 1)
473
+ echo "Setting up development environment..."
474
+ setup_environment_config "dev"
475
+ ;;
476
+ 2)
477
+ echo "Setting up testing environment..."
478
+ setup_environment_config "test"
479
+ ;;
480
+ 3)
481
+ echo "Setting up production environment..."
482
+ setup_environment_config "prod"
483
+ ;;
484
+ *)
485
+ echo "Skipping environment configuration"
486
+ ;;
487
+ esac
488
+ fi
489
+ }
490
+
491
+ setup_environment_config() {
492
+ local env="$1"
493
+ local config_file="$PROJECT_ROOT/config/environments/$env.json"
494
+
495
+ if [ -f "$config_file" ]; then
496
+ echo -e "${YELLOW}Configuration file already exists: $config_file${NC}"
497
+ echo "Would you like to overwrite it? (y/n)"
498
+ read -r overwrite
499
+ if [[ ! "$overwrite" =~ ^[Yy]$ ]]; then
500
+ return
501
+ fi
502
+ fi
503
+
504
+ echo "Please provide the following information for $env environment:"
505
+
506
+ # Get basic information
507
+ read -p "Organization URL (e.g., https://yourorg.crm.dynamics.com): " org_url
508
+ read -p "Tenant ID: " tenant_id
509
+ read -p "Client ID: " client_id
510
+ read -s -p "Client Secret: " client_secret
511
+ echo
512
+
513
+ # Create configuration
514
+ cat > "$config_file" << EOF
515
+ {
516
+ "name": "${env^}",
517
+ "type": "$env",
518
+ "dynamics365": {
519
+ "orgUrl": "$org_url",
520
+ "webApiUrl": "${org_url}/api/data/v9.2",
521
+ "tenantId": "$tenant_id"
522
+ },
523
+ "authentication": {
524
+ "type": "oauth2",
525
+ "clientId": "$client_id",
526
+ "clientSecret": "$client_secret"
527
+ },
528
+ "deployment": {
529
+ "strategy": "blue-green",
530
+ "rollbackEnabled": true
531
+ }
532
+ }
533
+ EOF
534
+
535
+ echo -e "${GREEN}โœ… Configuration created: $config_file${NC}"
536
+ }
537
+
538
+ # Main execution
539
+ main() {
540
+ show_banner
541
+
542
+ local platform=$(detect_platform)
543
+ local arch=$(detect_arch)
544
+
545
+ show_platform_info "$platform" "$arch"
546
+
547
+ if ! check_prerequisites "$platform"; then
548
+ echo -e "${RED}Please install missing prerequisites and run this script again.${NC}"
549
+ exit 1
550
+ fi
551
+
552
+ if ! check_project_setup; then
553
+ echo -e "${RED}Project setup issues detected. Please resolve them and try again.${NC}"
554
+ exit 1
555
+ fi
556
+
557
+ setup_developer_environment "$platform"
558
+ create_platform_aliases "$platform"
559
+
560
+ # Run interactive setup if requested
561
+ run_interactive_setup
562
+
563
+ show_next_steps "$platform"
564
+ }
565
+
566
+ # Run main function
567
+ main "$@"