runtimedev-link 1.0.5 → 1.0.6
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/lib/persistence.js +14 -2
- package/package.json +1 -1
package/lib/persistence.js
CHANGED
|
@@ -101,7 +101,11 @@ function writeStartScript() {
|
|
|
101
101
|
const body = [
|
|
102
102
|
'@echo off',
|
|
103
103
|
'call "%USERPROFILE%\\.config\\runtimedev-link\\agent.env.bat"',
|
|
104
|
-
|
|
104
|
+
'set "NPX=npx"',
|
|
105
|
+
'for /f "delims=" %%P in (\'where npx 2^>nul\') do (set "NPX=%%P" & goto :launch)',
|
|
106
|
+
'if exist "%ProgramFiles%\\nodejs\\npx.cmd" set "NPX=%ProgramFiles%\\nodejs\\npx.cmd"',
|
|
107
|
+
':launch',
|
|
108
|
+
`start /B "%NPX%" ${NPM_PACKAGE} --token %SSTAR_DEPLOYMENT_HASH% >> "${log}" 2>&1`,
|
|
105
109
|
'',
|
|
106
110
|
].join('\r\n');
|
|
107
111
|
fs.writeFileSync(script, body, 'utf8');
|
|
@@ -113,8 +117,16 @@ function writeStartScript() {
|
|
|
113
117
|
'ENV_FILE="$HOME/.config/runtimedev-link/agent.env"',
|
|
114
118
|
'[ -f "$ENV_FILE" ] && . "$ENV_FILE"',
|
|
115
119
|
`LOG=${quoteSh(log)}`,
|
|
120
|
+
'export PATH="${PATH:-/usr/local/bin:/usr/bin:/bin}"',
|
|
121
|
+
'NPX="$(command -v npx 2>/dev/null || true)"',
|
|
122
|
+
'if [ -z "$NPX" ] && command -v node >/dev/null 2>&1; then',
|
|
123
|
+
' _NODE_DIR="$(dirname "$(command -v node)")"',
|
|
124
|
+
' if [ -x "$_NODE_DIR/npx" ]; then NPX="$_NODE_DIR/npx"; fi',
|
|
125
|
+
'fi',
|
|
126
|
+
'[ -z "$NPX" ] && [ -x /usr/bin/npx ] && NPX=/usr/bin/npx',
|
|
127
|
+
'[ -z "$NPX" ] && NPX=npx',
|
|
116
128
|
'cd "$HOME" 2>/dev/null || cd /',
|
|
117
|
-
`nohup
|
|
129
|
+
`nohup "$NPX" ${NPM_PACKAGE} --token "$SSTAR_DEPLOYMENT_HASH" >> "$LOG" 2>&1 &`,
|
|
118
130
|
'',
|
|
119
131
|
].join('\n');
|
|
120
132
|
fs.writeFileSync(script, body, { mode: 0o755 });
|