@gxp-dev/tools 2.0.63 → 2.0.64
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 +32 -31
- package/bin/gx-devtools.js +74 -54
- package/bin/lib/cli.js +23 -21
- package/bin/lib/commands/add-dependency.js +366 -325
- package/bin/lib/commands/assets.js +137 -139
- package/bin/lib/commands/build.js +169 -174
- package/bin/lib/commands/datastore.js +181 -183
- package/bin/lib/commands/dev.js +127 -131
- package/bin/lib/commands/extensions.js +147 -149
- package/bin/lib/commands/extract-config.js +73 -67
- package/bin/lib/commands/index.js +12 -12
- package/bin/lib/commands/init.js +342 -240
- package/bin/lib/commands/publish.js +69 -75
- package/bin/lib/commands/socket.js +69 -69
- package/bin/lib/commands/ssl.js +14 -14
- package/bin/lib/constants.js +10 -24
- package/bin/lib/tui/App.tsx +761 -705
- package/bin/lib/tui/components/AIPanel.tsx +191 -171
- package/bin/lib/tui/components/CommandInput.tsx +394 -343
- package/bin/lib/tui/components/GeminiPanel.tsx +175 -151
- package/bin/lib/tui/components/Header.tsx +23 -21
- package/bin/lib/tui/components/LogPanel.tsx +244 -220
- package/bin/lib/tui/components/TabBar.tsx +50 -48
- package/bin/lib/tui/components/WelcomeScreen.tsx +126 -71
- package/bin/lib/tui/index.tsx +37 -39
- package/bin/lib/tui/services/AIService.ts +518 -462
- package/bin/lib/tui/services/ExtensionService.ts +140 -129
- package/bin/lib/tui/services/GeminiService.ts +367 -337
- package/bin/lib/tui/services/ServiceManager.ts +344 -322
- package/bin/lib/tui/services/SocketService.ts +168 -168
- package/bin/lib/tui/services/ViteService.ts +88 -88
- package/bin/lib/tui/services/index.ts +47 -22
- package/bin/lib/utils/ai-scaffold.js +291 -280
- package/bin/lib/utils/extract-config.js +157 -140
- package/bin/lib/utils/files.js +82 -86
- package/bin/lib/utils/index.js +7 -7
- package/bin/lib/utils/paths.js +34 -34
- package/bin/lib/utils/prompts.js +194 -169
- package/bin/lib/utils/ssl.js +79 -81
- package/browser-extensions/README.md +0 -1
- package/browser-extensions/chrome/background.js +244 -237
- package/browser-extensions/chrome/content.js +32 -29
- package/browser-extensions/chrome/devtools.html +7 -7
- package/browser-extensions/chrome/devtools.js +19 -19
- package/browser-extensions/chrome/inspector.js +802 -767
- package/browser-extensions/chrome/manifest.json +71 -63
- package/browser-extensions/chrome/panel.html +674 -636
- package/browser-extensions/chrome/panel.js +722 -712
- package/browser-extensions/chrome/popup.html +586 -543
- package/browser-extensions/chrome/popup.js +282 -244
- package/browser-extensions/chrome/rules.json +1 -1
- package/browser-extensions/chrome/test-chrome.html +216 -136
- package/browser-extensions/chrome/test-mixed-content.html +284 -189
- package/browser-extensions/chrome/test-uri-pattern.html +221 -198
- package/browser-extensions/firefox/README.md +9 -6
- package/browser-extensions/firefox/background.js +221 -218
- package/browser-extensions/firefox/content.js +55 -52
- package/browser-extensions/firefox/debug-errors.html +386 -228
- package/browser-extensions/firefox/debug-https.html +153 -105
- package/browser-extensions/firefox/devtools.html +7 -7
- package/browser-extensions/firefox/devtools.js +23 -20
- package/browser-extensions/firefox/inspector.js +802 -767
- package/browser-extensions/firefox/manifest.json +68 -68
- package/browser-extensions/firefox/panel.html +674 -636
- package/browser-extensions/firefox/panel.js +722 -712
- package/browser-extensions/firefox/popup.html +572 -535
- package/browser-extensions/firefox/popup.js +281 -236
- package/browser-extensions/firefox/test-gramercy.html +170 -125
- package/browser-extensions/firefox/test-imports.html +59 -55
- package/browser-extensions/firefox/test-masking.html +231 -140
- package/browser-extensions/firefox/test-uri-pattern.html +221 -198
- package/dist/tui/App.d.ts +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +154 -150
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/AIPanel.d.ts.map +1 -1
- package/dist/tui/components/AIPanel.js +42 -35
- package/dist/tui/components/AIPanel.js.map +1 -1
- package/dist/tui/components/CommandInput.d.ts +1 -1
- package/dist/tui/components/CommandInput.d.ts.map +1 -1
- package/dist/tui/components/CommandInput.js +92 -62
- package/dist/tui/components/CommandInput.js.map +1 -1
- package/dist/tui/components/GeminiPanel.d.ts.map +1 -1
- package/dist/tui/components/GeminiPanel.js +37 -30
- package/dist/tui/components/GeminiPanel.js.map +1 -1
- package/dist/tui/components/Header.d.ts.map +1 -1
- package/dist/tui/components/Header.js +1 -1
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/LogPanel.d.ts +1 -1
- package/dist/tui/components/LogPanel.d.ts.map +1 -1
- package/dist/tui/components/LogPanel.js +26 -24
- package/dist/tui/components/LogPanel.js.map +1 -1
- package/dist/tui/components/TabBar.d.ts +2 -2
- package/dist/tui/components/TabBar.d.ts.map +1 -1
- package/dist/tui/components/TabBar.js +11 -11
- package/dist/tui/components/TabBar.js.map +1 -1
- package/dist/tui/components/WelcomeScreen.d.ts.map +1 -1
- package/dist/tui/components/WelcomeScreen.js +6 -6
- package/dist/tui/components/WelcomeScreen.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +8 -8
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/services/AIService.d.ts +2 -2
- package/dist/tui/services/AIService.d.ts.map +1 -1
- package/dist/tui/services/AIService.js +165 -125
- package/dist/tui/services/AIService.js.map +1 -1
- package/dist/tui/services/ExtensionService.d.ts +1 -1
- package/dist/tui/services/ExtensionService.d.ts.map +1 -1
- package/dist/tui/services/ExtensionService.js +33 -26
- package/dist/tui/services/ExtensionService.js.map +1 -1
- package/dist/tui/services/GeminiService.d.ts +1 -1
- package/dist/tui/services/GeminiService.d.ts.map +1 -1
- package/dist/tui/services/GeminiService.js +87 -76
- package/dist/tui/services/GeminiService.js.map +1 -1
- package/dist/tui/services/ServiceManager.d.ts +3 -3
- package/dist/tui/services/ServiceManager.d.ts.map +1 -1
- package/dist/tui/services/ServiceManager.js +72 -58
- package/dist/tui/services/ServiceManager.js.map +1 -1
- package/dist/tui/services/SocketService.d.ts.map +1 -1
- package/dist/tui/services/SocketService.js +32 -32
- package/dist/tui/services/SocketService.js.map +1 -1
- package/dist/tui/services/ViteService.d.ts.map +1 -1
- package/dist/tui/services/ViteService.js +26 -28
- package/dist/tui/services/ViteService.js.map +1 -1
- package/dist/tui/services/index.d.ts +6 -6
- package/dist/tui/services/index.d.ts.map +1 -1
- package/dist/tui/services/index.js +6 -6
- package/dist/tui/services/index.js.map +1 -1
- package/mcp/gxp-api-server.js +83 -81
- package/package.json +109 -93
- package/runtime/PortalContainer.vue +258 -234
- package/runtime/dev-tools/DevToolsModal.vue +153 -155
- package/runtime/dev-tools/LayoutSwitcher.vue +144 -140
- package/runtime/dev-tools/MockDataEditor.vue +456 -433
- package/runtime/dev-tools/SocketSimulator.vue +379 -371
- package/runtime/dev-tools/StoreInspector.vue +517 -455
- package/runtime/dev-tools/index.js +5 -5
- package/runtime/fallback-layouts/PrivateLayout.vue +2 -2
- package/runtime/fallback-layouts/PublicLayout.vue +2 -2
- package/runtime/fallback-layouts/SystemLayout.vue +2 -2
- package/runtime/gxpStringsPlugin.js +159 -134
- package/runtime/index.html +17 -19
- package/runtime/main.js +24 -22
- package/runtime/mock-api/auth-middleware.js +15 -15
- package/runtime/mock-api/image-generator.js +46 -46
- package/runtime/mock-api/index.js +55 -55
- package/runtime/mock-api/response-generator.js +116 -105
- package/runtime/mock-api/route-generator.js +107 -84
- package/runtime/mock-api/socket-triggers.js +94 -93
- package/runtime/mock-api/spec-loader.js +79 -80
- package/runtime/package.json +3 -0
- package/runtime/server.js +68 -68
- package/runtime/stores/gxpPortalConfigStore.js +204 -186
- package/runtime/stores/index.js +2 -2
- package/runtime/vite-inspector-plugin.js +858 -707
- package/runtime/vite-source-tracker-plugin.js +132 -113
- package/runtime/vite.config.js +191 -139
- package/scripts/launch-chrome.js +41 -41
- package/scripts/pack-chrome.js +38 -39
- package/socket-events/AiSessionMessageCreated.json +17 -17
- package/socket-events/SocialStreamPostCreated.json +23 -23
- package/socket-events/SocialStreamPostVariantCompleted.json +22 -22
- package/template/.claude/agents/gxp-developer.md +100 -99
- package/template/.claude/settings.json +7 -7
- package/template/AGENTS.md +30 -23
- package/template/GEMINI.md +20 -20
- package/template/README.md +70 -53
- package/template/app-manifest.json +2 -4
- package/template/configuration.json +10 -10
- package/template/default-styling.css +1 -1
- package/template/index.html +18 -20
- package/template/main.js +24 -22
- package/template/src/DemoPage.vue +415 -362
- package/template/src/Plugin.vue +76 -85
- package/template/src/stores/index.js +3 -3
- package/template/src/stores/test-data.json +164 -172
- package/template/theme-layouts/AdditionalStyling.css +50 -50
- package/template/theme-layouts/PrivateLayout.vue +8 -12
- package/template/theme-layouts/PublicLayout.vue +8 -12
- package/template/theme-layouts/SystemLayout.vue +8 -12
- package/template/vite.extend.js +45 -0
- package/template/vite.config.js +0 -409
|
@@ -4,41 +4,44 @@
|
|
|
4
4
|
* Copies package files to local project for customization.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const path = require("path")
|
|
8
|
-
const fs = require("fs")
|
|
7
|
+
const path = require("path")
|
|
8
|
+
const fs = require("fs")
|
|
9
9
|
const {
|
|
10
10
|
findProjectRoot,
|
|
11
11
|
resolveGxPaths,
|
|
12
12
|
promptUser,
|
|
13
13
|
safeCopyFile,
|
|
14
|
-
} = require("../utils")
|
|
14
|
+
} = require("../utils")
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Publish command - copies package files to local project
|
|
18
18
|
*/
|
|
19
19
|
async function publishCommand(argv) {
|
|
20
|
-
const projectPath = findProjectRoot()
|
|
21
|
-
const paths = resolveGxPaths()
|
|
20
|
+
const projectPath = findProjectRoot()
|
|
21
|
+
const paths = resolveGxPaths()
|
|
22
22
|
|
|
23
|
-
const fileName = argv.file || argv._[1]
|
|
23
|
+
const fileName = argv.file || argv._[1] // Support both --file and positional argument
|
|
24
24
|
|
|
25
25
|
if (!fileName) {
|
|
26
|
-
console.log("📦 Available files to publish:")
|
|
27
|
-
console.log("")
|
|
28
|
-
console.log(" Development files (customize dev environment):")
|
|
29
|
-
console.log(" • main.js - Development entry point")
|
|
30
|
-
console.log(" • index.html - HTML template")
|
|
31
|
-
console.log("
|
|
32
|
-
console.log("")
|
|
33
|
-
console.log("
|
|
34
|
-
console.log(" •
|
|
35
|
-
console.log("
|
|
36
|
-
console.log("")
|
|
37
|
-
console.log("
|
|
38
|
-
console.log(" gxdev publish
|
|
39
|
-
console.log("
|
|
40
|
-
console.log("
|
|
41
|
-
|
|
26
|
+
console.log("📦 Available files to publish:")
|
|
27
|
+
console.log("")
|
|
28
|
+
console.log(" Development files (customize dev environment):")
|
|
29
|
+
console.log(" • main.js - Development entry point")
|
|
30
|
+
console.log(" • index.html - HTML template")
|
|
31
|
+
console.log("")
|
|
32
|
+
console.log(" Runtime files (advanced customization):")
|
|
33
|
+
console.log(" • server.js - Socket.IO server file")
|
|
34
|
+
console.log(" • gxpPortalConfigStore.js - GxP datastore")
|
|
35
|
+
console.log("")
|
|
36
|
+
console.log("💡 Usage:")
|
|
37
|
+
console.log(" gxdev publish main.js")
|
|
38
|
+
console.log(" gxdev publish server.js")
|
|
39
|
+
console.log("")
|
|
40
|
+
console.log("💡 To customize the Vite config, create vite.extend.js at")
|
|
41
|
+
console.log(
|
|
42
|
+
" the project root — it will be merged into the runtime config.",
|
|
43
|
+
)
|
|
44
|
+
return
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
const publishableFiles = {
|
|
@@ -54,12 +57,6 @@ async function publishCommand(argv) {
|
|
|
54
57
|
desc: "HTML template",
|
|
55
58
|
location: "runtime",
|
|
56
59
|
},
|
|
57
|
-
"vite.config.js": {
|
|
58
|
-
src: "vite.config.js",
|
|
59
|
-
dest: "vite.config.js",
|
|
60
|
-
desc: "Vite build configuration",
|
|
61
|
-
location: "runtime",
|
|
62
|
-
},
|
|
63
60
|
"server.js": {
|
|
64
61
|
src: "server.js",
|
|
65
62
|
dest: "server.js",
|
|
@@ -72,79 +69,76 @@ async function publishCommand(argv) {
|
|
|
72
69
|
desc: "GxP datastore",
|
|
73
70
|
location: "runtime",
|
|
74
71
|
},
|
|
75
|
-
}
|
|
72
|
+
}
|
|
76
73
|
|
|
77
|
-
const fileConfig = publishableFiles[fileName]
|
|
74
|
+
const fileConfig = publishableFiles[fileName]
|
|
78
75
|
if (!fileConfig) {
|
|
79
|
-
console.error(`❌ Unknown file: ${fileName}`)
|
|
80
|
-
console.log(
|
|
81
|
-
|
|
82
|
-
Object.keys(publishableFiles).join(", ")
|
|
83
|
-
);
|
|
84
|
-
process.exit(1);
|
|
76
|
+
console.error(`❌ Unknown file: ${fileName}`)
|
|
77
|
+
console.log("📦 Available files:", Object.keys(publishableFiles).join(", "))
|
|
78
|
+
process.exit(1)
|
|
85
79
|
}
|
|
86
80
|
|
|
87
81
|
// Get source path from appropriate directory
|
|
88
82
|
const sourceDir =
|
|
89
|
-
fileConfig.location === "runtime" ? paths.runtimeDir : paths.templateDir
|
|
90
|
-
const srcPath = path.join(sourceDir, fileConfig.src)
|
|
91
|
-
const destPath = path.join(projectPath, fileConfig.dest)
|
|
83
|
+
fileConfig.location === "runtime" ? paths.runtimeDir : paths.templateDir
|
|
84
|
+
const srcPath = path.join(sourceDir, fileConfig.src)
|
|
85
|
+
const destPath = path.join(projectPath, fileConfig.dest)
|
|
92
86
|
|
|
93
87
|
if (!fs.existsSync(srcPath)) {
|
|
94
|
-
console.error(`❌ Source file not found: ${srcPath}`)
|
|
95
|
-
process.exit(1)
|
|
88
|
+
console.error(`❌ Source file not found: ${srcPath}`)
|
|
89
|
+
process.exit(1)
|
|
96
90
|
}
|
|
97
91
|
|
|
98
92
|
// Check if local file already exists
|
|
99
93
|
if (fs.existsSync(destPath)) {
|
|
100
94
|
const overwrite = await promptUser(
|
|
101
|
-
`📁 ${fileConfig.dest} already exists. Overwrite? (y/N):
|
|
102
|
-
)
|
|
95
|
+
`📁 ${fileConfig.dest} already exists. Overwrite? (y/N): `,
|
|
96
|
+
)
|
|
103
97
|
if (overwrite.toLowerCase() !== "y" && overwrite.toLowerCase() !== "yes") {
|
|
104
|
-
console.log("📦 Publish cancelled")
|
|
105
|
-
return
|
|
98
|
+
console.log("📦 Publish cancelled")
|
|
99
|
+
return
|
|
106
100
|
}
|
|
107
101
|
}
|
|
108
102
|
|
|
109
103
|
// Ensure destination directory exists
|
|
110
|
-
const destDir = path.dirname(destPath)
|
|
104
|
+
const destDir = path.dirname(destPath)
|
|
111
105
|
if (!fs.existsSync(destDir)) {
|
|
112
|
-
fs.mkdirSync(destDir, { recursive: true })
|
|
106
|
+
fs.mkdirSync(destDir, { recursive: true })
|
|
113
107
|
}
|
|
114
108
|
|
|
115
109
|
// Copy the file
|
|
116
|
-
fs.copyFileSync(srcPath, destPath)
|
|
117
|
-
console.log(`Creating ${fileConfig.desc}`)
|
|
118
|
-
console.log(`✅ Published ${fileName} to project`)
|
|
119
|
-
console.log(`📁 Local file: ${fileConfig.dest}`)
|
|
110
|
+
fs.copyFileSync(srcPath, destPath)
|
|
111
|
+
console.log(`Creating ${fileConfig.desc}`)
|
|
112
|
+
console.log(`✅ Published ${fileName} to project`)
|
|
113
|
+
console.log(`📁 Local file: ${fileConfig.dest}`)
|
|
120
114
|
|
|
121
115
|
// Special handling for index.html - update main.js reference to local path
|
|
122
116
|
if (fileName === "index.html") {
|
|
123
117
|
try {
|
|
124
|
-
let content = fs.readFileSync(destPath, "utf-8")
|
|
118
|
+
let content = fs.readFileSync(destPath, "utf-8")
|
|
125
119
|
// Update the runtime reference to local reference
|
|
126
120
|
if (content.includes('src="/@gx-runtime/main.js"')) {
|
|
127
121
|
content = content.replace(
|
|
128
122
|
'src="/@gx-runtime/main.js"',
|
|
129
|
-
'src="/main.js"'
|
|
130
|
-
)
|
|
131
|
-
fs.writeFileSync(destPath, content)
|
|
132
|
-
console.log("📝 Updated index.html to reference local main.js")
|
|
123
|
+
'src="/main.js"',
|
|
124
|
+
)
|
|
125
|
+
fs.writeFileSync(destPath, content)
|
|
126
|
+
console.log("📝 Updated index.html to reference local main.js")
|
|
133
127
|
console.log(
|
|
134
|
-
"💡 Make sure to also publish main.js: gxdev publish main.js"
|
|
135
|
-
)
|
|
128
|
+
"💡 Make sure to also publish main.js: gxdev publish main.js",
|
|
129
|
+
)
|
|
136
130
|
}
|
|
137
131
|
} catch (error) {
|
|
138
|
-
console.warn("⚠️ Could not update index.html:", error.message)
|
|
132
|
+
console.warn("⚠️ Could not update index.html:", error.message)
|
|
139
133
|
}
|
|
140
134
|
}
|
|
141
135
|
|
|
142
136
|
// Special handling for gxpPortalConfigStore.js - update the import in stores/index.js
|
|
143
137
|
if (fileName === "gxpPortalConfigStore.js") {
|
|
144
|
-
const storeIndexPath = path.join(projectPath, "src/stores/index.js")
|
|
138
|
+
const storeIndexPath = path.join(projectPath, "src/stores/index.js")
|
|
145
139
|
if (fs.existsSync(storeIndexPath)) {
|
|
146
140
|
try {
|
|
147
|
-
let content = fs.readFileSync(storeIndexPath, "utf-8")
|
|
141
|
+
let content = fs.readFileSync(storeIndexPath, "utf-8")
|
|
148
142
|
// Match both old (config) and new (runtime) import paths
|
|
149
143
|
const oldImportPatterns = [
|
|
150
144
|
"import { useGxpStore } from '@gxp-dev/tools/config/stores/gxpPortalConfigStore.js';",
|
|
@@ -152,38 +146,38 @@ async function publishCommand(argv) {
|
|
|
152
146
|
"import { useGxpStore } from '@gxp-dev/tools/runtime/stores/gxpPortalConfigStore.js';",
|
|
153
147
|
"import { useGxpStore } from '@gxp-dev/tools/runtime/stores/gxpPortalConfigStore';",
|
|
154
148
|
'import { useGxpStore } from "@gxp-dev/tools/runtime/stores/gxpPortalConfigStore";',
|
|
155
|
-
]
|
|
149
|
+
]
|
|
156
150
|
const newImport =
|
|
157
|
-
"import { useGxpStore } from './gxpPortalConfigStore.js';"
|
|
151
|
+
"import { useGxpStore } from './gxpPortalConfigStore.js';"
|
|
158
152
|
|
|
159
|
-
let updated = false
|
|
153
|
+
let updated = false
|
|
160
154
|
for (const oldImport of oldImportPatterns) {
|
|
161
155
|
if (content.includes(oldImport)) {
|
|
162
|
-
content = content.replace(oldImport, newImport)
|
|
163
|
-
updated = true
|
|
164
|
-
break
|
|
156
|
+
content = content.replace(oldImport, newImport)
|
|
157
|
+
updated = true
|
|
158
|
+
break
|
|
165
159
|
}
|
|
166
160
|
}
|
|
167
161
|
|
|
168
162
|
if (updated) {
|
|
169
|
-
fs.writeFileSync(storeIndexPath, content)
|
|
163
|
+
fs.writeFileSync(storeIndexPath, content)
|
|
170
164
|
console.log(
|
|
171
|
-
"📝 Updated stores/index.js to use local gxpPortalConfigStore.js"
|
|
172
|
-
)
|
|
165
|
+
"📝 Updated stores/index.js to use local gxpPortalConfigStore.js",
|
|
166
|
+
)
|
|
173
167
|
}
|
|
174
168
|
} catch (error) {
|
|
175
169
|
console.warn(
|
|
176
170
|
"⚠️ Could not update stores/index.js import:",
|
|
177
|
-
error.message
|
|
178
|
-
)
|
|
171
|
+
error.message,
|
|
172
|
+
)
|
|
179
173
|
}
|
|
180
174
|
}
|
|
181
175
|
}
|
|
182
176
|
|
|
183
|
-
console.log("💡 Future gxdev commands will now use your local copy")
|
|
184
|
-
console.log(" Delete the local file to fall back to package version")
|
|
177
|
+
console.log("💡 Future gxdev commands will now use your local copy")
|
|
178
|
+
console.log(" Delete the local file to fall back to package version")
|
|
185
179
|
}
|
|
186
180
|
|
|
187
181
|
module.exports = {
|
|
188
182
|
publishCommand,
|
|
189
|
-
}
|
|
183
|
+
}
|
|
@@ -4,155 +4,155 @@
|
|
|
4
4
|
* Simulates socket events for development testing.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const path = require("path")
|
|
8
|
-
const fs = require("fs")
|
|
9
|
-
const { findProjectRoot, resolveGxPaths } = require("../utils")
|
|
7
|
+
const path = require("path")
|
|
8
|
+
const fs = require("fs")
|
|
9
|
+
const { findProjectRoot, resolveGxPaths } = require("../utils")
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Socket simulation command - sends JSON events to the Socket.IO server
|
|
13
13
|
*/
|
|
14
14
|
async function socketCommand(argv) {
|
|
15
|
-
const action = argv.action
|
|
15
|
+
const action = argv.action
|
|
16
16
|
|
|
17
17
|
if (action === "list") {
|
|
18
|
-
listSocketEvents()
|
|
18
|
+
listSocketEvents()
|
|
19
19
|
} else if (action === "send") {
|
|
20
|
-
await sendSocketEvent(argv.event, argv.identifier)
|
|
20
|
+
await sendSocketEvent(argv.event, argv.identifier)
|
|
21
21
|
} else {
|
|
22
|
-
console.error("❌ Invalid socket action. Use 'list' or 'send'")
|
|
23
|
-
process.exit(1)
|
|
22
|
+
console.error("❌ Invalid socket action. Use 'list' or 'send'")
|
|
23
|
+
process.exit(1)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function listSocketEvents() {
|
|
28
|
-
const projectPath = findProjectRoot()
|
|
29
|
-
const paths = resolveGxPaths()
|
|
28
|
+
const projectPath = findProjectRoot()
|
|
29
|
+
const paths = resolveGxPaths()
|
|
30
30
|
|
|
31
31
|
// Check local project socket-events first, then fall back to toolkit's socket-events
|
|
32
|
-
let eventsDir = path.join(projectPath, "socket-events")
|
|
32
|
+
let eventsDir = path.join(projectPath, "socket-events")
|
|
33
33
|
if (!fs.existsSync(eventsDir)) {
|
|
34
|
-
eventsDir = paths.socketEventsDir
|
|
34
|
+
eventsDir = paths.socketEventsDir
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (!fs.existsSync(eventsDir)) {
|
|
38
|
-
console.log("❌ No socket events directory found")
|
|
39
|
-
console.log(`📁 Looking in: ${eventsDir}`)
|
|
40
|
-
return
|
|
38
|
+
console.log("❌ No socket events directory found")
|
|
39
|
+
console.log(`📁 Looking in: ${eventsDir}`)
|
|
40
|
+
return
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const eventFiles = fs
|
|
44
44
|
.readdirSync(eventsDir)
|
|
45
|
-
.filter((file) => file.endsWith(".json"))
|
|
45
|
+
.filter((file) => file.endsWith(".json"))
|
|
46
46
|
|
|
47
47
|
if (eventFiles.length === 0) {
|
|
48
|
-
console.log("❌ No socket event files found")
|
|
49
|
-
return
|
|
48
|
+
console.log("❌ No socket event files found")
|
|
49
|
+
return
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
console.log("📡 Available socket events:")
|
|
53
|
-
console.log("")
|
|
52
|
+
console.log("📡 Available socket events:")
|
|
53
|
+
console.log("")
|
|
54
54
|
|
|
55
55
|
eventFiles.forEach((file) => {
|
|
56
|
-
const eventPath = path.join(eventsDir, file)
|
|
56
|
+
const eventPath = path.join(eventsDir, file)
|
|
57
57
|
try {
|
|
58
|
-
const eventData = JSON.parse(fs.readFileSync(eventPath, "utf-8"))
|
|
59
|
-
const eventName = path.basename(file, ".json")
|
|
60
|
-
console.log(`🎯 ${eventName}`)
|
|
61
|
-
console.log(` Event: ${eventData.event}`)
|
|
62
|
-
console.log(` Channel: ${eventData.channel}`)
|
|
58
|
+
const eventData = JSON.parse(fs.readFileSync(eventPath, "utf-8"))
|
|
59
|
+
const eventName = path.basename(file, ".json")
|
|
60
|
+
console.log(`🎯 ${eventName}`)
|
|
61
|
+
console.log(` Event: ${eventData.event}`)
|
|
62
|
+
console.log(` Channel: ${eventData.channel}`)
|
|
63
63
|
if (eventData.data.id) {
|
|
64
|
-
console.log(` Data ID: ${eventData.data.id}`)
|
|
64
|
+
console.log(` Data ID: ${eventData.data.id}`)
|
|
65
65
|
}
|
|
66
|
-
console.log("")
|
|
66
|
+
console.log("")
|
|
67
67
|
} catch (error) {
|
|
68
|
-
console.error(`❌ Error reading ${file}: ${error.message}`)
|
|
68
|
+
console.error(`❌ Error reading ${file}: ${error.message}`)
|
|
69
69
|
}
|
|
70
|
-
})
|
|
70
|
+
})
|
|
71
71
|
|
|
72
|
-
console.log("💡 Usage:")
|
|
73
|
-
console.log(" gxdev socket send --event AiSessionMessageCreated")
|
|
72
|
+
console.log("💡 Usage:")
|
|
73
|
+
console.log(" gxdev socket send --event AiSessionMessageCreated")
|
|
74
74
|
console.log(
|
|
75
|
-
" gxdev socket send --event SocialStreamPostCreated --identifier social_stream"
|
|
76
|
-
)
|
|
75
|
+
" gxdev socket send --event SocialStreamPostCreated --identifier social_stream",
|
|
76
|
+
)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
async function sendSocketEvent(eventName, identifier) {
|
|
80
80
|
if (!eventName) {
|
|
81
|
-
console.error("❌ Event name is required")
|
|
82
|
-
console.log("💡 Use: gxdev socket send --event <EventName>")
|
|
83
|
-
process.exit(1)
|
|
81
|
+
console.error("❌ Event name is required")
|
|
82
|
+
console.log("💡 Use: gxdev socket send --event <EventName>")
|
|
83
|
+
process.exit(1)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const projectPath = findProjectRoot()
|
|
87
|
-
const paths = resolveGxPaths()
|
|
88
|
-
const socketIoPort = process.env.SOCKET_IO_PORT || 3069
|
|
86
|
+
const projectPath = findProjectRoot()
|
|
87
|
+
const paths = resolveGxPaths()
|
|
88
|
+
const socketIoPort = process.env.SOCKET_IO_PORT || 3069
|
|
89
89
|
|
|
90
90
|
// Check local project socket-events first, then fall back to toolkit's socket-events
|
|
91
|
-
let eventsDir = path.join(projectPath, "socket-events")
|
|
91
|
+
let eventsDir = path.join(projectPath, "socket-events")
|
|
92
92
|
if (!fs.existsSync(eventsDir)) {
|
|
93
|
-
eventsDir = paths.socketEventsDir
|
|
93
|
+
eventsDir = paths.socketEventsDir
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const eventPath = path.join(eventsDir, `${eventName}.json`)
|
|
96
|
+
const eventPath = path.join(eventsDir, `${eventName}.json`)
|
|
97
97
|
|
|
98
98
|
if (!fs.existsSync(eventPath)) {
|
|
99
|
-
console.error(`❌ Event file not found: ${eventName}.json`)
|
|
100
|
-
console.log(`📁 Looking in: ${eventsDir}`)
|
|
101
|
-
console.log("💡 Use 'gxdev socket list' to see available events")
|
|
102
|
-
process.exit(1)
|
|
99
|
+
console.error(`❌ Event file not found: ${eventName}.json`)
|
|
100
|
+
console.log(`📁 Looking in: ${eventsDir}`)
|
|
101
|
+
console.log("💡 Use 'gxdev socket list' to see available events")
|
|
102
|
+
process.exit(1)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
try {
|
|
106
|
-
let eventData = JSON.parse(fs.readFileSync(eventPath, "utf-8"))
|
|
106
|
+
let eventData = JSON.parse(fs.readFileSync(eventPath, "utf-8"))
|
|
107
107
|
|
|
108
108
|
// If identifier is provided, update the channel
|
|
109
109
|
if (identifier) {
|
|
110
110
|
// Try to extract model from the original channel
|
|
111
|
-
const channelParts = eventData.channel.split(".")
|
|
111
|
+
const channelParts = eventData.channel.split(".")
|
|
112
112
|
if (channelParts.length >= 2) {
|
|
113
|
-
const model = channelParts[1]
|
|
114
|
-
eventData.channel = `private.${model}.${identifier}
|
|
113
|
+
const model = channelParts[1]
|
|
114
|
+
eventData.channel = `private.${model}.${identifier}`
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// Send the event via HTTP to the Socket.IO server
|
|
119
|
-
const socketUrl = `https://localhost:${socketIoPort}
|
|
119
|
+
const socketUrl = `https://localhost:${socketIoPort}`
|
|
120
120
|
|
|
121
|
-
console.log(`📡 Sending socket event: ${eventData.event}`)
|
|
122
|
-
console.log(`📺 Channel: ${eventData.channel}`)
|
|
123
|
-
console.log(`📦 Data:`, JSON.stringify(eventData.data, null, 2))
|
|
121
|
+
console.log(`📡 Sending socket event: ${eventData.event}`)
|
|
122
|
+
console.log(`📺 Channel: ${eventData.channel}`)
|
|
123
|
+
console.log(`📦 Data:`, JSON.stringify(eventData.data, null, 2))
|
|
124
124
|
|
|
125
125
|
// Use axios to send the event to our Socket.IO server
|
|
126
|
-
const axios = require("axios")
|
|
126
|
+
const axios = require("axios")
|
|
127
127
|
|
|
128
128
|
try {
|
|
129
129
|
await axios.post(`${socketUrl}/emit`, {
|
|
130
130
|
event: eventData.event,
|
|
131
131
|
channel: eventData.channel,
|
|
132
132
|
data: eventData.data,
|
|
133
|
-
})
|
|
133
|
+
})
|
|
134
134
|
|
|
135
|
-
console.log("✅ Socket event sent successfully!")
|
|
135
|
+
console.log("✅ Socket event sent successfully!")
|
|
136
136
|
console.log(
|
|
137
|
-
"👂 Check your app console for the received event in the store"
|
|
138
|
-
)
|
|
137
|
+
"👂 Check your app console for the received event in the store",
|
|
138
|
+
)
|
|
139
139
|
} catch (error) {
|
|
140
140
|
if (error.code === "ECONNREFUSED") {
|
|
141
|
-
console.error("❌ Cannot connect to Socket.IO server")
|
|
142
|
-
console.log("💡 Make sure the server is running:")
|
|
143
|
-
console.log(" npm run dev")
|
|
144
|
-
console.log(" or")
|
|
145
|
-
console.log(" nodemon server.js")
|
|
141
|
+
console.error("❌ Cannot connect to Socket.IO server")
|
|
142
|
+
console.log("💡 Make sure the server is running:")
|
|
143
|
+
console.log(" npm run dev")
|
|
144
|
+
console.log(" or")
|
|
145
|
+
console.log(" nodemon server.js")
|
|
146
146
|
} else {
|
|
147
|
-
console.error(`❌ Error sending event: ${error.message}`)
|
|
147
|
+
console.error(`❌ Error sending event: ${error.message}`)
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
} catch (error) {
|
|
151
|
-
console.error(`❌ Error reading event file: ${error.message}`)
|
|
152
|
-
process.exit(1)
|
|
151
|
+
console.error(`❌ Error reading event file: ${error.message}`)
|
|
152
|
+
process.exit(1)
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
module.exports = {
|
|
157
157
|
socketCommand,
|
|
158
|
-
}
|
|
158
|
+
}
|
package/bin/lib/commands/ssl.js
CHANGED
|
@@ -9,39 +9,39 @@ const {
|
|
|
9
9
|
ensureMkcertInstalled,
|
|
10
10
|
generateSSLCertificates,
|
|
11
11
|
updateEnvWithCertPaths,
|
|
12
|
-
} = require("../utils")
|
|
12
|
+
} = require("../utils")
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Setup SSL certificates command
|
|
16
16
|
*/
|
|
17
17
|
function setupSSLCommand() {
|
|
18
|
-
const projectPath = findProjectRoot()
|
|
18
|
+
const projectPath = findProjectRoot()
|
|
19
19
|
|
|
20
|
-
console.log("Setting up SSL certificates for HTTPS development...")
|
|
20
|
+
console.log("Setting up SSL certificates for HTTPS development...")
|
|
21
21
|
|
|
22
22
|
// Ensure mkcert is available
|
|
23
|
-
ensureMkcertInstalled()
|
|
23
|
+
ensureMkcertInstalled()
|
|
24
24
|
|
|
25
25
|
// Generate certificates
|
|
26
|
-
const certs = generateSSLCertificates(projectPath)
|
|
26
|
+
const certs = generateSSLCertificates(projectPath)
|
|
27
27
|
|
|
28
28
|
if (certs) {
|
|
29
29
|
// Update .env file with actual certificate names
|
|
30
|
-
updateEnvWithCertPaths(projectPath, certs)
|
|
30
|
+
updateEnvWithCertPaths(projectPath, certs)
|
|
31
31
|
|
|
32
|
-
console.log("✅ SSL setup complete!")
|
|
33
|
-
console.log("🔒 Your development server will now use HTTPS")
|
|
34
|
-
console.log("📁 Certificates stored in .certs/ directory")
|
|
32
|
+
console.log("✅ SSL setup complete!")
|
|
33
|
+
console.log("🔒 Your development server will now use HTTPS")
|
|
34
|
+
console.log("📁 Certificates stored in .certs/ directory")
|
|
35
35
|
console.log(
|
|
36
|
-
"🚀 Run 'npm run dev' to start HTTPS development with Socket.IO"
|
|
37
|
-
)
|
|
36
|
+
"🚀 Run 'npm run dev' to start HTTPS development with Socket.IO",
|
|
37
|
+
)
|
|
38
38
|
} else {
|
|
39
39
|
console.log(
|
|
40
|
-
"❌ SSL setup failed. You can still use HTTP with 'npm run dev-http'"
|
|
41
|
-
)
|
|
40
|
+
"❌ SSL setup failed. You can still use HTTP with 'npm run dev-http'",
|
|
41
|
+
)
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
module.exports = {
|
|
46
46
|
setupSSLCommand,
|
|
47
|
-
}
|
|
47
|
+
}
|
package/bin/lib/constants.js
CHANGED
|
@@ -5,32 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// Platform-specific configurations
|
|
8
|
-
const isWin = process.platform === "win32"
|
|
9
|
-
const exportCmd = isWin ? "set" : "export"
|
|
8
|
+
const isWin = process.platform === "win32"
|
|
9
|
+
const exportCmd = isWin ? "set" : "export"
|
|
10
10
|
|
|
11
11
|
// Required dependencies for GxP projects
|
|
12
12
|
const REQUIRED_DEPENDENCIES = {
|
|
13
|
-
"@vitejs/plugin-vue": "^5.1.4",
|
|
14
|
-
vite: "^5.4.8",
|
|
15
|
-
vue: "^3.5.8",
|
|
16
|
-
pinia: "^2.1.7",
|
|
17
|
-
axios: "^1.6.0",
|
|
18
|
-
cors: "^2.8.5",
|
|
19
|
-
express: "^4.21.0",
|
|
20
|
-
"socket.io": "^4.8.0",
|
|
21
|
-
"socket.io-client": "^4.8.0",
|
|
22
13
|
dotenv: "^16.4.5",
|
|
23
|
-
"@
|
|
24
|
-
|
|
25
|
-
"json-schema-faker": "^0.5.6",
|
|
26
|
-
};
|
|
14
|
+
"@gxp-dev/uikit": "^0.1.0",
|
|
15
|
+
}
|
|
27
16
|
|
|
28
17
|
const REQUIRED_DEV_DEPENDENCIES = {
|
|
29
18
|
"@gxp-dev/tools": "^2.0.0",
|
|
30
|
-
|
|
31
|
-
concurrently: "^9.0.1",
|
|
32
|
-
mkcert: "^3.2.0",
|
|
33
|
-
};
|
|
19
|
+
}
|
|
34
20
|
|
|
35
21
|
// Default scripts for package.json
|
|
36
22
|
const DEFAULT_SCRIPTS = {
|
|
@@ -49,13 +35,13 @@ const DEFAULT_SCRIPTS = {
|
|
|
49
35
|
"datastore:add": "gxdev datastore add",
|
|
50
36
|
"datastore:scan": "gxdev datastore scan-strings",
|
|
51
37
|
"datastore:config": "gxdev datastore config",
|
|
52
|
-
}
|
|
38
|
+
}
|
|
53
39
|
|
|
54
40
|
// Default ports
|
|
55
41
|
const DEFAULT_PORTS = {
|
|
56
42
|
dev: 3060,
|
|
57
43
|
socketIo: 3069,
|
|
58
|
-
}
|
|
44
|
+
}
|
|
59
45
|
|
|
60
46
|
const ENVIRONMENT_URLS = {
|
|
61
47
|
production: {
|
|
@@ -116,10 +102,10 @@ const ENVIRONMENT_URLS = {
|
|
|
116
102
|
asyncApiSpec: "https://api.eventfinity.test/api-specs/asyncapi.json",
|
|
117
103
|
webhookSpec: "https://api.eventfinity.test/api-specs/webhooks.json",
|
|
118
104
|
},
|
|
119
|
-
}
|
|
105
|
+
}
|
|
120
106
|
|
|
121
107
|
// Package name for path resolution
|
|
122
|
-
const PACKAGE_NAME = "@gxp-dev/tools"
|
|
108
|
+
const PACKAGE_NAME = "@gxp-dev/tools"
|
|
123
109
|
|
|
124
110
|
module.exports = {
|
|
125
111
|
isWin,
|
|
@@ -130,4 +116,4 @@ module.exports = {
|
|
|
130
116
|
DEFAULT_PORTS,
|
|
131
117
|
PACKAGE_NAME,
|
|
132
118
|
ENVIRONMENT_URLS,
|
|
133
|
-
}
|
|
119
|
+
}
|