@power-maverick/tool-erd-generator 0.0.7 → 0.0.8
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.
- package/MIGRATION_COMPLETE.md +181 -0
- package/README.md +118 -359
- package/index.html +18 -1
- package/package.json +12 -27
- package/tsconfig.json +20 -15
- package/{webview/vite.config.ts → vite.config.ts} +1 -1
- package/CONVERSION_SUMMARY.md +0 -288
- package/REFACTORING_COMPLETE.md +0 -352
- package/TYPESCRIPT_NOTES.md +0 -57
- package/dist/src/components/ERDGenerator.d.ts +0 -44
- package/dist/src/components/ERDGenerator.d.ts.map +0 -1
- package/dist/src/components/ERDGenerator.js +0 -232
- package/dist/src/components/ERDGenerator.js.map +0 -1
- package/dist/src/dvdtIntegration/integration.d.ts +0 -47
- package/dist/src/dvdtIntegration/integration.d.ts.map +0 -1
- package/dist/src/dvdtIntegration/integration.js +0 -223
- package/dist/src/dvdtIntegration/integration.js.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -26
- package/dist/src/index.js.map +0 -1
- package/dist/src/models/interfaces.d.ts +0 -84
- package/dist/src/models/interfaces.d.ts.map +0 -1
- package/dist/src/models/interfaces.js +0 -3
- package/dist/src/models/interfaces.js.map +0 -1
- package/dist/src/models/platformApi.d.ts +0 -92
- package/dist/src/models/platformApi.d.ts.map +0 -1
- package/dist/src/models/platformApi.js +0 -213
- package/dist/src/models/platformApi.js.map +0 -1
- package/dist/src/utils/Constants.d.ts +0 -3
- package/dist/src/utils/Constants.d.ts.map +0 -1
- package/dist/src/utils/Constants.js +0 -6
- package/dist/src/utils/Constants.js.map +0 -1
- package/dist/src/utils/DataverseClient.d.ts +0 -53
- package/dist/src/utils/DataverseClient.d.ts.map +0 -1
- package/dist/src/utils/DataverseClient.js +0 -236
- package/dist/src/utils/DataverseClient.js.map +0 -1
- package/dist/webview/index.css +0 -1
- package/dist/webview/index.html +0 -13
- package/dist/webview/index.js +0 -49
- package/tsconfig.webview.json +0 -24
- package/ui/test.html +0 -326
- package/webview/App.tsx +0 -412
- package/webview/index.html +0 -12
- package/webview/main.tsx +0 -10
- package/webview/styles.css +0 -288
- package/webview/tsconfig.json +0 -35
- /package/{webview/tsconfig.node.json → tsconfig.node.json} +0 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Migration Complete: PPTB-Only ERD Generator
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Successfully migrated the ERD Generator from dual PPTB/DVDT architecture to a **pure PPTB implementation** following the official [PowerPlatform ToolBox react-sample](https://github.com/PowerPlatformToolBox/sample-tools/tree/main/react-sample) structure.
|
|
6
|
+
|
|
7
|
+
## What Changed
|
|
8
|
+
|
|
9
|
+
### ✅ Completed
|
|
10
|
+
|
|
11
|
+
1. **Project Structure** - Matches react-sample exactly:
|
|
12
|
+
- Root-level `index.html` with Mermaid CDN
|
|
13
|
+
- Root-level `vite.config.ts` with predictable output names
|
|
14
|
+
- `src/App.tsx` - Main PPTB component (392 lines)
|
|
15
|
+
- `src/main.tsx` - React entry point (10 lines)
|
|
16
|
+
- `src/styles.css` - PPTB-themed styles (260 lines)
|
|
17
|
+
|
|
18
|
+
2. **Build System**:
|
|
19
|
+
- Simplified scripts: `dev`, `build`, `preview`
|
|
20
|
+
- Vite produces exactly 3 files: `index.html`, `index.js`, `index.css`
|
|
21
|
+
- Build output: 79 modules, 195 KB JS bundle, 3 KB CSS
|
|
22
|
+
- Changed `type: "module"` in package.json
|
|
23
|
+
|
|
24
|
+
3. **TypeScript Configuration**:
|
|
25
|
+
- Updated to ES2020 target
|
|
26
|
+
- Module resolution: bundler
|
|
27
|
+
- JSX: react-jsx (automatic runtime)
|
|
28
|
+
- Created `tsconfig.node.json` for Vite
|
|
29
|
+
|
|
30
|
+
4. **Dependencies**:
|
|
31
|
+
- Removed: `@types/vscode`, `@types/node`, `vscode` peerDependency
|
|
32
|
+
- Added: `@pptb/types` for ToolBox API types
|
|
33
|
+
- Kept: React 18, TypeScript, Vite, axios
|
|
34
|
+
|
|
35
|
+
5. **PPTB Integration**:
|
|
36
|
+
- Direct `window.toolboxAPI` usage (no abstraction layer)
|
|
37
|
+
- `postMessage` listener for `TOOLBOX_CONTEXT`
|
|
38
|
+
- APIs used: `getToolContext`, `showNotification`, `saveFile`, `copyToClipboard`
|
|
39
|
+
|
|
40
|
+
6. **Cleanup**:
|
|
41
|
+
- Removed `src/view/` - old webview structure
|
|
42
|
+
- Removed `src/dvdtIntegration/` - VS Code integration
|
|
43
|
+
- Removed `src/types/pptb.d.ts` - superseded by @pptb/types
|
|
44
|
+
- Removed `src/models/platformApi.ts` - platform abstraction
|
|
45
|
+
- Removed `docs/` - old dual-mode documentation
|
|
46
|
+
- Removed `tsconfig.webview.json` - no longer needed
|
|
47
|
+
- Removed old README documentation files
|
|
48
|
+
|
|
49
|
+
7. **Documentation**:
|
|
50
|
+
- Rewrote README.md for PPTB focus
|
|
51
|
+
- Removed all DVDT references
|
|
52
|
+
- Added ToolBox API integration examples
|
|
53
|
+
- Simplified structure and usage sections
|
|
54
|
+
|
|
55
|
+
## File Structure (Final)
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
erd-generator/
|
|
59
|
+
├── src/
|
|
60
|
+
│ ├── App.tsx # Main PPTB component
|
|
61
|
+
│ ├── main.tsx # React entry point
|
|
62
|
+
│ ├── styles.css # PPTB-themed styles
|
|
63
|
+
│ ├── components/
|
|
64
|
+
│ │ └── ERDGenerator.ts # ERD generation logic
|
|
65
|
+
│ ├── models/
|
|
66
|
+
│ │ └── interfaces.ts # TypeScript interfaces
|
|
67
|
+
│ └── utils/
|
|
68
|
+
│ └── DataverseClient.ts # Dataverse API client
|
|
69
|
+
├── dist/ # Build output
|
|
70
|
+
│ ├── index.html
|
|
71
|
+
│ ├── index.js # 195 KB
|
|
72
|
+
│ └── index.css # 3 KB
|
|
73
|
+
├── index.html # Root HTML with Mermaid CDN
|
|
74
|
+
├── vite.config.ts # Vite config
|
|
75
|
+
├── tsconfig.json # TS config for React/Vite
|
|
76
|
+
├── tsconfig.node.json # TS config for Vite config
|
|
77
|
+
├── package.json # Simplified dependencies
|
|
78
|
+
└── README.md # PPTB-focused documentation
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Build Verification
|
|
82
|
+
|
|
83
|
+
✅ **Build Status**: Success
|
|
84
|
+
```bash
|
|
85
|
+
npm run build
|
|
86
|
+
# Output:
|
|
87
|
+
# vite v6.4.0 building for production...
|
|
88
|
+
# ✓ 79 modules transformed.
|
|
89
|
+
# dist/index.html 0.91 kB │ gzip: 0.47 kB
|
|
90
|
+
# dist/index.css 3.02 kB │ gzip: 1.04 kB
|
|
91
|
+
# dist/index.js 195.18 kB │ gzip: 64.91 kB
|
|
92
|
+
# ✓ built in 339ms
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
✅ **Dependencies**: 112 packages, 0 vulnerabilities
|
|
96
|
+
|
|
97
|
+
✅ **Output Structure**: Predictable filenames matching PPTB requirements
|
|
98
|
+
|
|
99
|
+
## Key Implementation Details
|
|
100
|
+
|
|
101
|
+
### PPTB Context Injection
|
|
102
|
+
|
|
103
|
+
The tool listens for `TOOLBOX_CONTEXT` via `postMessage`:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const handleMessage = (event: MessageEvent) => {
|
|
108
|
+
if (event.data && event.data.type === 'TOOLBOX_CONTEXT') {
|
|
109
|
+
const context = event.data.context;
|
|
110
|
+
setEnvironmentUrl(context.environmentUrl);
|
|
111
|
+
setAccessToken(context.accessToken);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
window.addEventListener('message', handleMessage);
|
|
116
|
+
return () => window.removeEventListener('message', handleMessage);
|
|
117
|
+
}, []);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### ToolBox API Usage
|
|
121
|
+
|
|
122
|
+
Direct integration with `window.toolboxAPI`:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// Get context
|
|
126
|
+
const context = await window.toolboxAPI.getToolContext();
|
|
127
|
+
|
|
128
|
+
// Show notification
|
|
129
|
+
await window.toolboxAPI.showNotification({
|
|
130
|
+
title: "Success",
|
|
131
|
+
body: "ERD generated successfully",
|
|
132
|
+
type: "success"
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Save file
|
|
136
|
+
await window.toolboxAPI.saveFile(fileName, content);
|
|
137
|
+
|
|
138
|
+
// Copy to clipboard
|
|
139
|
+
await window.toolboxAPI.copyToClipboard(text);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### ERD Generation Flow
|
|
143
|
+
|
|
144
|
+
1. User connects to Dataverse (context from PPTB)
|
|
145
|
+
2. Tool lists available solutions
|
|
146
|
+
3. User selects solution and configures options
|
|
147
|
+
4. Tool generates ERD in selected format (Mermaid/PlantUML/Graphviz)
|
|
148
|
+
5. Mermaid diagrams render visually
|
|
149
|
+
6. User can download or copy the diagram
|
|
150
|
+
|
|
151
|
+
## Testing Checklist
|
|
152
|
+
|
|
153
|
+
- [x] Build succeeds without errors
|
|
154
|
+
- [x] Output files have predictable names
|
|
155
|
+
- [x] Bundle size is reasonable (195 KB)
|
|
156
|
+
- [x] All DVDT code removed
|
|
157
|
+
- [x] TypeScript compiles without errors
|
|
158
|
+
- [x] Dependencies installed successfully
|
|
159
|
+
- [ ] Test in PowerPlatform ToolBox (requires PPTB environment)
|
|
160
|
+
- [ ] Verify TOOLBOX_CONTEXT injection works
|
|
161
|
+
- [ ] Test Dataverse connection and solution listing
|
|
162
|
+
- [ ] Test ERD generation in all formats
|
|
163
|
+
- [ ] Test download and copy functionality
|
|
164
|
+
|
|
165
|
+
## Next Steps
|
|
166
|
+
|
|
167
|
+
1. **Test in PPTB**: Load the tool in PowerPlatform ToolBox
|
|
168
|
+
2. **Verify Integration**: Ensure `TOOLBOX_CONTEXT` injection works
|
|
169
|
+
3. **End-to-End Testing**: Connect to Dataverse, generate ERDs
|
|
170
|
+
4. **Performance**: Verify load times and responsiveness
|
|
171
|
+
5. **Documentation**: Update any parent repository docs
|
|
172
|
+
|
|
173
|
+
## Migration Date
|
|
174
|
+
|
|
175
|
+
Completed: January 2025
|
|
176
|
+
|
|
177
|
+
## References
|
|
178
|
+
|
|
179
|
+
- React Sample Structure: https://github.com/PowerPlatformToolBox/sample-tools/tree/main/react-sample
|
|
180
|
+
- PPTB Types Package: @pptb/types
|
|
181
|
+
- Vite Documentation: https://vite.dev/
|