projax 3.3.15 ā 3.3.16
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/dist/index.js +216 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39,11 +39,221 @@ const path = __importStar(require("path"));
|
|
|
39
39
|
const fs = __importStar(require("fs"));
|
|
40
40
|
const os = __importStar(require("os"));
|
|
41
41
|
const http = __importStar(require("http"));
|
|
42
|
+
const child_process_1 = require("child_process");
|
|
42
43
|
const core_bridge_1 = require("./core-bridge");
|
|
43
44
|
const script_runner_1 = require("./script-runner");
|
|
44
45
|
const port_scanner_1 = require("./port-scanner");
|
|
45
46
|
// Read version from package.json
|
|
46
47
|
const packageJson = require('../package.json');
|
|
48
|
+
// Function to create application launcher alias
|
|
49
|
+
async function handleAddApplicationAlias() {
|
|
50
|
+
const platform = os.platform();
|
|
51
|
+
try {
|
|
52
|
+
switch (platform) {
|
|
53
|
+
case 'darwin': // macOS
|
|
54
|
+
await createMacOSAppAlias();
|
|
55
|
+
break;
|
|
56
|
+
case 'linux':
|
|
57
|
+
await createLinuxAppAlias();
|
|
58
|
+
break;
|
|
59
|
+
case 'win32': // Windows
|
|
60
|
+
await createWindowsAppAlias();
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('Error creating application alias:', error instanceof Error ? error.message : error);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Create macOS application alias
|
|
73
|
+
async function createMacOSAppAlias() {
|
|
74
|
+
const appName = 'Projax';
|
|
75
|
+
const appPath = `/Applications/${appName}.app`;
|
|
76
|
+
// Get the path to the prx command
|
|
77
|
+
let prxPath;
|
|
78
|
+
try {
|
|
79
|
+
prxPath = (0, child_process_1.execSync)('which prx', { encoding: 'utf-8' }).trim();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('Error: prx command not found. Please ensure projax is installed globally.');
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
if (!prxPath) {
|
|
86
|
+
console.error('Error: prx command not found. Please ensure projax is installed globally.');
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
// Create .app bundle structure
|
|
90
|
+
const contentsDir = path.join(appPath, 'Contents');
|
|
91
|
+
const macOSDir = path.join(contentsDir, 'MacOS');
|
|
92
|
+
const resourcesDir = path.join(contentsDir, 'Resources');
|
|
93
|
+
console.log(`\nš¦ Creating ${appName}.app in /Applications...`);
|
|
94
|
+
// Create directories
|
|
95
|
+
fs.mkdirSync(macOSDir, { recursive: true });
|
|
96
|
+
fs.mkdirSync(resourcesDir, { recursive: true });
|
|
97
|
+
// Create Info.plist
|
|
98
|
+
const infoPlist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
99
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
100
|
+
<plist version="1.0">
|
|
101
|
+
<dict>
|
|
102
|
+
<key>CFBundleExecutable</key>
|
|
103
|
+
<string>projax-launcher</string>
|
|
104
|
+
<key>CFBundleIdentifier</key>
|
|
105
|
+
<string>dev.projax.app</string>
|
|
106
|
+
<key>CFBundleName</key>
|
|
107
|
+
<string>${appName}</string>
|
|
108
|
+
<key>CFBundleDisplayName</key>
|
|
109
|
+
<string>${appName}</string>
|
|
110
|
+
<key>CFBundleVersion</key>
|
|
111
|
+
<string>1.0.0</string>
|
|
112
|
+
<key>CFBundlePackageType</key>
|
|
113
|
+
<string>APPL</string>
|
|
114
|
+
<key>CFBundleSignature</key>
|
|
115
|
+
<string>????</string>
|
|
116
|
+
<key>LSMinimumSystemVersion</key>
|
|
117
|
+
<string>10.13</string>
|
|
118
|
+
<key>NSHighResolutionCapable</key>
|
|
119
|
+
<true/>
|
|
120
|
+
</dict>
|
|
121
|
+
</plist>`;
|
|
122
|
+
fs.writeFileSync(path.join(contentsDir, 'Info.plist'), infoPlist);
|
|
123
|
+
// Create launcher script
|
|
124
|
+
const launcherScript = `#!/bin/bash
|
|
125
|
+
# Projax Application Launcher
|
|
126
|
+
# This launches the Projax UI
|
|
127
|
+
|
|
128
|
+
# Ensure we have the right PATH
|
|
129
|
+
export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/.nvm/versions/node/$(ls -1 $HOME/.nvm/versions/node | tail -1)/bin:$PATH"
|
|
130
|
+
|
|
131
|
+
# Find prx command
|
|
132
|
+
PRX_CMD="${prxPath}"
|
|
133
|
+
|
|
134
|
+
# If not found, try to find it in common locations
|
|
135
|
+
if [ ! -x "$PRX_CMD" ]; then
|
|
136
|
+
for dir in /usr/local/bin /opt/homebrew/bin $HOME/.nvm/versions/node/*/bin; do
|
|
137
|
+
if [ -x "$dir/prx" ]; then
|
|
138
|
+
PRX_CMD="$dir/prx"
|
|
139
|
+
break
|
|
140
|
+
fi
|
|
141
|
+
done
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
# Launch Projax UI
|
|
145
|
+
if [ -x "$PRX_CMD" ]; then
|
|
146
|
+
"$PRX_CMD" ui 2>&1 | logger -t Projax &
|
|
147
|
+
else
|
|
148
|
+
osascript -e 'display alert "Projax Error" message "Could not find prx command. Please ensure projax is installed: npm install -g projax"'
|
|
149
|
+
fi
|
|
150
|
+
`;
|
|
151
|
+
const launcherPath = path.join(macOSDir, 'projax-launcher');
|
|
152
|
+
fs.writeFileSync(launcherPath, launcherScript);
|
|
153
|
+
fs.chmodSync(launcherPath, 0o755);
|
|
154
|
+
console.log(`ā Created ${appName}.app`);
|
|
155
|
+
console.log(`ā Application launcher installed at: ${appPath}`);
|
|
156
|
+
console.log(`\nš You can now launch Projax from:`);
|
|
157
|
+
console.log(` - Spotlight (Cmd+Space, type "${appName}")`);
|
|
158
|
+
console.log(` - Launchpad`);
|
|
159
|
+
console.log(` - Applications folder`);
|
|
160
|
+
console.log(`\nš” Tip: You can also drag ${appName}.app to your Dock for quick access!`);
|
|
161
|
+
}
|
|
162
|
+
// Create Linux application alias
|
|
163
|
+
async function createLinuxAppAlias() {
|
|
164
|
+
const appName = 'Projax';
|
|
165
|
+
const desktopFile = path.join(os.homedir(), '.local', 'share', 'applications', 'projax.desktop');
|
|
166
|
+
// Get the path to the prx command
|
|
167
|
+
let prxPath;
|
|
168
|
+
try {
|
|
169
|
+
prxPath = (0, child_process_1.execSync)('which prx', { encoding: 'utf-8' }).trim();
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error('Error: prx command not found. Please ensure projax is installed globally.');
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
console.log(`\nš¦ Creating ${appName} desktop entry...`);
|
|
176
|
+
// Ensure directory exists
|
|
177
|
+
const applicationsDir = path.dirname(desktopFile);
|
|
178
|
+
fs.mkdirSync(applicationsDir, { recursive: true });
|
|
179
|
+
// Create .desktop file
|
|
180
|
+
const desktopContent = `[Desktop Entry]
|
|
181
|
+
Version=1.0
|
|
182
|
+
Type=Application
|
|
183
|
+
Name=${appName}
|
|
184
|
+
Comment=Project Management Dashboard
|
|
185
|
+
Exec=${prxPath} ui
|
|
186
|
+
Terminal=false
|
|
187
|
+
Categories=Development;Utility;
|
|
188
|
+
Keywords=project;dashboard;dev;
|
|
189
|
+
StartupNotify=true
|
|
190
|
+
`;
|
|
191
|
+
fs.writeFileSync(desktopFile, desktopContent);
|
|
192
|
+
fs.chmodSync(desktopFile, 0o755);
|
|
193
|
+
// Update desktop database
|
|
194
|
+
try {
|
|
195
|
+
(0, child_process_1.execSync)('update-desktop-database ~/.local/share/applications', { stdio: 'ignore' });
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
// Ignore errors - not all systems have this command
|
|
199
|
+
}
|
|
200
|
+
console.log(`ā Created desktop entry: ${desktopFile}`);
|
|
201
|
+
console.log(`\nš You can now launch Projax from:`);
|
|
202
|
+
console.log(` - Application menu`);
|
|
203
|
+
console.log(` - Application launcher (search for "${appName}")`);
|
|
204
|
+
console.log(`\nš” Tip: You may need to log out and back in for the entry to appear.`);
|
|
205
|
+
}
|
|
206
|
+
// Create Windows application alias
|
|
207
|
+
async function createWindowsAppAlias() {
|
|
208
|
+
const appName = 'Projax';
|
|
209
|
+
const startMenuPath = path.join(process.env.APPDATA || '', 'Microsoft', 'Windows', 'Start Menu', 'Programs');
|
|
210
|
+
// Get the path to the prx command
|
|
211
|
+
let prxPath;
|
|
212
|
+
try {
|
|
213
|
+
prxPath = (0, child_process_1.execSync)('where prx', { encoding: 'utf-8' }).trim().split('\n')[0];
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.error('Error: prx command not found. Please ensure projax is installed globally.');
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
219
|
+
console.log(`\nš¦ Creating ${appName} Start Menu shortcut...`);
|
|
220
|
+
// Create a batch file to launch Projax
|
|
221
|
+
const batchFile = path.join(startMenuPath, 'Projax.bat');
|
|
222
|
+
const batchContent = `@echo off
|
|
223
|
+
"${prxPath}" ui
|
|
224
|
+
`;
|
|
225
|
+
fs.writeFileSync(batchFile, batchContent);
|
|
226
|
+
// Try to create a VBScript to create a proper shortcut
|
|
227
|
+
const vbsScript = `
|
|
228
|
+
Set oWS = WScript.CreateObject("WScript.Shell")
|
|
229
|
+
sLinkFile = "${path.join(startMenuPath, 'Projax.lnk').replace(/\\/g, '\\\\')}"
|
|
230
|
+
Set oLink = oWS.CreateShortcut(sLinkFile)
|
|
231
|
+
oLink.TargetPath = "cmd.exe"
|
|
232
|
+
oLink.Arguments = "/c \\"${prxPath.replace(/\\/g, '\\\\')}\\" ui"
|
|
233
|
+
oLink.WorkingDirectory = "${os.homedir().replace(/\\/g, '\\\\')}"
|
|
234
|
+
oLink.Description = "Projax - Project Management Dashboard"
|
|
235
|
+
oLink.WindowStyle = 7
|
|
236
|
+
oLink.Save
|
|
237
|
+
`;
|
|
238
|
+
const vbsFile = path.join(os.tmpdir(), 'create-projax-shortcut.vbs');
|
|
239
|
+
fs.writeFileSync(vbsFile, vbsScript);
|
|
240
|
+
try {
|
|
241
|
+
(0, child_process_1.execSync)(`cscript //nologo "${vbsFile}"`, { stdio: 'ignore' });
|
|
242
|
+
fs.unlinkSync(vbsFile);
|
|
243
|
+
fs.unlinkSync(batchFile);
|
|
244
|
+
console.log(`ā Created Start Menu shortcut`);
|
|
245
|
+
console.log(`\nš You can now launch Projax from:`);
|
|
246
|
+
console.log(` - Start Menu (search for "${appName}")`);
|
|
247
|
+
console.log(` - Taskbar (pin the shortcut)`);
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
// Fallback: just use the batch file
|
|
251
|
+
console.log(`ā Created Start Menu batch file: ${batchFile}`);
|
|
252
|
+
console.log(`\nš You can now launch Projax from:`);
|
|
253
|
+
console.log(` - Start Menu (search for "${appName}")`);
|
|
254
|
+
console.log(`\nā ļø Note: Could not create a proper shortcut. Using batch file instead.`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
47
257
|
// Function to check API status
|
|
48
258
|
async function checkAPIStatus() {
|
|
49
259
|
const dataDir = path.join(require('os').homedir(), '.projax');
|
|
@@ -1209,7 +1419,13 @@ program
|
|
|
1209
1419
|
.alias('ui')
|
|
1210
1420
|
.description('Start the UI web interface')
|
|
1211
1421
|
.option('--dev', 'Start in development mode (with hot reload)')
|
|
1422
|
+
.option('--add-application-alias', 'Create application launcher in Applications folder')
|
|
1212
1423
|
.action(async (options) => {
|
|
1424
|
+
// Handle add-application-alias option
|
|
1425
|
+
if (options.addApplicationAlias) {
|
|
1426
|
+
await handleAddApplicationAlias();
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1213
1429
|
try {
|
|
1214
1430
|
// Clear Electron cache to prevent stale module issues
|
|
1215
1431
|
if (os.platform() === 'darwin') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projax",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.16",
|
|
4
4
|
"description": "Cross-platform project management dashboard for tracking local development projects. Features CLI, Terminal UI, Desktop app, REST API, and built-in tools for test detection, port management, and script execution.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|