@gxp-dev/tools 2.0.5
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/.github/workflows/npm-publish.yml +48 -0
- package/CLAUDE.md +400 -0
- package/README.md +247 -0
- package/REFACTOR_PLAN.md +194 -0
- package/bin/gx-devtools.js +87 -0
- package/bin/lib/cli.js +251 -0
- package/bin/lib/commands/assets.js +337 -0
- package/bin/lib/commands/build.js +259 -0
- package/bin/lib/commands/datastore.js +433 -0
- package/bin/lib/commands/dev.js +328 -0
- package/bin/lib/commands/extensions.js +298 -0
- package/bin/lib/commands/index.js +35 -0
- package/bin/lib/commands/init.js +307 -0
- package/bin/lib/commands/publish.js +189 -0
- package/bin/lib/commands/socket.js +158 -0
- package/bin/lib/commands/ssl.js +47 -0
- package/bin/lib/constants.js +120 -0
- package/bin/lib/tui/App.tsx +600 -0
- package/bin/lib/tui/components/CommandInput.tsx +278 -0
- package/bin/lib/tui/components/GeminiPanel.tsx +161 -0
- package/bin/lib/tui/components/Header.tsx +27 -0
- package/bin/lib/tui/components/LogPanel.tsx +122 -0
- package/bin/lib/tui/components/TabBar.tsx +56 -0
- package/bin/lib/tui/components/WelcomeScreen.tsx +80 -0
- package/bin/lib/tui/index.tsx +63 -0
- package/bin/lib/tui/services/ExtensionService.ts +122 -0
- package/bin/lib/tui/services/GeminiService.ts +395 -0
- package/bin/lib/tui/services/ServiceManager.ts +336 -0
- package/bin/lib/tui/services/SocketService.ts +204 -0
- package/bin/lib/tui/services/ViteService.ts +107 -0
- package/bin/lib/tui/services/index.ts +13 -0
- package/bin/lib/utils/files.js +180 -0
- package/bin/lib/utils/index.js +17 -0
- package/bin/lib/utils/paths.js +138 -0
- package/bin/lib/utils/prompts.js +71 -0
- package/bin/lib/utils/ssl.js +233 -0
- package/browser-extensions/README.md +1 -0
- package/browser-extensions/chrome/background.js +857 -0
- package/browser-extensions/chrome/content.js +51 -0
- package/browser-extensions/chrome/devtools.html +9 -0
- package/browser-extensions/chrome/devtools.js +23 -0
- package/browser-extensions/chrome/icons/gx_off_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_64.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_64.png +0 -0
- package/browser-extensions/chrome/inspector.js +1087 -0
- package/browser-extensions/chrome/manifest.json +70 -0
- package/browser-extensions/chrome/panel.html +638 -0
- package/browser-extensions/chrome/panel.js +862 -0
- package/browser-extensions/chrome/popup.html +399 -0
- package/browser-extensions/chrome/popup.js +515 -0
- package/browser-extensions/chrome/rules.json +1 -0
- package/browser-extensions/chrome/test-chrome.html +145 -0
- package/browser-extensions/chrome/test-mixed-content.html +190 -0
- package/browser-extensions/chrome/test-uri-pattern.html +199 -0
- package/browser-extensions/firefox/README.md +134 -0
- package/browser-extensions/firefox/background.js +804 -0
- package/browser-extensions/firefox/content.js +120 -0
- package/browser-extensions/firefox/debug-errors.html +229 -0
- package/browser-extensions/firefox/debug-https.html +113 -0
- package/browser-extensions/firefox/devtools.html +9 -0
- package/browser-extensions/firefox/devtools.js +24 -0
- package/browser-extensions/firefox/icons/gx_off_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_64.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_64.png +0 -0
- package/browser-extensions/firefox/inspector.js +1087 -0
- package/browser-extensions/firefox/manifest.json +67 -0
- package/browser-extensions/firefox/panel.html +638 -0
- package/browser-extensions/firefox/panel.js +862 -0
- package/browser-extensions/firefox/popup.html +525 -0
- package/browser-extensions/firefox/popup.js +536 -0
- package/browser-extensions/firefox/test-gramercy.html +126 -0
- package/browser-extensions/firefox/test-imports.html +58 -0
- package/browser-extensions/firefox/test-masking.html +147 -0
- package/browser-extensions/firefox/test-uri-pattern.html +199 -0
- package/docs/DOCUSAURUS_IMPORT.md +378 -0
- package/docs/_category_.json +8 -0
- package/docs/app-manifest.md +272 -0
- package/docs/building-for-platform.md +315 -0
- package/docs/dev-tools.md +291 -0
- package/docs/getting-started.md +180 -0
- package/docs/gxp-store.md +305 -0
- package/docs/index.md +44 -0
- package/package.json +77 -0
- package/runtime/PortalContainer.vue +326 -0
- package/runtime/dev-tools/DevToolsModal.vue +217 -0
- package/runtime/dev-tools/LayoutSwitcher.vue +221 -0
- package/runtime/dev-tools/MockDataEditor.vue +621 -0
- package/runtime/dev-tools/SocketSimulator.vue +562 -0
- package/runtime/dev-tools/StoreInspector.vue +644 -0
- package/runtime/dev-tools/index.js +6 -0
- package/runtime/gxpStringsPlugin.js +428 -0
- package/runtime/index.html +22 -0
- package/runtime/main.js +32 -0
- package/runtime/mock-api/auth-middleware.js +97 -0
- package/runtime/mock-api/image-generator.js +221 -0
- package/runtime/mock-api/index.js +197 -0
- package/runtime/mock-api/response-generator.js +394 -0
- package/runtime/mock-api/route-generator.js +323 -0
- package/runtime/mock-api/socket-triggers.js +371 -0
- package/runtime/mock-api/spec-loader.js +300 -0
- package/runtime/server.js +180 -0
- package/runtime/stores/gxpPortalConfigStore.js +554 -0
- package/runtime/stores/index.js +6 -0
- package/runtime/vite-inspector-plugin.js +749 -0
- package/runtime/vite-source-tracker-plugin.js +232 -0
- package/runtime/vite.config.js +402 -0
- package/scripts/launch-chrome.js +90 -0
- package/scripts/pack-chrome.js +91 -0
- package/socket-events/AiSessionMessageCreated.json +18 -0
- package/socket-events/SocialStreamPostCreated.json +24 -0
- package/socket-events/SocialStreamPostVariantCompleted.json +23 -0
- package/template/README.md +332 -0
- package/template/app-manifest.json +32 -0
- package/template/dev-assets/images/avatar-placeholder.png +0 -0
- package/template/dev-assets/images/background-placeholder.jpg +0 -0
- package/template/dev-assets/images/banner-placeholder.jpg +0 -0
- package/template/dev-assets/images/icon-placeholder.png +0 -0
- package/template/dev-assets/images/logo-placeholder.png +0 -0
- package/template/dev-assets/images/product-placeholder.jpg +0 -0
- package/template/dev-assets/images/thumbnail-placeholder.jpg +0 -0
- package/template/env.example +51 -0
- package/template/gitignore +53 -0
- package/template/index.html +22 -0
- package/template/main.js +28 -0
- package/template/src/DemoPage.vue +459 -0
- package/template/src/Plugin.vue +38 -0
- package/template/src/stores/index.js +9 -0
- package/template/src/stores/test-data.json +173 -0
- package/template/theme-layouts/AdditionalStyling.css +0 -0
- package/template/theme-layouts/PrivateLayout.vue +39 -0
- package/template/theme-layouts/PublicLayout.vue +39 -0
- package/template/theme-layouts/SystemLayout.vue +39 -0
- package/template/vite.config.js +333 -0
- package/tsconfig.tui.json +21 -0
- package/vite.config.js +164 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Patch and Publish to GitHub Packages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
packages: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- name: Configure Git
|
|
20
|
+
run: |
|
|
21
|
+
git config user.name github-actions
|
|
22
|
+
git config user.email github-actions@github.com
|
|
23
|
+
- name: Force git pull and overwrite local files
|
|
24
|
+
run: |
|
|
25
|
+
# DANGER! This wipes any local changes and untracked files
|
|
26
|
+
git fetch --all
|
|
27
|
+
git reset --hard origin/${{ github.ref_name }}
|
|
28
|
+
git pull
|
|
29
|
+
- uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: "22.x"
|
|
32
|
+
registry-url: "https://registry.npmjs.org"
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: npm ci
|
|
36
|
+
- name: Build the TUI
|
|
37
|
+
run: npm run build:tui
|
|
38
|
+
|
|
39
|
+
- name: Patch version
|
|
40
|
+
run: |
|
|
41
|
+
npm version patch
|
|
42
|
+
git push
|
|
43
|
+
git push --tags
|
|
44
|
+
|
|
45
|
+
- name: Publish to NPM Packages
|
|
46
|
+
run: npm publish
|
|
47
|
+
env:
|
|
48
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
GxP Dev Devtools (`@gramercytech/gx-devtools`) is an npm package for creating platform plugins for the GxP kiosk platform. It provides:
|
|
8
|
+
|
|
9
|
+
## Quick Start (New Developer)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 1. Clone and install dependencies
|
|
13
|
+
git clone <repo>
|
|
14
|
+
cd gx-devtools
|
|
15
|
+
npm install
|
|
16
|
+
|
|
17
|
+
# 2. Build the TUI (required for CLI to work)
|
|
18
|
+
npm run build:tui
|
|
19
|
+
|
|
20
|
+
# 3. Link the package globally for local development
|
|
21
|
+
npm link
|
|
22
|
+
|
|
23
|
+
# 4. Create a new test project
|
|
24
|
+
mkdir ~/test-plugin && cd ~/test-plugin
|
|
25
|
+
gxdev init my-plugin
|
|
26
|
+
|
|
27
|
+
# 5. Start development
|
|
28
|
+
gxdev dev --no-https # or just: npm run dev-http
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
GxP Dev Devtools provides:
|
|
34
|
+
- CLI tool (`gxdev`) for project scaffolding and development
|
|
35
|
+
- Interactive TUI (Terminal UI) for managing dev services
|
|
36
|
+
- Vite-based development server with HTTPS support
|
|
37
|
+
- Socket.IO server for real-time event simulation
|
|
38
|
+
- Browser extensions (Chrome/Firefox) for testing plugins in production environments
|
|
39
|
+
- Project templates with Vue 3 and Pinia integration
|
|
40
|
+
- GxP Strings Plugin for reactive string/asset replacement
|
|
41
|
+
|
|
42
|
+
## Common Commands
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Development
|
|
46
|
+
npm run dev # Start HTTPS dev server with Socket.IO
|
|
47
|
+
npm run dev-app # Start HTTPS dev server only
|
|
48
|
+
npm run dev-http # Start HTTP dev server (no SSL)
|
|
49
|
+
npm run build # Build plugin for production
|
|
50
|
+
|
|
51
|
+
# SSL Setup
|
|
52
|
+
npm run setup-ssl # Generate SSL certificates via mkcert
|
|
53
|
+
|
|
54
|
+
# CLI Commands (gxdev)
|
|
55
|
+
gxdev # Launch interactive TUI
|
|
56
|
+
gxdev init [name] # Create new project or update existing
|
|
57
|
+
gxdev dev # Start dev server (launches TUI + auto-starts Vite)
|
|
58
|
+
gxdev dev --no-https # Start without SSL
|
|
59
|
+
gxdev dev --with-socket # Start with Socket.IO server
|
|
60
|
+
gxdev dev --chrome # Start dev server and launch Chrome with extension
|
|
61
|
+
gxdev dev --firefox # Start dev server and launch Firefox with extension
|
|
62
|
+
gxdev build # Build for production
|
|
63
|
+
gxdev publish <file> # Copy package files to local project
|
|
64
|
+
|
|
65
|
+
# Datastore Management
|
|
66
|
+
gxdev datastore list # List store variables
|
|
67
|
+
gxdev datastore add # Add new variable
|
|
68
|
+
gxdev datastore scan-strings # Scan components for hardcoded strings
|
|
69
|
+
|
|
70
|
+
# Socket Simulation
|
|
71
|
+
gxdev socket list # List available socket events
|
|
72
|
+
gxdev socket send --event <EventName> # Send test socket event
|
|
73
|
+
|
|
74
|
+
# Asset Management
|
|
75
|
+
gxdev assets list # List development assets
|
|
76
|
+
gxdev assets init # Initialize asset directories
|
|
77
|
+
gxdev assets generate --size 400x300 --name placeholder # Generate placeholder images
|
|
78
|
+
|
|
79
|
+
# Browser Extensions
|
|
80
|
+
gxdev ext:firefox # Launch Firefox with extension
|
|
81
|
+
gxdev ext:chrome # Launch Chrome with extension
|
|
82
|
+
gxdev ext:build # Build extensions for distribution
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Architecture
|
|
86
|
+
|
|
87
|
+
### Directory Structure
|
|
88
|
+
```
|
|
89
|
+
gx-devtools/
|
|
90
|
+
├── bin/ # CLI tool
|
|
91
|
+
│ ├── gx-devtools.js # Main CLI entry point
|
|
92
|
+
│ └── lib/
|
|
93
|
+
│ ├── cli.js # Yargs CLI setup and command routing
|
|
94
|
+
│ ├── constants.js # Shared constants (dependencies, scripts, ports)
|
|
95
|
+
│ ├── commands/ # Command modules (init, dev, build, etc.)
|
|
96
|
+
│ ├── utils/ # Utility modules (paths, ssl, files, prompts)
|
|
97
|
+
│ └── tui/ # Interactive Terminal UI (TypeScript/Ink)
|
|
98
|
+
│ ├── index.tsx # TUI entry point
|
|
99
|
+
│ ├── App.tsx # Main Ink application
|
|
100
|
+
│ ├── components/ # UI components (Header, TabBar, LogPanel, etc.)
|
|
101
|
+
│ ├── services/ # Service managers (Vite, Socket, Extensions)
|
|
102
|
+
│ └── commands/ # TUI slash command handlers
|
|
103
|
+
├── runtime/ # Files used from node_modules (NOT copied to projects)
|
|
104
|
+
│ ├── PortalContainer.vue # Platform emulator
|
|
105
|
+
│ ├── server.js # Socket.IO server
|
|
106
|
+
│ ├── gxpStringsPlugin.js # Vue plugin for gxp-string/gxp-src directives
|
|
107
|
+
│ ├── dev-tools/ # In-browser development tools
|
|
108
|
+
│ │ ├── DevToolsModal.vue
|
|
109
|
+
│ │ ├── StoreInspector.vue # Store inspector with element highlighting
|
|
110
|
+
│ │ ├── LayoutSwitcher.vue
|
|
111
|
+
│ │ ├── SocketSimulator.vue
|
|
112
|
+
│ │ └── MockDataEditor.vue
|
|
113
|
+
│ └── stores/
|
|
114
|
+
│ └── gxpPortalConfigStore.js # Core Pinia store
|
|
115
|
+
├── template/ # Files copied to new projects during `gxdev init`
|
|
116
|
+
│ ├── src/
|
|
117
|
+
│ │ ├── Plugin.vue # User's app entry point
|
|
118
|
+
│ │ ├── DemoPage.vue # Example component with gxp-string usage
|
|
119
|
+
│ │ └── stores/ # Store setup
|
|
120
|
+
│ ├── theme-layouts/ # Layout components (System, Private, Public)
|
|
121
|
+
│ ├── dev-assets/images/ # Placeholder images for development
|
|
122
|
+
│ ├── main.js # Dev entry point
|
|
123
|
+
│ ├── vite.config.js # Project vite config
|
|
124
|
+
│ ├── app-manifest.json # Configuration manifest (settings, strings, assets)
|
|
125
|
+
│ └── index.html # Dev HTML template
|
|
126
|
+
├── socket-events/ # Socket event templates for simulation
|
|
127
|
+
├── browser-extensions/ # Chrome and Firefox extensions
|
|
128
|
+
│ ├── chrome/ # Manifest V3 extension with DevTools panel
|
|
129
|
+
│ └── firefox/ # Firefox-compatible extension
|
|
130
|
+
├── scripts/ # Browser extension launch/pack scripts
|
|
131
|
+
└── dist/ # Compiled TUI output
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Key Concepts
|
|
135
|
+
|
|
136
|
+
**Runtime vs Template:**
|
|
137
|
+
- `/runtime/` - Files that stay in node_modules and are imported at runtime
|
|
138
|
+
- `/template/` - Files copied to user projects during `gxdev init`
|
|
139
|
+
|
|
140
|
+
**Plugin Architecture:**
|
|
141
|
+
1. **PortalContainer.vue** (runtime) - Platform emulator with mock router, theme, data
|
|
142
|
+
2. **Plugin.vue** (template) - User's app entry point, compiled for production
|
|
143
|
+
3. Props injected by platform: `pluginVars`, `dependencyList`, `assetUrls`, `stringsList`, `permissionFlags`, `theme`, `router`
|
|
144
|
+
|
|
145
|
+
**Vite Aliases (in template/vite.config.js):**
|
|
146
|
+
- `@` → Project's `src/` directory
|
|
147
|
+
- `@layouts` → Project's `theme-layouts/` directory
|
|
148
|
+
- `@gx-runtime` → Devtools's `runtime/` directory (from node_modules)
|
|
149
|
+
|
|
150
|
+
## App Manifest Configuration
|
|
151
|
+
|
|
152
|
+
The `app-manifest.json` file in the project root configures the plugin:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"settings": {
|
|
157
|
+
"primary_color": "#FFD600",
|
|
158
|
+
"background_color": "#ffffff",
|
|
159
|
+
"custom_setting": "value"
|
|
160
|
+
},
|
|
161
|
+
"strings": {
|
|
162
|
+
"default": {
|
|
163
|
+
"welcome_title": "Welcome to My Plugin",
|
|
164
|
+
"button_text": "Click Me"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"assets": {
|
|
168
|
+
"hero_image": "/dev-assets/images/hero.jpg",
|
|
169
|
+
"logo": "/dev-assets/images/logo.png"
|
|
170
|
+
},
|
|
171
|
+
"triggerState": {
|
|
172
|
+
"is_active": true,
|
|
173
|
+
"current_step": 1
|
|
174
|
+
},
|
|
175
|
+
"dependencies": [],
|
|
176
|
+
"permissions": []
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The manifest is hot-reloaded during development - changes are reflected immediately without page refresh.
|
|
181
|
+
|
|
182
|
+
## GxP Strings Plugin
|
|
183
|
+
|
|
184
|
+
The devtools provides Vue directives for reactive string and asset replacement from the store.
|
|
185
|
+
|
|
186
|
+
### String Directives
|
|
187
|
+
|
|
188
|
+
```html
|
|
189
|
+
<!-- Replace text content with value from stringsList -->
|
|
190
|
+
<h1 gxp-string="welcome_title">Default Welcome</h1>
|
|
191
|
+
|
|
192
|
+
<!-- Replace text with value from pluginVars (settings) -->
|
|
193
|
+
<span gxp-string="company_name" gxp-settings>Default Company</span>
|
|
194
|
+
|
|
195
|
+
<!-- Replace text with value from assetList -->
|
|
196
|
+
<span gxp-string="logo_url" gxp-assets>/default/logo.png</span>
|
|
197
|
+
|
|
198
|
+
<!-- Replace text with value from triggerState -->
|
|
199
|
+
<span gxp-string="current_status" gxp-state>idle</span>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Asset/Image Directives
|
|
203
|
+
|
|
204
|
+
```html
|
|
205
|
+
<!-- Replace src attribute with value from assetList (default) -->
|
|
206
|
+
<img gxp-src="hero_image" src="/dev-assets/placeholder.jpg" />
|
|
207
|
+
|
|
208
|
+
<!-- Replace src with value from triggerState -->
|
|
209
|
+
<img gxp-src="dynamic_image" gxp-state src="/dev-assets/placeholder.jpg" />
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### How It Works
|
|
213
|
+
1. Elements store their original content as the default fallback
|
|
214
|
+
2. The plugin looks up the key in the appropriate store section
|
|
215
|
+
3. Content/attribute is replaced if a value exists
|
|
216
|
+
4. Falls back to original if no value found
|
|
217
|
+
5. Watches for store changes and updates reactively
|
|
218
|
+
|
|
219
|
+
## GxP Store (gxpPortalConfigStore.js)
|
|
220
|
+
|
|
221
|
+
The Pinia store provides reactive state management:
|
|
222
|
+
|
|
223
|
+
### Store Sections
|
|
224
|
+
- `pluginVars` - Plugin settings/configuration
|
|
225
|
+
- `stringsList` - Translatable strings
|
|
226
|
+
- `assetList` - Asset URLs
|
|
227
|
+
- `triggerState` - Dynamic state values
|
|
228
|
+
- `dependencyList` - External dependencies
|
|
229
|
+
- `permissionFlags` - Feature permissions
|
|
230
|
+
|
|
231
|
+
### Getter Methods
|
|
232
|
+
```javascript
|
|
233
|
+
const store = useGxpStore();
|
|
234
|
+
store.getString('welcome_title', 'Default');
|
|
235
|
+
store.getSetting('primary_color', '#000');
|
|
236
|
+
store.getAsset('hero_image', '/fallback.jpg');
|
|
237
|
+
store.getState('is_active', false);
|
|
238
|
+
store.hasPermission('admin');
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Update Methods (for programmatic updates)
|
|
242
|
+
```javascript
|
|
243
|
+
store.updateString('welcome_title', 'New Title');
|
|
244
|
+
store.updateSetting('primary_color', '#FF0000');
|
|
245
|
+
store.updateAsset('hero_image', '/new-image.jpg');
|
|
246
|
+
store.updateState('is_active', true);
|
|
247
|
+
store.addDevAsset('logo', 'logo.png'); // Adds with dev server URL prefix
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### API Client
|
|
251
|
+
```javascript
|
|
252
|
+
await store.apiGet('/endpoint', { params });
|
|
253
|
+
await store.apiPost('/endpoint', data);
|
|
254
|
+
await store.apiPut('/endpoint', data);
|
|
255
|
+
await store.apiDelete('/endpoint');
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Socket Methods
|
|
259
|
+
```javascript
|
|
260
|
+
store.emitSocket('primary', 'event-name', data);
|
|
261
|
+
store.listenSocket('primary', 'event-name', callback);
|
|
262
|
+
store.useSocketListener('dependency-id', 'updated', callback);
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Dev Tools
|
|
266
|
+
|
|
267
|
+
### In-Browser Dev Tools (Ctrl+Shift+D)
|
|
268
|
+
- **Store Inspector** - View/edit store state with element highlighting
|
|
269
|
+
- Hover over keys to highlight matching elements on the page
|
|
270
|
+
- Double-click values to edit them in real-time
|
|
271
|
+
- **Layout Switcher** - Toggle between Public, Private, and System layouts
|
|
272
|
+
- **Socket Simulator** - Send test socket events
|
|
273
|
+
- **Mock Data Editor** - Edit theme colors, navigation, permissions
|
|
274
|
+
|
|
275
|
+
### Console API
|
|
276
|
+
```javascript
|
|
277
|
+
window.gxDevTools.open() // Open dev tools
|
|
278
|
+
window.gxDevTools.close() // Close dev tools
|
|
279
|
+
window.gxDevTools.toggle() // Toggle dev tools
|
|
280
|
+
window.gxDevTools.store() // Access the GxP store
|
|
281
|
+
window.gxDevTools.setLayout('private') // Change layout
|
|
282
|
+
window.gxDevTools.getLayout() // Get current layout name
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Browser Extensions
|
|
286
|
+
|
|
287
|
+
The browser extensions provide a DevTools panel for inspecting Vue components and GxP elements.
|
|
288
|
+
|
|
289
|
+
### Features
|
|
290
|
+
- **Element Selection** - Click to select elements on the page
|
|
291
|
+
- **Visual Highlighting** - Hover shows orange dashed border, selected shows cyan pulsing glow
|
|
292
|
+
- **Smart Labels** - Format: `ComponentName::element::gxp-string-key`
|
|
293
|
+
- Example: `DemoPage::h1::welcome_title`
|
|
294
|
+
- **String Extraction** - Extract hardcoded strings to gxp-string attributes
|
|
295
|
+
- **Component Inspector** - View Vue component props and data
|
|
296
|
+
|
|
297
|
+
### Extension Launch
|
|
298
|
+
Extensions automatically open to the dev server URL when launched:
|
|
299
|
+
```bash
|
|
300
|
+
gxdev dev --chrome # Launches Chrome to https://localhost:3060
|
|
301
|
+
gxdev dev --firefox # Launches Firefox to https://localhost:3060
|
|
302
|
+
gxdev dev --no-https --chrome # Launches to http://localhost:3060
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Reloading Extensions
|
|
306
|
+
After modifying extension code in `browser-extensions/`:
|
|
307
|
+
- Chrome: Go to `chrome://extensions`, click refresh on GxP Inspector
|
|
308
|
+
- Firefox: Go to `about:debugging`, reload the extension
|
|
309
|
+
|
|
310
|
+
## Interactive TUI
|
|
311
|
+
|
|
312
|
+
The `gxdev` command launches an interactive terminal UI:
|
|
313
|
+
|
|
314
|
+
### TUI Slash Commands
|
|
315
|
+
- `/dev` - Start Vite dev server
|
|
316
|
+
- `/dev --no-https` - Start without SSL
|
|
317
|
+
- `/socket` - Start Socket.IO server
|
|
318
|
+
- `/ext chrome` - Launch Chrome extension
|
|
319
|
+
- `/ext firefox` - Launch Firefox extension
|
|
320
|
+
- `/stop <service>` - Stop a running service
|
|
321
|
+
- `/clear` - Clear current tab's logs
|
|
322
|
+
- `/quit` - Exit application
|
|
323
|
+
|
|
324
|
+
### Keyboard Shortcuts
|
|
325
|
+
- `Ctrl+1/2/3...` - Switch between service tabs
|
|
326
|
+
- `Ctrl+L` - Clear current log
|
|
327
|
+
- `Ctrl+C` - Exit application
|
|
328
|
+
- `Up/Down` - Scroll log panel
|
|
329
|
+
- `Tab` - Focus next element
|
|
330
|
+
|
|
331
|
+
## Environment Configuration
|
|
332
|
+
|
|
333
|
+
Key environment variables (set in `.env`):
|
|
334
|
+
- `NODE_PORT` - Development server port (default: 3060)
|
|
335
|
+
- `SOCKET_IO_PORT` - Socket.IO server port (default: 3069)
|
|
336
|
+
- `COMPONENT_PATH` - Main component path (default: `./src/Plugin.vue`)
|
|
337
|
+
- `USE_HTTPS` - Enable HTTPS (default: true)
|
|
338
|
+
- `CERT_PATH`, `KEY_PATH` - SSL certificate paths
|
|
339
|
+
|
|
340
|
+
## Key Dependencies
|
|
341
|
+
- Vue 3 with Composition API
|
|
342
|
+
- Pinia for state management
|
|
343
|
+
- Vite for building
|
|
344
|
+
- Socket.IO for real-time communication
|
|
345
|
+
- Ink (React-based TUI framework) for CLI interface
|
|
346
|
+
- `@gramercytech/gx-componentkit` - Component library for kiosk UI
|
|
347
|
+
|
|
348
|
+
## Building the Devtools
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# Build the TUI (TypeScript → JavaScript)
|
|
352
|
+
npm run build:tui
|
|
353
|
+
|
|
354
|
+
# Watch mode for TUI development
|
|
355
|
+
npm run dev:tui
|
|
356
|
+
|
|
357
|
+
# Build browser extensions for distribution
|
|
358
|
+
npm run ext:build
|
|
359
|
+
|
|
360
|
+
# Full build
|
|
361
|
+
npm run build
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Customizing Runtime Files
|
|
365
|
+
|
|
366
|
+
If you need to customize files from the runtime directory:
|
|
367
|
+
```bash
|
|
368
|
+
gxdev publish server.js # Copy server.js to project root
|
|
369
|
+
gxdev publish gxpPortalConfigStore.js # Copy store to src/stores/
|
|
370
|
+
```
|
|
371
|
+
The CLI will automatically update imports when publishing.
|
|
372
|
+
|
|
373
|
+
## Testing Plugins
|
|
374
|
+
|
|
375
|
+
1. Run `npm run dev` or `gxdev dev` to start the development server
|
|
376
|
+
2. Use browser extensions (`gxdev dev --chrome` or `gxdev dev --firefox`) to inject and test plugins
|
|
377
|
+
3. Use `gxdev socket send --event <name>` to simulate real-time events
|
|
378
|
+
4. Edit `app-manifest.json` to test different configurations (hot-reloaded)
|
|
379
|
+
5. Use Dev Tools (Ctrl+Shift+D) to inspect and modify store state in real-time
|
|
380
|
+
|
|
381
|
+
## Troubleshooting
|
|
382
|
+
|
|
383
|
+
### Strings not updating from manifest
|
|
384
|
+
- Ensure `app-manifest.json` exists in project root
|
|
385
|
+
- Check that string keys match between manifest and gxp-string attributes
|
|
386
|
+
- The manifest is loaded asynchronously - first render may show defaults
|
|
387
|
+
|
|
388
|
+
### Browser extension not highlighting elements
|
|
389
|
+
- Reload the extension after code changes
|
|
390
|
+
- Ensure the inspector is injected (check console for `[GxP Inspector] Loaded`)
|
|
391
|
+
- The page must be the dev server URL for the inspector to work
|
|
392
|
+
|
|
393
|
+
### SSL certificate errors
|
|
394
|
+
- Run `npm run setup-ssl` to generate certificates with mkcert
|
|
395
|
+
- Accept the certificate in your browser when prompted
|
|
396
|
+
|
|
397
|
+
### Hot reload not working
|
|
398
|
+
- Check that Vite is running (look for `VITE ready` in logs)
|
|
399
|
+
- Ensure file is within the watched directories
|
|
400
|
+
- Try a full page refresh if HMR fails
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# GxP Dev Tools
|
|
2
|
+
|
|
3
|
+
A development devtools for creating plugins for the GxP kiosk platform. This package provides CLI tools, project scaffolding, and a development environment that emulates the GxP platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @gramercytech/gx-devtools
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use it as a dev dependency in your project:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install --save-dev @gramercytech/gx-devtools
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Create a new GxP plugin project:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
gxdev init my-plugin
|
|
23
|
+
cd my-plugin
|
|
24
|
+
git init
|
|
25
|
+
git submodule add git@bitbucket.org:gramercytech/z-plugin-components.git src/z-components
|
|
26
|
+
git submodule update
|
|
27
|
+
npm run dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## CLI Commands
|
|
31
|
+
|
|
32
|
+
| Command | Description |
|
|
33
|
+
|---------|-------------|
|
|
34
|
+
| `gxdev init [name]` | Create a new project or update an existing one |
|
|
35
|
+
| `gxdev dev` | Start development server with HTTPS and Socket.IO |
|
|
36
|
+
| `gxdev dev --no-https` | Start development server with HTTP only |
|
|
37
|
+
| `gxdev build` | Build plugin for production |
|
|
38
|
+
| `gxdev setup-ssl` | Generate SSL certificates for HTTPS development |
|
|
39
|
+
| `gxdev publish <file>` | Copy runtime files to your project for customization |
|
|
40
|
+
| `gxdev datastore <action>` | Manage GxP datastore (list, add, scan-strings, config) |
|
|
41
|
+
| `gxdev socket <action>` | Simulate socket events (list, send) |
|
|
42
|
+
| `gxdev assets <action>` | Manage development assets (list, init, generate) |
|
|
43
|
+
| `gxdev ext:firefox` | Launch Firefox with browser extension |
|
|
44
|
+
| `gxdev ext:chrome` | Launch Chrome with browser extension |
|
|
45
|
+
| `gxdev ext:build` | Build browser extensions for distribution |
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **Platform Emulator**: PortalContainer.vue mimics the GxP platform environment
|
|
50
|
+
- **Hot Module Replacement**: Instant updates during development
|
|
51
|
+
- **Socket.IO Integration**: Test real-time features with simulated events
|
|
52
|
+
- **SSL Support**: HTTPS development with auto-generated certificates
|
|
53
|
+
- **Browser Extensions**: Test plugins on live GxP pages
|
|
54
|
+
- **Dev Tools Modal**: In-browser tools for inspecting state, switching layouts, and more
|
|
55
|
+
- **Asset Generation**: Create placeholder images for development
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# DevTools Development Guide
|
|
60
|
+
|
|
61
|
+
This section is for developers contributing to the devtools itself.
|
|
62
|
+
|
|
63
|
+
## Repository Structure
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
gx-devtools/
|
|
67
|
+
├── bin/ # CLI tool
|
|
68
|
+
│ ├── gx-devtools.js # Entry point (delegates to lib/cli.js)
|
|
69
|
+
│ └── lib/ # Modular CLI components
|
|
70
|
+
│ ├── cli.js # Yargs command definitions
|
|
71
|
+
│ ├── constants.js # Dependencies, scripts, ports
|
|
72
|
+
│ ├── commands/ # Individual command modules
|
|
73
|
+
│ │ ├── init.js # gxdev init
|
|
74
|
+
│ │ ├── dev.js # gxdev dev
|
|
75
|
+
│ │ ├── build.js # gxdev build
|
|
76
|
+
│ │ ├── publish.js # gxdev publish
|
|
77
|
+
│ │ ├── ssl.js # gxdev setup-ssl
|
|
78
|
+
│ │ ├── datastore.js
|
|
79
|
+
│ │ ├── socket.js
|
|
80
|
+
│ │ ├── assets.js
|
|
81
|
+
│ │ └── extensions.js
|
|
82
|
+
│ └── utils/ # Shared utilities
|
|
83
|
+
│ ├── paths.js # Path resolution
|
|
84
|
+
│ ├── ssl.js # SSL certificate management
|
|
85
|
+
│ ├── files.js # File operations
|
|
86
|
+
│ └── prompts.js # User prompts
|
|
87
|
+
├── runtime/ # Files used from node_modules (NOT copied to projects)
|
|
88
|
+
│ ├── PortalContainer.vue # Platform emulator (immutable for users)
|
|
89
|
+
│ ├── server.js # Socket.IO development server
|
|
90
|
+
│ ├── dev-tools/ # In-browser development tools
|
|
91
|
+
│ │ ├── DevToolsModal.vue
|
|
92
|
+
│ │ ├── StoreInspector.vue
|
|
93
|
+
│ │ ├── LayoutSwitcher.vue
|
|
94
|
+
│ │ ├── SocketSimulator.vue
|
|
95
|
+
│ │ └── MockDataEditor.vue
|
|
96
|
+
│ └── stores/
|
|
97
|
+
│ └── gxpPortalConfigStore.js # Core Pinia store
|
|
98
|
+
├── template/ # Files copied to new projects during init
|
|
99
|
+
│ ├── src/
|
|
100
|
+
│ │ ├── Plugin.vue # User's app entry point
|
|
101
|
+
│ │ ├── DemoPage.vue # Example component
|
|
102
|
+
│ │ └── stores/ # Store setup
|
|
103
|
+
│ ├── theme-layouts/ # Layout templates
|
|
104
|
+
│ ├── dev-assets/ # Placeholder images
|
|
105
|
+
│ ├── main.js # Dev entry point
|
|
106
|
+
│ ├── vite.config.js # Project build config
|
|
107
|
+
│ └── ...
|
|
108
|
+
├── socket-events/ # Socket event templates for simulation
|
|
109
|
+
├── browser-extensions/ # Chrome and Firefox extensions
|
|
110
|
+
│ ├── chrome/
|
|
111
|
+
│ └── firefox/
|
|
112
|
+
└── scripts/ # Build and launch scripts
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Key Concepts
|
|
116
|
+
|
|
117
|
+
### Runtime vs Template
|
|
118
|
+
|
|
119
|
+
- **`/runtime/`**: Files that stay in node_modules and are imported at runtime via the `@gx-runtime` Vite alias. Users cannot modify these files directly.
|
|
120
|
+
|
|
121
|
+
- **`/template/`**: Files copied to user projects during `gxdev init`. Users can edit these files.
|
|
122
|
+
|
|
123
|
+
### Vite Aliases
|
|
124
|
+
|
|
125
|
+
Projects use these aliases (defined in `template/vite.config.js`):
|
|
126
|
+
|
|
127
|
+
- `@` → Project's `src/` directory
|
|
128
|
+
- `@layouts` → Project's `theme-layouts/` directory
|
|
129
|
+
- `@gx-runtime` → DevTools's `runtime/` directory (from node_modules)
|
|
130
|
+
|
|
131
|
+
### PortalContainer.vue
|
|
132
|
+
|
|
133
|
+
The platform emulator that wraps user plugins during development. It:
|
|
134
|
+
- Provides mock router, theme, and navigation
|
|
135
|
+
- Injects props that the real platform provides
|
|
136
|
+
- Includes the dev tools modal (Ctrl+Shift+D)
|
|
137
|
+
- Lives in `/runtime/` so users can't accidentally modify it
|
|
138
|
+
|
|
139
|
+
## Setting Up for Development
|
|
140
|
+
|
|
141
|
+
1. **Clone the repository**:
|
|
142
|
+
```bash
|
|
143
|
+
git clone https://github.com/GramercyTech/gx-devtools.git
|
|
144
|
+
cd gx-devtools
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
2. **Install dependencies**:
|
|
148
|
+
```bash
|
|
149
|
+
npm install
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
3. **Link for local testing**:
|
|
153
|
+
```bash
|
|
154
|
+
npm link
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
4. **Create a test project**:
|
|
158
|
+
```bash
|
|
159
|
+
mkdir /tmp/test-project
|
|
160
|
+
cd /tmp/test-project
|
|
161
|
+
gxdev init test-app
|
|
162
|
+
cd test-app
|
|
163
|
+
|
|
164
|
+
# Link to local devtools instead of npm version
|
|
165
|
+
rm -rf node_modules/@gramercytech/gx-devtools
|
|
166
|
+
mkdir -p node_modules/@gramercytech
|
|
167
|
+
ln -s /path/to/gx-devtools node_modules/@gramercytech/gx-devtools
|
|
168
|
+
|
|
169
|
+
npm run dev-http
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Making Changes
|
|
173
|
+
|
|
174
|
+
### Adding a New CLI Command
|
|
175
|
+
|
|
176
|
+
1. Create a new file in `bin/lib/commands/`:
|
|
177
|
+
```javascript
|
|
178
|
+
// bin/lib/commands/mycommand.js
|
|
179
|
+
function myCommand(argv) {
|
|
180
|
+
console.log("My command running!");
|
|
181
|
+
}
|
|
182
|
+
module.exports = { myCommand };
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
2. Export from `bin/lib/commands/index.js`
|
|
186
|
+
|
|
187
|
+
3. Register in `bin/lib/cli.js`:
|
|
188
|
+
```javascript
|
|
189
|
+
.command('mycommand', 'Description', {}, myCommand)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Modifying the Dev Tools Modal
|
|
193
|
+
|
|
194
|
+
Dev tools components are in `/runtime/dev-tools/`. Changes here affect all projects using the devtools.
|
|
195
|
+
|
|
196
|
+
### Adding Template Files
|
|
197
|
+
|
|
198
|
+
Add files to `/template/` and update `bin/lib/commands/init.js` to copy them during project creation.
|
|
199
|
+
|
|
200
|
+
## Testing
|
|
201
|
+
|
|
202
|
+
### Manual Testing
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Test CLI help
|
|
206
|
+
node bin/gx-devtools.js --help
|
|
207
|
+
|
|
208
|
+
# Test init command
|
|
209
|
+
cd /tmp && rm -rf test-project
|
|
210
|
+
node /path/to/gx-devtools/bin/gx-devtools.js init test-project
|
|
211
|
+
|
|
212
|
+
# Test dev server (after linking)
|
|
213
|
+
cd test-project
|
|
214
|
+
npm run dev-http
|
|
215
|
+
|
|
216
|
+
# Test build
|
|
217
|
+
npm run build
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Verifying Changes
|
|
221
|
+
|
|
222
|
+
1. Create a fresh test project
|
|
223
|
+
2. Link the local devtools
|
|
224
|
+
3. Run `npm run dev-http` and verify the app loads
|
|
225
|
+
4. Run `npm run build` and check `dist/` output
|
|
226
|
+
5. Test dev tools with Ctrl+Shift+D
|
|
227
|
+
|
|
228
|
+
## Publishing
|
|
229
|
+
|
|
230
|
+
1. Update version in `package.json`
|
|
231
|
+
2. Ensure all new directories are included (runtime/, template/, socket-events/)
|
|
232
|
+
3. Run `npm publish`
|
|
233
|
+
|
|
234
|
+
## Dependencies
|
|
235
|
+
|
|
236
|
+
The devtools uses:
|
|
237
|
+
- **Vite** - Build tool and dev server
|
|
238
|
+
- **Vue 3** - UI framework
|
|
239
|
+
- **Pinia** - State management
|
|
240
|
+
- **Socket.IO** - Real-time communication
|
|
241
|
+
- **yargs** - CLI argument parsing
|
|
242
|
+
- **shelljs** - Shell commands
|
|
243
|
+
- **mkcert** - SSL certificate generation
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
ISC
|