@gxp-dev/tools 2.0.71 → 2.0.72
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/README.md +108 -81
- package/bin/lib/cli.js +18 -0
- package/bin/lib/commands/index.js +2 -0
- package/bin/lib/commands/init.js +23 -0
- package/bin/lib/commands/lint.js +77 -0
- package/bin/lib/constants.js +12 -0
- package/bin/lib/lint/formatter.js +91 -0
- package/bin/lib/lint/index.js +284 -0
- package/bin/lib/lint/schemas/app-manifest.schema.json +124 -0
- package/bin/lib/lint/schemas/card.schema.json +165 -0
- package/bin/lib/lint/schemas/common.schema.json +62 -0
- package/bin/lib/lint/schemas/configuration.schema.json +19 -0
- package/bin/lib/lint/schemas/field.schema.json +230 -0
- package/mcp/gxp-api-server.js +56 -127
- package/mcp/lib/api-tools.js +456 -0
- package/mcp/lib/config-ops.js +234 -0
- package/mcp/lib/config-tools.js +549 -0
- package/mcp/lib/docs-tools.js +142 -0
- package/mcp/lib/docs.js +263 -0
- package/mcp/lib/specs.js +135 -0
- package/mcp/lib/test-tools.js +358 -0
- package/package.json +3 -1
- package/runtime/vite.config.js +5 -3
- package/template/.prettierrc +10 -0
- package/template/README.md +205 -240
- package/template/app-instructions.md +91 -0
- package/template/eslint.config.js +32 -0
- package/template/githooks/pre-commit +37 -0
package/template/README.md
CHANGED
|
@@ -1,349 +1,314 @@
|
|
|
1
1
|
# GxP Plugin Project
|
|
2
2
|
|
|
3
|
-
This project was
|
|
3
|
+
This project was scaffolded by `@gxp-dev/tools` and includes the `@gramercytech/gx-componentkit` component library for rapid kiosk/plugin development.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
npm run dev-http
|
|
10
|
-
|
|
11
|
-
# Start HTTPS development server with Socket.IO
|
|
12
|
-
npm run dev
|
|
13
|
-
|
|
14
|
-
# Build for production
|
|
15
|
-
npm run build
|
|
8
|
+
npm install
|
|
9
|
+
npm run dev-http # HTTP dev server (or `npm run dev` for HTTPS + Socket.IO)
|
|
16
10
|
```
|
|
17
11
|
|
|
12
|
+
Open `http://localhost:3060`. Press `Ctrl+Shift+D` for the in-browser Dev Tools.
|
|
13
|
+
|
|
18
14
|
## Project Structure
|
|
19
15
|
|
|
20
16
|
```
|
|
21
17
|
your-project/
|
|
22
18
|
├── src/
|
|
23
|
-
│ ├── Plugin.vue
|
|
24
|
-
│ ├── DemoPage.vue
|
|
25
|
-
│ ├──
|
|
26
|
-
│
|
|
27
|
-
│
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
├──
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
├──
|
|
36
|
-
├──
|
|
37
|
-
├──
|
|
38
|
-
├──
|
|
39
|
-
├──
|
|
40
|
-
|
|
41
|
-
└── .env # Environment configuration
|
|
19
|
+
│ ├── Plugin.vue # Your app entry point (edit this!)
|
|
20
|
+
│ ├── DemoPage.vue # Example component — strings/assets/socket demo
|
|
21
|
+
│ ├── public/ # Static assets, served at /src/public/*
|
|
22
|
+
│ └── stores/
|
|
23
|
+
│ └── index.js # Pinia store setup
|
|
24
|
+
├── theme-layouts/ # System/Private/Public layout templates
|
|
25
|
+
├── dev-assets/images/ # Placeholder images for dev
|
|
26
|
+
├── socket-events/ # JSON event templates for simulation
|
|
27
|
+
├── tests/ # Vitest tests (add more as needed)
|
|
28
|
+
├── scripts/ # Browser extension launch/pack scripts
|
|
29
|
+
├── .githooks/pre-commit # Prettier + ESLint + gxdev lint on staged files
|
|
30
|
+
├── app-manifest.json # Plugin metadata + default strings/settings/assets
|
|
31
|
+
├── app-instructions.md # End-user onboarding — shown on install
|
|
32
|
+
├── configuration.json # Admin-panel configuration form (templating schema)
|
|
33
|
+
├── vite.extend.js # Optional Vite config extension (aliases/plugins/define)
|
|
34
|
+
├── eslint.config.js # ESLint flat config (JS + Vue)
|
|
35
|
+
├── .prettierrc # Prettier config
|
|
36
|
+
└── .env # Environment variables
|
|
42
37
|
```
|
|
43
38
|
|
|
44
|
-
## How
|
|
39
|
+
## How it works
|
|
45
40
|
|
|
46
|
-
### Plugin.vue
|
|
41
|
+
### `src/Plugin.vue` — your entry point
|
|
47
42
|
|
|
48
|
-
|
|
43
|
+
During development, the toolkit wraps Plugin.vue in `PortalContainer.vue`, which emulates the live GxP platform. In production the platform loads Plugin.vue directly. The platform injects these props:
|
|
49
44
|
|
|
50
45
|
```vue
|
|
51
|
-
<template>
|
|
52
|
-
<div class="my-plugin">
|
|
53
|
-
<h1>{{ stringsList?.welcome_text || "Welcome!" }}</h1>
|
|
54
|
-
<!-- Your custom content here -->
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
46
|
<script setup>
|
|
59
|
-
// Props injected by the platform
|
|
60
47
|
const props = defineProps({
|
|
61
|
-
pluginVars: Object, //
|
|
62
|
-
dependencyList: Object, //
|
|
63
|
-
assetUrls: Object, //
|
|
48
|
+
pluginVars: Object, // Settings configured per-install
|
|
49
|
+
dependencyList: Object, // Linked API dependencies
|
|
50
|
+
assetUrls: Object, // Resolved asset URLs
|
|
64
51
|
stringsList: Object, // Localized strings
|
|
65
|
-
permissionFlags: Array, //
|
|
52
|
+
permissionFlags: Array, // Granted permissions
|
|
66
53
|
theme: Object, // Theme configuration
|
|
67
|
-
router: Object, // Platform router
|
|
54
|
+
router: Object, // Platform router
|
|
68
55
|
})
|
|
69
56
|
</script>
|
|
70
57
|
```
|
|
71
58
|
|
|
72
|
-
###
|
|
73
|
-
|
|
74
|
-
The `theme-layouts/` directory contains layout templates that wrap your Plugin component. The platform uses these to provide consistent UI structure:
|
|
75
|
-
|
|
76
|
-
- **SystemLayout.vue** - System-level pages (errors, maintenance)
|
|
77
|
-
- **PrivateLayout.vue** - Authenticated user pages
|
|
78
|
-
- **PublicLayout.vue** - Public-facing pages
|
|
79
|
-
|
|
80
|
-
You can customize these layouts to match your kiosk's design.
|
|
81
|
-
|
|
82
|
-
## Development
|
|
83
|
-
|
|
84
|
-
### Available Scripts
|
|
85
|
-
|
|
86
|
-
| Script | Description |
|
|
87
|
-
| ------------------------- | ------------------------------------- |
|
|
88
|
-
| `npm run dev` | Start HTTPS dev server with Socket.IO |
|
|
89
|
-
| `npm run dev-app` | Start HTTPS dev server only |
|
|
90
|
-
| `npm run dev-http` | Start HTTP dev server (no SSL) |
|
|
91
|
-
| `npm run build` | Build for production |
|
|
92
|
-
| `npm run setup-ssl` | Generate SSL certificates |
|
|
93
|
-
| `npm run socket:list` | List available socket events |
|
|
94
|
-
| `npm run socket:send` | Send test socket events |
|
|
95
|
-
| `npm run assets:list` | List development assets |
|
|
96
|
-
| `npm run assets:init` | Initialize asset directories |
|
|
97
|
-
| `npm run assets:generate` | Generate placeholder images |
|
|
98
|
-
|
|
99
|
-
### Dev Tools Modal
|
|
100
|
-
|
|
101
|
-
During development, press **Ctrl+Shift+D** (or **Cmd+Shift+D** on Mac) to open the Dev Tools Modal. You can also click the gear icon in the bottom-right corner.
|
|
102
|
-
|
|
103
|
-
The Dev Tools Modal provides:
|
|
59
|
+
### GxP directives
|
|
104
60
|
|
|
105
|
-
|
|
106
|
-
- `pluginVars` - Custom variables
|
|
107
|
-
- `stringsList` - Localized strings
|
|
108
|
-
- `assetList` - Asset URLs
|
|
109
|
-
- `triggerState` - Trigger states
|
|
110
|
-
- `dependencyList` - Dependencies
|
|
61
|
+
Bind template text and asset sources directly to the datastore — values are editable live from the Dev Tools:
|
|
111
62
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
63
|
+
```vue
|
|
64
|
+
<!-- text from strings.default -->
|
|
65
|
+
<h1 gxp-string="welcome_title">Welcome</h1>
|
|
115
66
|
|
|
116
|
-
|
|
67
|
+
<!-- text from settings (pluginVars) -->
|
|
68
|
+
<code gxp-settings gxp-string="primary_color">#FFD600</code>
|
|
117
69
|
|
|
118
|
-
|
|
70
|
+
<!-- text from triggerState -->
|
|
71
|
+
<code gxp-state gxp-string="current_status">idle</code>
|
|
119
72
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
window.gxDevTools.close() // Close modal
|
|
123
|
-
window.gxDevTools.toggle() // Toggle modal
|
|
73
|
+
<!-- swap the image src from assets -->
|
|
74
|
+
<img gxp-src="hero_image" src="/src/public/hero.jpg" />
|
|
124
75
|
```
|
|
125
76
|
|
|
126
|
-
###
|
|
77
|
+
### Theme layouts
|
|
127
78
|
|
|
128
|
-
|
|
79
|
+
`theme-layouts/` wraps your plugin. Customize to match your kiosk's design:
|
|
129
80
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
81
|
+
- **SystemLayout.vue** — system pages (errors, maintenance)
|
|
82
|
+
- **PrivateLayout.vue** — authenticated pages
|
|
83
|
+
- **PublicLayout.vue** — public-facing pages
|
|
133
84
|
|
|
134
|
-
|
|
135
|
-
VITE_SOCKET_PORT=3069
|
|
85
|
+
## npm scripts
|
|
136
86
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
87
|
+
| Script | What it does |
|
|
88
|
+
| ---------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
89
|
+
| `npm run dev` | HTTPS dev server + Socket.IO + interactive TUI |
|
|
90
|
+
| `npm run dev-app` | HTTPS dev server only |
|
|
91
|
+
| `npm run dev-http` | HTTP dev server (no SSL) |
|
|
92
|
+
| `npm run build` | Production build → `dist/<name>.gxpapp` |
|
|
93
|
+
| `npm run test` | Run Vitest once |
|
|
94
|
+
| `npm run test:watch` | Vitest in watch mode |
|
|
95
|
+
| `npm run lint` | Run `gxdev lint --all` (config/manifest JSON) |
|
|
96
|
+
| `npm run lint:js` | Run ESLint on JS/Vue files |
|
|
97
|
+
| `npm run format` | Run Prettier across the project |
|
|
98
|
+
| `npm run setup-ssl` | Generate SSL certificates via mkcert |
|
|
99
|
+
| `npm run socket:list` | List available socket events |
|
|
100
|
+
| `npm run socket:send` | Send a test socket event |
|
|
101
|
+
| `npm run assets:list` / `assets:init` / `assets:generate` | Manage dev assets |
|
|
102
|
+
| `npm run datastore:list` / `datastore:add` / `datastore:scan` / `datastore:config` | Manage the GxP datastore |
|
|
141
103
|
|
|
142
|
-
##
|
|
104
|
+
## Development tooling
|
|
143
105
|
|
|
144
|
-
|
|
106
|
+
### In-browser Dev Tools
|
|
145
107
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Custom variables configured in the admin panel:
|
|
149
|
-
|
|
150
|
-
```javascript
|
|
151
|
-
const { pluginVars } = props
|
|
152
|
-
console.log(pluginVars.primary_color) // "#FFD600"
|
|
153
|
-
console.log(pluginVars.projectId) // 39
|
|
154
|
-
```
|
|
108
|
+
Press **Ctrl+Shift+D** (or Cmd+Shift+D on macOS) to open:
|
|
155
109
|
|
|
156
|
-
|
|
110
|
+
1. **Store Inspector** — view/edit `pluginVars` (settings), `stringsList`, `assetList`, `triggerState`, `dependencyList`. Hover a key to highlight every matching element; double-click a value to edit.
|
|
111
|
+
2. **Layout Switcher** — swap between Public / Private / System layouts.
|
|
112
|
+
3. **Socket Simulator** — fire test socket events.
|
|
113
|
+
4. **Mock Data Editor** — edit theme colors, nav, session, permissions.
|
|
157
114
|
|
|
158
|
-
|
|
115
|
+
Console API:
|
|
159
116
|
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
|
|
117
|
+
```js
|
|
118
|
+
window.gxDevTools.open() // open
|
|
119
|
+
window.gxDevTools.close() // close
|
|
120
|
+
window.gxDevTools.toggle() // toggle
|
|
121
|
+
window.gxDevTools.store() // grab the Pinia store
|
|
163
122
|
```
|
|
164
123
|
|
|
165
|
-
###
|
|
124
|
+
### Pre-commit hook
|
|
166
125
|
|
|
167
|
-
|
|
126
|
+
The `.githooks/pre-commit` hook runs on every `git commit` (auto-enabled by the `prepare` npm script):
|
|
168
127
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
```
|
|
128
|
+
1. **Prettier** formats every staged JS/TS/Vue/CSS/JSON/MD/YAML/HTML file.
|
|
129
|
+
2. **ESLint** fixes every staged JS/Vue file.
|
|
130
|
+
3. **`gxdev lint`** validates staged `configuration.json` / `app-manifest.json` against the GxP templating schema.
|
|
173
131
|
|
|
174
|
-
|
|
132
|
+
Any non-zero exit aborts the commit. To stage fixes, ESLint and Prettier re-add their outputs automatically.
|
|
175
133
|
|
|
176
|
-
|
|
134
|
+
### Linting config JSON
|
|
177
135
|
|
|
178
|
-
|
|
179
|
-
<GxThemeWrapper :theme="theme">
|
|
180
|
-
<!-- Your content inherits theme variables -->
|
|
181
|
-
</GxThemeWrapper>
|
|
182
|
-
```
|
|
136
|
+
`gxdev lint` uses AJV + the GxP templating schema to validate:
|
|
183
137
|
|
|
184
|
-
|
|
138
|
+
- **`configuration.json`** — the admin form definition (cards, fields, nested card_list / tabs_list structures).
|
|
139
|
+
- **`app-manifest.json`** — plugin metadata, strings/settings/assets/triggerState shapes, dependency entries.
|
|
185
140
|
|
|
186
|
-
|
|
141
|
+
Run manually with `npm run lint`, or point at a single file: `gxdev lint path/to/file.json`.
|
|
187
142
|
|
|
188
|
-
|
|
189
|
-
// Basic navigation
|
|
190
|
-
router.visit("/camera")
|
|
143
|
+
### Writing tests
|
|
191
144
|
|
|
192
|
-
|
|
193
|
-
router.visit("/share", {
|
|
194
|
-
method: "post",
|
|
195
|
-
data: { image: photoUrl, caption: "My photo!" },
|
|
196
|
-
})
|
|
145
|
+
Tests live under `tests/` and run with Vitest:
|
|
197
146
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
147
|
+
```js
|
|
148
|
+
import { describe, it, expect } from "vitest"
|
|
149
|
+
import { mount } from "@vue/test-utils"
|
|
150
|
+
import DemoPage from "@/DemoPage.vue"
|
|
151
|
+
|
|
152
|
+
describe("DemoPage", () => {
|
|
153
|
+
it("renders", () => {
|
|
154
|
+
const wrapper = mount(DemoPage)
|
|
155
|
+
expect(wrapper.exists()).toBe(true)
|
|
156
|
+
})
|
|
206
157
|
})
|
|
207
158
|
```
|
|
208
159
|
|
|
209
|
-
|
|
160
|
+
Scaffold a new test with the MCP tool `test_scaffold_component_test` (via an AI assistant) or write them by hand. Run with `npm run test` or `npm run test:watch`.
|
|
210
161
|
|
|
211
|
-
|
|
162
|
+
### Customizing the Vite config
|
|
212
163
|
|
|
213
|
-
|
|
164
|
+
Don't replace `vite.config.js` — the toolkit serves one from its runtime. Instead, edit `vite.extend.js` at the project root. Its exports are deep-merged into the runtime config via `mergeConfig` (plugins concatenate, `resolve.alias` / `define` merge key-by-key):
|
|
214
165
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
- `GxPageResults` - Results display page
|
|
219
|
-
- `GxPageShare` - Social sharing interface
|
|
220
|
-
- `GxPageFinal` - Thank you/completion page
|
|
221
|
-
- `GxPageLoading` - Loading overlay
|
|
166
|
+
```js
|
|
167
|
+
import path from "path"
|
|
168
|
+
import { fileURLToPath } from "url"
|
|
222
169
|
|
|
223
|
-
|
|
170
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
224
171
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
172
|
+
export default {
|
|
173
|
+
resolve: {
|
|
174
|
+
alias: {
|
|
175
|
+
"@components": path.resolve(__dirname, "src/components"),
|
|
176
|
+
"@pages": path.resolve(__dirname, "src/pages"),
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
// plugins: [somePlugin()],
|
|
180
|
+
// define: { "import.meta.env.VITE_MY_FLAG": JSON.stringify("value") },
|
|
181
|
+
}
|
|
182
|
+
```
|
|
229
183
|
|
|
230
|
-
|
|
184
|
+
## Environment variables
|
|
185
|
+
|
|
186
|
+
Set in `.env`:
|
|
187
|
+
|
|
188
|
+
| Variable | Default | Description |
|
|
189
|
+
| ------------------------------------ | ------------------ | -------------------------------------------------------------------------------- |
|
|
190
|
+
| `NODE_PORT` | `3060` | Dev server port |
|
|
191
|
+
| `SOCKET_IO_PORT` | `3069` | Socket.IO server port |
|
|
192
|
+
| `COMPONENT_PATH` | `./src/Plugin.vue` | Main component path |
|
|
193
|
+
| `USE_HTTPS` | `true` | Enable HTTPS |
|
|
194
|
+
| `CERT_PATH` / `KEY_PATH` | | SSL cert paths (auto-set by `setup-ssl`) |
|
|
195
|
+
| `USE_LOCAL_INDEX` / `USE_LOCAL_MAIN` | | Opt into local copies of `index.html` / `main.js` |
|
|
196
|
+
| `API_ENV` | `mock` | API environment (`mock`, `local`, `develop`, `testing`, `staging`, `production`) |
|
|
197
|
+
| `MOCK_API_ENABLED` | `false` | Mount the local mock API at `/api/*` |
|
|
198
|
+
|
|
199
|
+
## `app-manifest.json` overview
|
|
200
|
+
|
|
201
|
+
Plugin metadata + default datastore values loaded by the platform on install:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"name": "My Plugin",
|
|
206
|
+
"version": "1.0.0",
|
|
207
|
+
"manifest_version": 3,
|
|
208
|
+
"asset_dir": "/src/public",
|
|
209
|
+
"configurationFile": "configuration.json",
|
|
210
|
+
"appInstructionsFile": "app-instructions.md",
|
|
211
|
+
"defaultStylingFile": "default-styling.css",
|
|
212
|
+
"settings": { "primary_color": "#FFD600" },
|
|
213
|
+
"strings": { "default": { "welcome_title": "Welcome" } },
|
|
214
|
+
"assets": { "main_logo": "/src/public/logo.png" },
|
|
215
|
+
"triggerState": { "current_status": "idle" },
|
|
216
|
+
"dependencies": [],
|
|
217
|
+
"permissions": []
|
|
218
|
+
}
|
|
219
|
+
```
|
|
231
220
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
221
|
+
Run `gxdev extract-config` to scan `src/` for directives and store calls and merge new keys into the manifest automatically.
|
|
222
|
+
|
|
223
|
+
## `configuration.json` — admin form
|
|
224
|
+
|
|
225
|
+
This file defines the configuration form operators see when installing/configuring your plugin in the admin panel. It follows the GxP templating system (`additionalTabs` → cards → fields). A minimal example:
|
|
226
|
+
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"additionalTabs": [
|
|
230
|
+
{
|
|
231
|
+
"type": "card_list",
|
|
232
|
+
"cards": [
|
|
233
|
+
{
|
|
234
|
+
"type": "fields_list",
|
|
235
|
+
"title": "General",
|
|
236
|
+
"fieldsList": [
|
|
237
|
+
{ "type": "text", "name": "company_name", "label": "Company" },
|
|
238
|
+
{
|
|
239
|
+
"type": "colorPicker",
|
|
240
|
+
"name": "primary_color",
|
|
241
|
+
"label": "Brand color"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
```
|
|
236
250
|
|
|
237
|
-
|
|
251
|
+
Full reference: [docs.gxp.dev/gx-devtools/app-manifest](https://docs.gxp.dev/gx-devtools/app-manifest) and the platform templating docs. Validate any time with `gxdev lint configuration.json`.
|
|
238
252
|
|
|
239
|
-
|
|
240
|
-
<script setup>
|
|
241
|
-
import {
|
|
242
|
-
GxModal,
|
|
243
|
-
GxCountdown,
|
|
244
|
-
GxVideoPlayer,
|
|
245
|
-
useMedia,
|
|
246
|
-
} from "@gramercytech/gx-componentkit"
|
|
247
|
-
|
|
248
|
-
const { startCamera, takePhoto } = useMedia()
|
|
249
|
-
</script>
|
|
253
|
+
## GX ComponentKit
|
|
250
254
|
|
|
251
|
-
|
|
252
|
-
<GxCountdown :duration="30" @finished="handleFinished" />
|
|
253
|
-
<GxVideoPlayer :src="videoUrl" @play="handlePlay" />
|
|
254
|
-
</template>
|
|
255
|
-
```
|
|
255
|
+
This project includes `@gramercytech/gx-componentkit`:
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
- **Pages** — `GxPageStart`, `GxPageInstructions`, `GxPageCamera`, `GxPageResults`, `GxPageShare`, `GxPageFinal`, `GxPageLoading`
|
|
258
|
+
- **UI** — `GxModal`, `GxCountdown`, `GxVideoPlayer`, `GxThemeWrapper`
|
|
259
|
+
- **Composables** — `useMedia`, `useAnimations`, `useScanning`, `useErrors`
|
|
258
260
|
|
|
259
|
-
Theme CSS variables are
|
|
261
|
+
Theme CSS variables are auto-injected:
|
|
260
262
|
|
|
261
263
|
```css
|
|
262
264
|
.my-component {
|
|
263
265
|
background: var(--gx-primary-color);
|
|
264
266
|
color: var(--gx-text-color);
|
|
265
|
-
border: 2px solid var(--gx-primary-color);
|
|
266
267
|
}
|
|
267
268
|
```
|
|
268
269
|
|
|
269
|
-
## Socket
|
|
270
|
-
|
|
271
|
-
Test real-time features with socket simulation:
|
|
270
|
+
## Socket events
|
|
272
271
|
|
|
273
272
|
```bash
|
|
274
|
-
# List available socket events
|
|
275
273
|
npm run socket:list
|
|
276
|
-
|
|
277
|
-
# Send a socket event
|
|
278
274
|
npm run socket:send
|
|
279
|
-
|
|
280
|
-
# Send to specific channel
|
|
281
275
|
gxdev socket send --event SocialStreamPostCreated --identifier "stream_123"
|
|
282
276
|
```
|
|
283
277
|
|
|
284
|
-
|
|
278
|
+
Event templates live in `socket-events/` — add JSON files to simulate custom events.
|
|
285
279
|
|
|
286
|
-
##
|
|
280
|
+
## Assets
|
|
287
281
|
|
|
288
282
|
```bash
|
|
289
|
-
# List all development assets
|
|
290
283
|
npm run assets:list
|
|
291
|
-
|
|
292
|
-
# Initialize asset directories
|
|
293
284
|
npm run assets:init
|
|
294
|
-
|
|
295
|
-
# Generate placeholder images (requires ImageMagick)
|
|
296
285
|
npm run assets:generate
|
|
297
286
|
gxdev assets generate --size 800x600 --name product-image
|
|
298
|
-
gxdev assets generate --name logo --size 200x200 --color "#FF5722" --text "My Logo"
|
|
299
287
|
```
|
|
300
288
|
|
|
301
|
-
|
|
289
|
+
Requires ImageMagick:
|
|
302
290
|
|
|
303
291
|
```bash
|
|
304
|
-
# macOS
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
# Ubuntu/Debian
|
|
308
|
-
sudo apt-get install imagemagick
|
|
309
|
-
|
|
310
|
-
# Windows - download from https://imagemagick.org/script/download.php
|
|
292
|
+
brew install imagemagick # macOS
|
|
293
|
+
sudo apt-get install imagemagick # Ubuntu/Debian
|
|
311
294
|
```
|
|
312
295
|
|
|
313
|
-
## Building for
|
|
296
|
+
## Building for production
|
|
314
297
|
|
|
315
298
|
```bash
|
|
316
299
|
npm run build
|
|
317
300
|
```
|
|
318
301
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
- `plugin.es.js` - Your compiled plugin (ES module)
|
|
322
|
-
- `style.css` - Compiled styles
|
|
323
|
-
|
|
324
|
-
The build excludes development files (main.js, index.html) and externalizes Vue (the platform provides it).
|
|
325
|
-
|
|
326
|
-
## Project Architecture
|
|
327
|
-
|
|
328
|
-
```
|
|
329
|
-
Plugin.vue (your entry point)
|
|
330
|
-
├── imports YourHeader.vue
|
|
331
|
-
├── imports YourContent.vue
|
|
332
|
-
│ ├── imports ProductList.vue
|
|
333
|
-
│ ├── imports ShoppingCart.vue
|
|
334
|
-
│ └── imports YourModal.vue
|
|
335
|
-
└── imports YourFooter.vue
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
Everything imported into Plugin.vue (directly or indirectly) is included in the build. The platform loads your Plugin.vue and injects the necessary props.
|
|
302
|
+
Produces `dist/<plugin-name>.gxpapp` — a zip containing compiled `plugin.es.js`, `style.css`, `app-manifest.json`, assets, and any bundled files referenced by the manifest. Upload this to the GxP plugin registry.
|
|
339
303
|
|
|
340
|
-
## Learn
|
|
304
|
+
## Learn more
|
|
341
305
|
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
- [
|
|
306
|
+
- **Platform docs** — [docs.gxp.dev](https://docs.gxp.dev)
|
|
307
|
+
- **CLI reference** — [docs.gxp.dev/gx-devtools/cli-reference](https://docs.gxp.dev/gx-devtools/cli-reference)
|
|
308
|
+
- **ComponentKit** — [docs.gxp.dev/gx-uikit](https://docs.gxp.dev/gx-uikit)
|
|
309
|
+
- **Vue 3** — [vuejs.org](https://vuejs.org/)
|
|
310
|
+
- **Vite** — [vitejs.dev](https://vitejs.dev/)
|
|
346
311
|
|
|
347
312
|
## Support
|
|
348
313
|
|
|
349
|
-
|
|
314
|
+
Contact the Gramercy development team or open an issue in the plugin repo.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# App Instructions
|
|
2
|
+
|
|
3
|
+
> **👋 Plugin developer — replace this file.**
|
|
4
|
+
>
|
|
5
|
+
> Everything in this file is shown to **end users** on the GxP platform the first
|
|
6
|
+
> time they install your plugin. Treat it like the "About" screen of your app:
|
|
7
|
+
> what it does, how to use it, what to expect. Strip out the template sections
|
|
8
|
+
> below and write for your audience, not for developers.
|
|
9
|
+
>
|
|
10
|
+
> _Delete this callout before shipping._
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## About GxP plugins
|
|
15
|
+
|
|
16
|
+
GxP plugins are self-contained Vue apps that run inside the Gramercy Experience
|
|
17
|
+
Platform. Your plugin gets:
|
|
18
|
+
|
|
19
|
+
- A slice of platform UI to render into (Public, Private, or System layout).
|
|
20
|
+
- A reactive **datastore** populated at runtime with strings, settings, assets,
|
|
21
|
+
permissions, and feature flags configured by the platform operator.
|
|
22
|
+
- **Sockets** for real-time events (default channel: `primary`).
|
|
23
|
+
- Optional **dependencies** — models and event streams provided by other
|
|
24
|
+
plugins or platform modules.
|
|
25
|
+
|
|
26
|
+
Plugins are packaged as a `.gxpapp` bundle and distributed through the GxP
|
|
27
|
+
plugin registry.
|
|
28
|
+
|
|
29
|
+
## Getting started (for developers)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Install the toolkit CLI (already listed as a devDependency)
|
|
33
|
+
npm install
|
|
34
|
+
|
|
35
|
+
# Start the dev server (HTTPS by default)
|
|
36
|
+
npm run dev
|
|
37
|
+
|
|
38
|
+
# …or launch the interactive TUI
|
|
39
|
+
gxdev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then open the browser to the dev URL printed in the console.
|
|
43
|
+
|
|
44
|
+
**Key files:**
|
|
45
|
+
|
|
46
|
+
| File | What it does |
|
|
47
|
+
| --------------------- | -------------------------------------------------------------------- |
|
|
48
|
+
| `src/Plugin.vue` | Your app's entry point. Rendered by the platform. |
|
|
49
|
+
| `app-manifest.json` | Plugin metadata + default strings, settings, assets, permissions. |
|
|
50
|
+
| `src/public/` | Static assets (images, fonts). Served at `/src/public/*`. |
|
|
51
|
+
| `vite.extend.js` | Optional — extends the runtime Vite config (aliases, plugins, etc.). |
|
|
52
|
+
| `app-instructions.md` | **This file.** Shown to end users — replace it. |
|
|
53
|
+
| `configuration.json` | Per-install configuration schema shown to operators. |
|
|
54
|
+
| `default-styling.css` | Optional stylesheet bundled with the plugin. |
|
|
55
|
+
|
|
56
|
+
**Dev tools:** press `Ctrl+Shift+D` in the running app to open the in-browser
|
|
57
|
+
Store Inspector, layout switcher, socket simulator, and mock-data editor.
|
|
58
|
+
|
|
59
|
+
## Building and packaging
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run build # produces dist/<plugin-name>.gxpapp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The `.gxpapp` file is what you upload to the GxP plugin registry.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Template — end-user-facing content starts here
|
|
70
|
+
|
|
71
|
+
> Everything below is placeholder copy. Replace it with your app's actual
|
|
72
|
+
> user-facing content.
|
|
73
|
+
|
|
74
|
+
### What is this plugin?
|
|
75
|
+
|
|
76
|
+
_A one-or-two-sentence description of what the plugin does and why a user
|
|
77
|
+
would install it._
|
|
78
|
+
|
|
79
|
+
### How to use it
|
|
80
|
+
|
|
81
|
+
1. _First step the user should take._
|
|
82
|
+
2. _Second step._
|
|
83
|
+
3. _…_
|
|
84
|
+
|
|
85
|
+
### Frequently asked questions
|
|
86
|
+
|
|
87
|
+
**Can I customize the colors or text?**
|
|
88
|
+
_Answer that covers whatever your `configuration.json` exposes to operators._
|
|
89
|
+
|
|
90
|
+
**Who do I contact for support?**
|
|
91
|
+
_Your support contact / link._
|