@gxp-dev/tools 2.0.35 → 2.0.37

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 CHANGED
@@ -159,7 +159,7 @@ The platform emulator that wraps user plugins during development. It:
159
159
  gxdev init test-app
160
160
  cd test-app
161
161
 
162
- # Link to local devtools instead of npm version
162
+ # Link to local devtools instead of published version
163
163
  rm -rf node_modules/@gxp-dev/tools
164
164
  mkdir -p node_modules/@gramercytech
165
165
  ln -s /path/to/gx-devtools node_modules/@gxp-dev/tools
@@ -65,11 +65,6 @@ function copyTemplateFiles(projectPath, paths, overwrite = false) {
65
65
  dest: "theme-layouts/AdditionalStyling.css",
66
66
  desc: "AdditionalStyling.css",
67
67
  },
68
- {
69
- src: "src/stores/index.js",
70
- dest: "src/stores/index.js",
71
- desc: "Pinia store setup",
72
- },
73
68
  {
74
69
  src: "src/Plugin.vue",
75
70
  dest: "src/Plugin.vue",
@@ -80,6 +75,23 @@ function copyTemplateFiles(projectPath, paths, overwrite = false) {
80
75
  dest: "src/DemoPage.vue",
81
76
  desc: "DemoPage.vue (Example component)",
82
77
  },
78
+ ];
79
+
80
+ // Copy template files
81
+ filesToCopy.forEach((file) => {
82
+ const srcPath = path.join(paths.templateDir, file.src);
83
+ const destPath = path.join(projectPath, file.dest);
84
+ safeCopyFile(srcPath, destPath, file.desc, overwrite);
85
+ });
86
+ }
87
+
88
+ function copyBundleFiles(projectPath, paths, overwrite = false) {
89
+ const filesToCopy = [
90
+ {
91
+ src: "src/stores/index.js",
92
+ dest: "src/stores/index.js",
93
+ desc: "Pinia store setup",
94
+ },
83
95
  {
84
96
  src: "default-styling.css",
85
97
  dest: "default-styling.css",
@@ -137,7 +149,6 @@ function copyTemplateFiles(projectPath, paths, overwrite = false) {
137
149
  safeCopyFile(srcPath, destPath, file.desc, overwrite);
138
150
  });
139
151
  }
140
-
141
152
  /**
142
153
  * Copy extension scripts to project
143
154
  * @param {string} projectPath - Target project path
@@ -523,7 +534,10 @@ async function initCommand(argv) {
523
534
  const hasPackageJson = fs.existsSync(path.join(currentDir, "package.json"));
524
535
  let projectPath = currentDir;
525
536
  let projectName;
537
+
526
538
  const overwrite = argv.local && argv.yes;
539
+ // Copy template files
540
+ const paths = resolveGxPaths();
527
541
 
528
542
  // Handle --local flag: initialize in current directory
529
543
  if (argv.local) {
@@ -541,6 +555,7 @@ async function initCommand(argv) {
541
555
  if (hasPackageJson && !argv.name) {
542
556
  console.log("Updating existing project...");
543
557
  updateExistingProject(projectPath);
558
+ copyBundleFiles(projectPath, paths, false);
544
559
  console.log("✅ Project updated!");
545
560
  return;
546
561
  }
@@ -588,9 +603,9 @@ async function initCommand(argv) {
588
603
  console.log("⏭️ Skipping package.json (already exists)");
589
604
  }
590
605
 
591
- // Copy template files
592
- const paths = resolveGxPaths();
606
+
593
607
  copyTemplateFiles(projectPath, paths, overwrite);
608
+ copyBundleFiles(projectPath, paths, overwrite);
594
609
  copyExtensionScripts(projectPath, paths, overwrite);
595
610
  createSupportingFiles(projectPath);
596
611
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gxp-dev/tools",
3
- "version": "2.0.35",
3
+ "version": "2.0.37",
4
4
  "description": "Dev tools to create platform plugins",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -18,7 +18,9 @@
18
18
  "scripts"
19
19
  ],
20
20
  "scripts": {
21
- "test": "echo \"Error: no test specified\" && exit 1",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest",
23
+ "test:coverage": "vitest run --coverage",
22
24
  "dev": "concurrently 'vite dev' 'nodemon config/server.js'",
23
25
  "dev-app": "vite dev",
24
26
  "ext:firefox": "web-ext run --source-dir browser-extensions/firefox",
@@ -39,10 +41,11 @@
39
41
  "gxp-api-server": "mcp/gxp-api-server.js"
40
42
  },
41
43
  "keywords": [
42
- "tunnel",
43
- "gtcp",
44
- "eventfinity",
45
- "gxp"
44
+ "gxp",
45
+ "gxp-devtools",
46
+ "gramercy",
47
+ "devtools",
48
+ "plugin"
46
49
  ],
47
50
  "author": "Peek",
48
51
  "license": "ISC",
@@ -53,37 +56,40 @@
53
56
  "dependencies": {
54
57
  "@faker-js/faker": "^9.9.0",
55
58
  "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
56
- "@gramercytech/gx-componentkit": "^1.0.8",
57
- "@vitejs/plugin-vue": "^5.1.4",
59
+ "@gramercytech/gx-componentkit": "^1.0.23",
60
+ "@vitejs/plugin-vue": "^5.2.4",
58
61
  "archiver": "^7.0.1",
59
- "chrome-launcher": "^1.1.2",
60
- "concurrently": "^9.0.1",
61
- "cors": "^2.8.5",
62
- "dotenv": "^16.4.5",
63
- "express": "^4.21.0",
64
- "ink": "^5.0.1",
62
+ "chrome-launcher": "^1.2.1",
63
+ "concurrently": "^9.2.1",
64
+ "cors": "^2.8.6",
65
+ "dotenv": "^16.6.1",
66
+ "express": "^4.22.1",
67
+ "ink": "^5.2.1",
65
68
  "ink-text-input": "^6.0.0",
66
69
  "json-schema-faker": "^0.5.9",
67
70
  "mkcert": "^3.2.0",
68
- "nodemon": "^3.1.7",
69
- "open": "^10.0.0",
71
+ "nodemon": "^3.1.11",
72
+ "open": "^10.2.0",
70
73
  "pinia": "^3.0.4",
71
- "react": "^18.2.0",
72
- "rollup-plugin-external-globals": "^0.12.0",
74
+ "react": "^18.3.1",
75
+ "rollup-plugin-external-globals": "^0.12.1",
73
76
  "shelljs": "^0.8.5",
74
- "socket.io": "^4.8.0",
75
- "socket.io-client": "^4.8.0",
76
- "vite": "^5.4.8",
77
- "vue": "^3.5.8",
78
- "web-ext": "^8.2.0",
77
+ "socket.io": "^4.8.3",
78
+ "socket.io-client": "^4.8.3",
79
+ "vite": "^5.4.21",
80
+ "vue": "^3.5.27",
81
+ "web-ext": "^8.10.0",
79
82
  "yargs": "^17.7.2"
80
83
  },
81
84
  "devDependencies": {
82
- "@types/react": "^18.2.0",
85
+ "@types/react": "^18.3.28",
86
+ "@vitest/coverage-v8": "^2.1.9",
83
87
  "concurrently": "^9.0.1",
88
+ "memfs": "^4.56.10",
84
89
  "mkcert": "^3.2.0",
85
90
  "nodemon": "^3.1.7",
86
- "tsx": "^4.0.0",
87
- "typescript": "^5.0.0"
91
+ "tsx": "^4.21.0",
92
+ "typescript": "^5.9.3",
93
+ "vitest": "^2.1.9"
88
94
  }
89
95
  }
@@ -132,22 +132,24 @@ export default defineConfig(({ mode }) => {
132
132
  const toolkitPath = findToolkitPath();
133
133
  const runtimeDir = path.resolve(toolkitPath, "runtime");
134
134
 
135
- // Check for local dev files
135
+ // Check for local dev files (requires both env var AND file to exist)
136
136
  const hasLocalIndexHtml = hasLocalFile("index.html");
137
137
  const hasLocalMainJs = hasLocalFile("main.js");
138
+ const useLocalIndex = env.USE_LOCAL_INDEX === "true" && hasLocalIndexHtml;
139
+ const useLocalMain = env.USE_LOCAL_MAIN === "true" && hasLocalMainJs;
138
140
 
139
141
  // Log which files are being used
140
- console.log(`📄 index.html: ${hasLocalIndexHtml ? "local" : "runtime"}`);
141
- console.log(`📄 main.js: ${hasLocalMainJs ? "local" : "runtime"}`);
142
+ console.log(`📄 index.html: ${useLocalIndex ? "local" : "runtime"}`);
143
+ console.log(`📄 main.js: ${useLocalMain ? "local" : "runtime"}`);
142
144
 
143
145
  // Create plugin to serve runtime files (index.html and main.js) if no local ones exist
144
146
  const runtimeFilesPlugin = {
145
147
  name: "runtime-files",
146
148
  configureServer(server) {
147
149
  server.middlewares.use((req, res, next) => {
148
- // Serve runtime index.html for root requests (if no local index.html)
150
+ // Serve runtime index.html for root requests (unless local index.html is opted in)
149
151
  if (
150
- !hasLocalIndexHtml &&
152
+ !useLocalIndex &&
151
153
  (req.url === "/" || req.url === "/index.html")
152
154
  ) {
153
155
  const runtimeIndexPath = path.join(runtimeDir, "index.html");
@@ -170,9 +172,9 @@ export default defineConfig(({ mode }) => {
170
172
  }
171
173
  }
172
174
 
173
- // Serve runtime main.js for @gx-runtime/main.js requests (if no local main.js)
175
+ // Serve runtime main.js for @gx-runtime/main.js requests (unless local main.js is opted in)
174
176
  if (
175
- !hasLocalMainJs &&
177
+ !useLocalMain &&
176
178
  (req.url === "/@gx-runtime/main.js" ||
177
179
  req.url?.startsWith("/@gx-runtime/main.js?"))
178
180
  ) {
@@ -28,7 +28,6 @@ SOCKET_IO_PORT=3061
28
28
 
29
29
  # Logging configuration
30
30
  NODE_LOG_LEVEL=info
31
- TUNNEL_LOG_LEVEL=error
32
31
 
33
32
  # Component configuration
34
33
  COMPONENT_PATH=./src/Plugin.vue
@@ -42,6 +41,12 @@ KEY_PATH=.certs/localhost-key.pem
42
41
  NODE_DEBUG=false
43
42
  SOCKET_IO_ENABLED=true
44
43
 
44
+ # Local file overrides
45
+ # By default, index.html and main.js are served from the toolkit runtime.
46
+ # Set these to true to use local copies instead (files must exist in project root).
47
+ #USE_LOCAL_INDEX=true
48
+ #USE_LOCAL_MAIN=true
49
+
45
50
  # Mock API Configuration
46
51
  # Enable to generate mock API responses from OpenAPI/AsyncAPI specs
47
52
  MOCK_API_ENABLED=false
@@ -41,7 +41,6 @@ logs/
41
41
  npm-debug.log*
42
42
  yarn-debug.log*
43
43
  yarn-error.log*
44
- pnpm-debug.log*
45
44
 
46
45
  # Testing
47
46
  coverage/