@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
package/bin/lib/commands/dev.js
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* and browser extension launching.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const path = require("path")
|
|
9
|
-
const fs = require("fs")
|
|
10
|
-
const shell = require("shelljs")
|
|
11
|
-
const dotenv = require("dotenv")
|
|
8
|
+
const path = require("path")
|
|
9
|
+
const fs = require("fs")
|
|
10
|
+
const shell = require("shelljs")
|
|
11
|
+
const dotenv = require("dotenv")
|
|
12
12
|
const {
|
|
13
13
|
findProjectRoot,
|
|
14
14
|
resolveGxPaths,
|
|
15
15
|
resolveFilePath,
|
|
16
16
|
findExistingCertificates,
|
|
17
|
-
} = require("../utils")
|
|
17
|
+
} = require("../utils")
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Get browser extension paths and commands
|
|
@@ -26,23 +26,23 @@ const {
|
|
|
26
26
|
* @param {number|string} options.port - Dev server port
|
|
27
27
|
*/
|
|
28
28
|
function getBrowserExtensionConfig(browser, projectPath, paths, options = {}) {
|
|
29
|
-
const { useHttps = true, port = 3060 } = options
|
|
30
|
-
const protocol = useHttps ? "https" : "http"
|
|
31
|
-
const startUrl = `${protocol}://localhost:${port}
|
|
29
|
+
const { useHttps = true, port = 3060 } = options
|
|
30
|
+
const protocol = useHttps ? "https" : "http"
|
|
31
|
+
const startUrl = `${protocol}://localhost:${port}`
|
|
32
32
|
|
|
33
33
|
if (browser === "firefox") {
|
|
34
|
-
let extensionPath = path.join(projectPath, "browser-extensions", "firefox")
|
|
34
|
+
let extensionPath = path.join(projectPath, "browser-extensions", "firefox")
|
|
35
35
|
|
|
36
36
|
if (!fs.existsSync(extensionPath)) {
|
|
37
37
|
const toolkitExtensionPath = path.join(
|
|
38
38
|
paths.packageRoot,
|
|
39
39
|
"browser-extensions",
|
|
40
|
-
"firefox"
|
|
41
|
-
)
|
|
40
|
+
"firefox",
|
|
41
|
+
)
|
|
42
42
|
if (fs.existsSync(toolkitExtensionPath)) {
|
|
43
|
-
extensionPath = toolkitExtensionPath
|
|
43
|
+
extensionPath = toolkitExtensionPath
|
|
44
44
|
} else {
|
|
45
|
-
return null
|
|
45
|
+
return null
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -52,37 +52,33 @@ function getBrowserExtensionConfig(browser, projectPath, paths, options = {}) {
|
|
|
52
52
|
command: `npx web-ext run --source-dir "${extensionPath}" --start-url "${startUrl}"`,
|
|
53
53
|
extensionPath,
|
|
54
54
|
startUrl,
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (browser === "chrome") {
|
|
59
|
-
let extensionPath = path.join(projectPath, "browser-extensions", "chrome")
|
|
60
|
-
let scriptPath = path.join(projectPath, "scripts", "launch-chrome.js")
|
|
59
|
+
let extensionPath = path.join(projectPath, "browser-extensions", "chrome")
|
|
60
|
+
let scriptPath = path.join(projectPath, "scripts", "launch-chrome.js")
|
|
61
61
|
|
|
62
62
|
if (!fs.existsSync(extensionPath)) {
|
|
63
63
|
const toolkitExtensionPath = path.join(
|
|
64
64
|
paths.packageRoot,
|
|
65
65
|
"browser-extensions",
|
|
66
|
-
"chrome"
|
|
67
|
-
)
|
|
66
|
+
"chrome",
|
|
67
|
+
)
|
|
68
68
|
if (fs.existsSync(toolkitExtensionPath)) {
|
|
69
|
-
extensionPath = toolkitExtensionPath
|
|
70
|
-
scriptPath = path.join(
|
|
71
|
-
paths.packageRoot,
|
|
72
|
-
"scripts",
|
|
73
|
-
"launch-chrome.js"
|
|
74
|
-
);
|
|
69
|
+
extensionPath = toolkitExtensionPath
|
|
70
|
+
scriptPath = path.join(paths.packageRoot, "scripts", "launch-chrome.js")
|
|
75
71
|
} else {
|
|
76
|
-
return null
|
|
72
|
+
return null
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
if (!fs.existsSync(scriptPath)) {
|
|
81
|
-
return null
|
|
77
|
+
return null
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
// Normalize path separators for cross-platform shell compatibility
|
|
85
|
-
const normalizedScriptPath = scriptPath.replace(/\\/g, "/")
|
|
81
|
+
const normalizedScriptPath = scriptPath.replace(/\\/g, "/")
|
|
86
82
|
return {
|
|
87
83
|
name: "CHROME",
|
|
88
84
|
color: "blue",
|
|
@@ -90,159 +86,159 @@ function getBrowserExtensionConfig(browser, projectPath, paths, options = {}) {
|
|
|
90
86
|
command: `node "${normalizedScriptPath}"`,
|
|
91
87
|
extensionPath,
|
|
92
88
|
startUrl,
|
|
93
|
-
}
|
|
89
|
+
}
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
return null
|
|
92
|
+
return null
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
/**
|
|
100
96
|
* Development command - starts the dev server
|
|
101
97
|
*/
|
|
102
98
|
function devCommand(argv) {
|
|
103
|
-
const paths = resolveGxPaths()
|
|
104
|
-
const projectPath = findProjectRoot()
|
|
99
|
+
const paths = resolveGxPaths()
|
|
100
|
+
const projectPath = findProjectRoot()
|
|
105
101
|
|
|
106
102
|
// Load .env file if it exists for default values
|
|
107
|
-
const envPath = path.join(projectPath, ".env")
|
|
108
|
-
const envExamplePath = path.join(projectPath, ".env.example")
|
|
103
|
+
const envPath = path.join(projectPath, ".env")
|
|
104
|
+
const envExamplePath = path.join(projectPath, ".env.example")
|
|
109
105
|
|
|
110
106
|
// Load .env file into process.env
|
|
111
107
|
if (fs.existsSync(envPath)) {
|
|
112
|
-
console.log("📋 Loading environment variables from .env file")
|
|
113
|
-
dotenv.config({ path: envPath })
|
|
108
|
+
console.log("📋 Loading environment variables from .env file")
|
|
109
|
+
dotenv.config({ path: envPath })
|
|
114
110
|
} else if (fs.existsSync(envExamplePath)) {
|
|
115
111
|
console.log(
|
|
116
|
-
"💡 Tip: Create .env file from .env.example to customize your environment settings"
|
|
117
|
-
)
|
|
118
|
-
console.log(" cp .env.example .env")
|
|
112
|
+
"💡 Tip: Create .env file from .env.example to customize your environment settings",
|
|
113
|
+
)
|
|
114
|
+
console.log(" cp .env.example .env")
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
// Check for SSL certificates unless explicitly disabled
|
|
122
|
-
let useHttps = !argv["no-https"]
|
|
123
|
-
let certPath = ""
|
|
124
|
-
let keyPath = ""
|
|
118
|
+
let useHttps = !argv["no-https"]
|
|
119
|
+
let certPath = ""
|
|
120
|
+
let keyPath = ""
|
|
125
121
|
|
|
126
122
|
if (useHttps) {
|
|
127
|
-
const certsDir = path.join(projectPath, ".certs")
|
|
128
|
-
const existingCerts = findExistingCertificates(certsDir)
|
|
123
|
+
const certsDir = path.join(projectPath, ".certs")
|
|
124
|
+
const existingCerts = findExistingCertificates(certsDir)
|
|
129
125
|
|
|
130
126
|
if (!existingCerts) {
|
|
131
127
|
console.log(
|
|
132
|
-
"⚠ SSL certificates not found. Run 'npm run setup-ssl' to enable HTTPS"
|
|
133
|
-
)
|
|
134
|
-
console.log("🌐 Starting HTTP development server...")
|
|
135
|
-
useHttps = false
|
|
128
|
+
"⚠ SSL certificates not found. Run 'npm run setup-ssl' to enable HTTPS",
|
|
129
|
+
)
|
|
130
|
+
console.log("🌐 Starting HTTP development server...")
|
|
131
|
+
useHttps = false
|
|
136
132
|
} else {
|
|
137
|
-
console.log("🔒 Starting HTTPS development server...")
|
|
133
|
+
console.log("🔒 Starting HTTPS development server...")
|
|
138
134
|
console.log(
|
|
139
|
-
`📁 Using certificate: ${path.basename(existingCerts.certPath)}
|
|
140
|
-
)
|
|
141
|
-
console.log(`🔑 Using key: ${path.basename(existingCerts.keyPath)}`)
|
|
142
|
-
certPath = existingCerts.certPath
|
|
143
|
-
keyPath = existingCerts.keyPath
|
|
135
|
+
`📁 Using certificate: ${path.basename(existingCerts.certPath)}`,
|
|
136
|
+
)
|
|
137
|
+
console.log(`🔑 Using key: ${path.basename(existingCerts.keyPath)}`)
|
|
138
|
+
certPath = existingCerts.certPath
|
|
139
|
+
keyPath = existingCerts.keyPath
|
|
144
140
|
}
|
|
145
141
|
} else {
|
|
146
|
-
console.log("🌐 Starting HTTP development server...")
|
|
142
|
+
console.log("🌐 Starting HTTP development server...")
|
|
147
143
|
}
|
|
148
144
|
|
|
149
145
|
// Determine final port value (priority: CLI arg > .env > default)
|
|
150
|
-
const finalPort = argv.port || process.env.NODE_PORT || 3000
|
|
151
|
-
console.log(`🌐 Development server will start on port: ${finalPort}`)
|
|
146
|
+
const finalPort = argv.port || process.env.NODE_PORT || 3000
|
|
147
|
+
console.log(`🌐 Development server will start on port: ${finalPort}`)
|
|
152
148
|
|
|
153
149
|
// Check if mock API should be enabled
|
|
154
|
-
const withMock = argv["with-mock"]
|
|
150
|
+
const withMock = argv["with-mock"]
|
|
155
151
|
if (withMock) {
|
|
156
|
-
console.log("🎭 Mock API will be enabled")
|
|
152
|
+
console.log("🎭 Mock API will be enabled")
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
// Socket server starts by default unless --no-socket is passed
|
|
160
|
-
const noSocket = argv["no-socket"]
|
|
161
|
-
let serverJsPath = ""
|
|
156
|
+
const noSocket = argv["no-socket"]
|
|
157
|
+
let serverJsPath = ""
|
|
162
158
|
if (!noSocket) {
|
|
163
159
|
// Check for local server.js first, then runtime directory
|
|
164
|
-
const serverJs = resolveFilePath("server.js", "", "runtime")
|
|
160
|
+
const serverJs = resolveFilePath("server.js", "", "runtime")
|
|
165
161
|
if (!fs.existsSync(serverJs.path)) {
|
|
166
|
-
console.warn("⚠ server.js not found. Skipping Socket.IO server.")
|
|
162
|
+
console.warn("⚠ server.js not found. Skipping Socket.IO server.")
|
|
167
163
|
} else {
|
|
168
|
-
serverJsPath = serverJs.path
|
|
164
|
+
serverJsPath = serverJs.path
|
|
169
165
|
console.log(
|
|
170
166
|
`📡 Starting Socket.IO server with nodemon... (${
|
|
171
167
|
serverJs.isLocal ? "local" : "package"
|
|
172
|
-
} version)
|
|
173
|
-
)
|
|
174
|
-
console.log(`📁 Using: ${serverJsPath}`)
|
|
168
|
+
} version)`,
|
|
169
|
+
)
|
|
170
|
+
console.log(`📁 Using: ${serverJsPath}`)
|
|
175
171
|
}
|
|
176
172
|
}
|
|
177
173
|
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
const
|
|
183
|
-
const localMainJs = path.join(projectPath, "main.js");
|
|
174
|
+
// Vite config always comes from the runtime. Projects extend it via an
|
|
175
|
+
// optional `vite.extend.js` at the project root (see runtime/vite.config.js).
|
|
176
|
+
const viteConfigPath = paths.viteConfigPath
|
|
177
|
+
const localIndexHtml = path.join(projectPath, "index.html")
|
|
178
|
+
const localMainJs = path.join(projectPath, "main.js")
|
|
184
179
|
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
const
|
|
180
|
+
const hasLocalIndexHtml = fs.existsSync(localIndexHtml)
|
|
181
|
+
const hasLocalMainJs = fs.existsSync(localMainJs)
|
|
182
|
+
const hasLocalExtend =
|
|
183
|
+
fs.existsSync(path.join(projectPath, "vite.extend.js")) ||
|
|
184
|
+
fs.existsSync(path.join(projectPath, "vite.extend.mjs"))
|
|
188
185
|
|
|
189
|
-
if (hasLocalViteConfig) {
|
|
190
|
-
viteConfigPath = localViteConfigPath;
|
|
191
|
-
console.log("📁 Using local vite.config.js");
|
|
192
|
-
}
|
|
193
186
|
if (hasLocalIndexHtml) {
|
|
194
|
-
console.log("📁 Using local index.html")
|
|
187
|
+
console.log("📁 Using local index.html")
|
|
195
188
|
}
|
|
196
189
|
if (hasLocalMainJs) {
|
|
197
|
-
console.log("📁 Using local main.js")
|
|
190
|
+
console.log("📁 Using local main.js")
|
|
198
191
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
192
|
+
if (hasLocalExtend) {
|
|
193
|
+
console.log("🧩 Extending vite config from vite.extend.js")
|
|
194
|
+
}
|
|
195
|
+
if (!hasLocalIndexHtml && !hasLocalMainJs && !hasLocalExtend) {
|
|
196
|
+
console.log(
|
|
197
|
+
"📦 Using runtime dev files (create vite.extend.js to customize)",
|
|
198
|
+
)
|
|
203
199
|
}
|
|
204
200
|
|
|
205
201
|
// Set environment variables directly on process.env for cross-platform compatibility.
|
|
206
202
|
// Using shell-level "export"/"set" syntax breaks on Windows due to cmd.exe quote parsing.
|
|
207
203
|
if (!process.env.NODE_LOG_LEVEL) {
|
|
208
|
-
process.env.NODE_LOG_LEVEL = argv["node-log-level"] || "info"
|
|
204
|
+
process.env.NODE_LOG_LEVEL = argv["node-log-level"] || "info"
|
|
209
205
|
}
|
|
210
206
|
if (!process.env.NODE_PORT) {
|
|
211
|
-
process.env.NODE_PORT = String(finalPort)
|
|
207
|
+
process.env.NODE_PORT = String(finalPort)
|
|
212
208
|
}
|
|
213
209
|
if (!process.env.COMPONENT_PATH) {
|
|
214
|
-
process.env.COMPONENT_PATH = argv["component-path"] || "./src/Plugin.vue"
|
|
210
|
+
process.env.COMPONENT_PATH = argv["component-path"] || "./src/Plugin.vue"
|
|
215
211
|
}
|
|
216
212
|
|
|
217
213
|
// Always set HTTPS-related variables (these are dynamic)
|
|
218
|
-
process.env.USE_HTTPS = useHttps ? "true" : "false"
|
|
219
|
-
process.env.CERT_PATH = certPath
|
|
220
|
-
process.env.KEY_PATH = keyPath
|
|
214
|
+
process.env.USE_HTTPS = useHttps ? "true" : "false"
|
|
215
|
+
process.env.CERT_PATH = certPath
|
|
216
|
+
process.env.KEY_PATH = keyPath
|
|
221
217
|
|
|
222
218
|
// Set mock API flag if requested
|
|
223
219
|
if (withMock) {
|
|
224
|
-
process.env.MOCK_API_ENABLED = "true"
|
|
220
|
+
process.env.MOCK_API_ENABLED = "true"
|
|
225
221
|
}
|
|
226
222
|
|
|
227
223
|
// Check for browser extension flags
|
|
228
|
-
const launchFirefox = argv.firefox
|
|
229
|
-
const launchChrome = argv.chrome
|
|
224
|
+
const launchFirefox = argv.firefox
|
|
225
|
+
const launchChrome = argv.chrome
|
|
230
226
|
|
|
231
227
|
// Get browser extension configurations
|
|
232
|
-
let firefoxConfig = null
|
|
233
|
-
let chromeConfig = null
|
|
228
|
+
let firefoxConfig = null
|
|
229
|
+
let chromeConfig = null
|
|
234
230
|
|
|
235
231
|
if (launchFirefox) {
|
|
236
232
|
firefoxConfig = getBrowserExtensionConfig("firefox", projectPath, paths, {
|
|
237
233
|
useHttps,
|
|
238
234
|
port: finalPort,
|
|
239
|
-
})
|
|
235
|
+
})
|
|
240
236
|
if (firefoxConfig) {
|
|
241
|
-
console.log("🦊 Firefox extension will launch with dev server")
|
|
242
|
-
console.log(`📁 Extension path: ${firefoxConfig.extensionPath}`)
|
|
243
|
-
console.log(`🌐 Start URL: ${firefoxConfig.startUrl}`)
|
|
237
|
+
console.log("🦊 Firefox extension will launch with dev server")
|
|
238
|
+
console.log(`📁 Extension path: ${firefoxConfig.extensionPath}`)
|
|
239
|
+
console.log(`🌐 Start URL: ${firefoxConfig.startUrl}`)
|
|
244
240
|
} else {
|
|
245
|
-
console.warn("⚠️ Firefox extension not found, skipping")
|
|
241
|
+
console.warn("⚠️ Firefox extension not found, skipping")
|
|
246
242
|
}
|
|
247
243
|
}
|
|
248
244
|
|
|
@@ -250,74 +246,74 @@ function devCommand(argv) {
|
|
|
250
246
|
chromeConfig = getBrowserExtensionConfig("chrome", projectPath, paths, {
|
|
251
247
|
useHttps,
|
|
252
248
|
port: finalPort,
|
|
253
|
-
})
|
|
249
|
+
})
|
|
254
250
|
if (chromeConfig) {
|
|
255
|
-
console.log("🚀 Chrome extension will launch with dev server")
|
|
256
|
-
console.log(`📁 Extension path: ${chromeConfig.extensionPath}`)
|
|
257
|
-
console.log(`🌐 Start URL: ${chromeConfig.startUrl}`)
|
|
251
|
+
console.log("🚀 Chrome extension will launch with dev server")
|
|
252
|
+
console.log(`📁 Extension path: ${chromeConfig.extensionPath}`)
|
|
253
|
+
console.log(`🌐 Start URL: ${chromeConfig.startUrl}`)
|
|
258
254
|
} else {
|
|
259
|
-
console.warn("⚠️ Chrome extension not found, skipping")
|
|
255
|
+
console.warn("⚠️ Chrome extension not found, skipping")
|
|
260
256
|
}
|
|
261
257
|
}
|
|
262
258
|
|
|
263
259
|
// Set CHROME_EXTENSION_PATH on process.env so launch-chrome.js inherits it
|
|
264
260
|
if (chromeConfig) {
|
|
265
|
-
process.env.CHROME_EXTENSION_PATH = chromeConfig.extensionPath
|
|
261
|
+
process.env.CHROME_EXTENSION_PATH = chromeConfig.extensionPath
|
|
266
262
|
}
|
|
267
263
|
|
|
268
264
|
// Build the command based on what's requested
|
|
269
|
-
let command
|
|
265
|
+
let command
|
|
270
266
|
|
|
271
267
|
// Collect all processes to run
|
|
272
|
-
const processes = []
|
|
273
|
-
const names = []
|
|
274
|
-
const colors = []
|
|
268
|
+
const processes = []
|
|
269
|
+
const names = []
|
|
270
|
+
const colors = []
|
|
275
271
|
|
|
276
272
|
// Normalize path separators to forward slashes for cross-platform shell compatibility
|
|
277
|
-
const normalizedViteConfigPath = viteConfigPath.replace(/\\/g, "/")
|
|
273
|
+
const normalizedViteConfigPath = viteConfigPath.replace(/\\/g, "/")
|
|
278
274
|
|
|
279
275
|
// Vite is always included
|
|
280
|
-
const viteCommand = `npx vite dev --config "${normalizedViteConfigPath}"
|
|
281
|
-
processes.push(`"${viteCommand}"`)
|
|
282
|
-
names.push("VITE")
|
|
283
|
-
colors.push("cyan")
|
|
276
|
+
const viteCommand = `npx vite dev --config "${normalizedViteConfigPath}"`
|
|
277
|
+
processes.push(`"${viteCommand}"`)
|
|
278
|
+
names.push("VITE")
|
|
279
|
+
colors.push("cyan")
|
|
284
280
|
|
|
285
281
|
// Socket server (on by default, skip if --no-socket or server.js not found)
|
|
286
282
|
if (serverJsPath) {
|
|
287
|
-
const normalizedServerPath = serverJsPath.replace(/\\/g, "/")
|
|
288
|
-
processes.push(`"npx nodemon \\"${normalizedServerPath}\\""`)
|
|
289
|
-
names.push("SOCKET")
|
|
290
|
-
colors.push("green")
|
|
283
|
+
const normalizedServerPath = serverJsPath.replace(/\\/g, "/")
|
|
284
|
+
processes.push(`"npx nodemon \\"${normalizedServerPath}\\""`)
|
|
285
|
+
names.push("SOCKET")
|
|
286
|
+
colors.push("green")
|
|
291
287
|
}
|
|
292
288
|
|
|
293
289
|
// Firefox extension (optional)
|
|
294
290
|
if (firefoxConfig) {
|
|
295
|
-
processes.push(`"${firefoxConfig.command}"`)
|
|
296
|
-
names.push(firefoxConfig.name)
|
|
297
|
-
colors.push(firefoxConfig.color)
|
|
291
|
+
processes.push(`"${firefoxConfig.command}"`)
|
|
292
|
+
names.push(firefoxConfig.name)
|
|
293
|
+
colors.push(firefoxConfig.color)
|
|
298
294
|
}
|
|
299
295
|
|
|
300
296
|
// Chrome extension (optional)
|
|
301
297
|
if (chromeConfig) {
|
|
302
|
-
processes.push(`"${chromeConfig.command}"`)
|
|
303
|
-
names.push(chromeConfig.name)
|
|
304
|
-
colors.push(chromeConfig.color)
|
|
298
|
+
processes.push(`"${chromeConfig.command}"`)
|
|
299
|
+
names.push(chromeConfig.name)
|
|
300
|
+
colors.push(chromeConfig.color)
|
|
305
301
|
}
|
|
306
302
|
|
|
307
303
|
// Build the final command
|
|
308
304
|
if (processes.length > 1) {
|
|
309
305
|
// Use concurrently to run multiple processes
|
|
310
306
|
command = `npx concurrently --names "${names.join(
|
|
311
|
-
","
|
|
312
|
-
)}" --prefix-colors "${colors.join(",")}" ${processes.join(" ")}
|
|
307
|
+
",",
|
|
308
|
+
)}" --prefix-colors "${colors.join(",")}" ${processes.join(" ")}`
|
|
313
309
|
} else {
|
|
314
310
|
// Just run Vite dev server alone
|
|
315
|
-
command = `npx vite dev --config "${normalizedViteConfigPath}"
|
|
311
|
+
command = `npx vite dev --config "${normalizedViteConfigPath}"`
|
|
316
312
|
}
|
|
317
313
|
|
|
318
|
-
shell.exec(command)
|
|
314
|
+
shell.exec(command)
|
|
319
315
|
}
|
|
320
316
|
|
|
321
317
|
module.exports = {
|
|
322
318
|
devCommand,
|
|
323
|
-
}
|
|
319
|
+
}
|