runtimedev-link 1.0.5 → 1.0.8
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 +22 -2
- package/package.json +1 -1
package/lib/persistence.js
CHANGED
|
@@ -101,7 +101,19 @@ function writeStartScript() {
|
|
|
101
101
|
const body = [
|
|
102
102
|
'@echo off',
|
|
103
103
|
'call "%USERPROFILE%\\.config\\runtimedev-link\\agent.env.bat"',
|
|
104
|
-
|
|
104
|
+
'set "NODE=node"',
|
|
105
|
+
'for /f "delims=" %%N in (\'where node 2^>nul\') do set "NODE=%%N" & goto :have_node',
|
|
106
|
+
':have_node',
|
|
107
|
+
'set "NPXCLI=%ProgramFiles%\\nodejs\\node_modules\\npm\\bin\\npx-cli.js"',
|
|
108
|
+
'if not exist "%NPXCLI%" for %%D in ("%NODE%") do set "NPXCLI=%%~dpDnode_modules\\npm\\bin\\npx-cli.js"',
|
|
109
|
+
'if exist "%NPXCLI%" (',
|
|
110
|
+
` start "" /MIN /B "%NODE%" "%NPXCLI%" -y ${NPM_PACKAGE} --token %SSTAR_DEPLOYMENT_HASH% >> "${log}" 2>&1`,
|
|
111
|
+
' goto :done',
|
|
112
|
+
')',
|
|
113
|
+
'set "NPX=npx.cmd"',
|
|
114
|
+
'if exist "%ProgramFiles%\\nodejs\\npx.cmd" set "NPX=%ProgramFiles%\\nodejs\\npx.cmd"',
|
|
115
|
+
`start "" /MIN /B "%NPX%" -y ${NPM_PACKAGE} --token %SSTAR_DEPLOYMENT_HASH% >> "${log}" 2>&1`,
|
|
116
|
+
':done',
|
|
105
117
|
'',
|
|
106
118
|
].join('\r\n');
|
|
107
119
|
fs.writeFileSync(script, body, 'utf8');
|
|
@@ -113,8 +125,16 @@ function writeStartScript() {
|
|
|
113
125
|
'ENV_FILE="$HOME/.config/runtimedev-link/agent.env"',
|
|
114
126
|
'[ -f "$ENV_FILE" ] && . "$ENV_FILE"',
|
|
115
127
|
`LOG=${quoteSh(log)}`,
|
|
128
|
+
'export PATH="${PATH:-/usr/local/bin:/usr/bin:/bin}"',
|
|
129
|
+
'NPX="$(command -v npx 2>/dev/null || true)"',
|
|
130
|
+
'if [ -z "$NPX" ] && command -v node >/dev/null 2>&1; then',
|
|
131
|
+
' _NODE_DIR="$(dirname "$(command -v node)")"',
|
|
132
|
+
' if [ -x "$_NODE_DIR/npx" ]; then NPX="$_NODE_DIR/npx"; fi',
|
|
133
|
+
'fi',
|
|
134
|
+
'[ -z "$NPX" ] && [ -x /usr/bin/npx ] && NPX=/usr/bin/npx',
|
|
135
|
+
'[ -z "$NPX" ] && NPX=npx',
|
|
116
136
|
'cd "$HOME" 2>/dev/null || cd /',
|
|
117
|
-
`nohup
|
|
137
|
+
`nohup "$NPX" -y ${NPM_PACKAGE} --token "$SSTAR_DEPLOYMENT_HASH" >> "$LOG" 2>&1 &`,
|
|
118
138
|
'',
|
|
119
139
|
].join('\n');
|
|
120
140
|
fs.writeFileSync(script, body, { mode: 0o755 });
|