projax 1.3.2 → 1.3.4

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -102,11 +102,27 @@ async function checkAPIStatus() {
102
102
  }
103
103
  return { running: false, port: null };
104
104
  }
105
+ function resolveApiEntry() {
106
+ const candidates = [
107
+ // Packaged CLI (dist/api/index.js)
108
+ path.join(__dirname, 'api', 'index.js'),
109
+ // Development builds inside workspace
110
+ path.join(__dirname, '..', 'api', 'dist', 'index.js'),
111
+ path.join(__dirname, '..', '..', 'api', 'dist', 'index.js'),
112
+ path.join(__dirname, '..', '..', '..', 'api', 'dist', 'index.js'),
113
+ ];
114
+ for (const candidate of candidates) {
115
+ if (fs.existsSync(candidate)) {
116
+ return candidate;
117
+ }
118
+ }
119
+ return null;
120
+ }
105
121
  // Function to start the API server
106
122
  async function startAPIServer(silent = false) {
107
123
  const { spawn } = require('child_process');
108
- const apiPath = path.join(__dirname, '..', '..', 'api', 'dist', 'index.js');
109
- if (!fs.existsSync(apiPath)) {
124
+ const apiPath = resolveApiEntry();
125
+ if (!apiPath) {
110
126
  if (!silent) {
111
127
  console.error('Error: API server not found. Please build it first: npm run build --workspace=packages/api');
112
128
  }
@@ -728,17 +744,30 @@ program
728
744
  await ensureAPIServerRunning(false);
729
745
  // Check for bundled Desktop app first (in dist/desktop when installed globally)
730
746
  // Then check for local development (packages/cli/dist -> packages/desktop)
731
- const bundledDesktopPath = path.join(__dirname, 'desktop');
732
- const bundledDesktopMain = path.join(bundledDesktopPath, 'main.js');
747
+ // Support both legacy "desktop" folder and current "electron" bundle folder
748
+ const bundledDesktopPathCandidates = [
749
+ path.join(__dirname, 'desktop'),
750
+ path.join(__dirname, 'electron'),
751
+ ];
752
+ let bundledDesktopPath = null;
753
+ let bundledDesktopMain = null;
754
+ for (const candidate of bundledDesktopPathCandidates) {
755
+ const mainCandidate = path.join(candidate, 'main.js');
756
+ if (fs.existsSync(mainCandidate)) {
757
+ bundledDesktopPath = candidate;
758
+ bundledDesktopMain = mainCandidate;
759
+ break;
760
+ }
761
+ }
733
762
  const localDesktopPath = path.join(__dirname, '..', '..', 'desktop');
734
763
  const localDesktopMain = path.join(localDesktopPath, 'dist', 'main.js');
735
764
  // Check if bundled desktop exists (global install)
736
- const hasBundledDesktop = fs.existsSync(bundledDesktopMain);
765
+ const hasBundledDesktop = Boolean(bundledDesktopPath && bundledDesktopMain);
737
766
  // Check if local desktop exists (development mode)
738
767
  const isLocalDev = fs.existsSync(localDesktopPath) && fs.existsSync(path.join(localDesktopPath, 'package.json'));
739
768
  let desktopPackagePath;
740
769
  let desktopMainPath;
741
- if (hasBundledDesktop) {
770
+ if (bundledDesktopPath && bundledDesktopMain) {
742
771
  // Bundled Desktop app (global install)
743
772
  desktopPackagePath = bundledDesktopPath;
744
773
  desktopMainPath = bundledDesktopMain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projax",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "CLI tool for managing local development projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {