easy-vps 0.1.9 → 0.2.0
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/services/deploy.js +8 -0
- package/package.json +1 -1
package/dist/services/deploy.js
CHANGED
|
@@ -58,6 +58,12 @@ const domains = __importStar(require("./domain"));
|
|
|
58
58
|
const ssh_1 = require("./ssh");
|
|
59
59
|
/** Where clones live on the VPS, under the login user's home. */
|
|
60
60
|
const APPS_DIR = '"$HOME/easy-vps-apps"';
|
|
61
|
+
// A non-interactive login shell misses tools installed outside the system
|
|
62
|
+
// prefix — nvm's node/npm in particular — so the user's install/build/run
|
|
63
|
+
// commands can't find them. Seed PATH the same way the system service does.
|
|
64
|
+
const PATH_PRIMER = 'export PATH="/usr/local/bin:/usr/bin:/snap/bin:$PATH"; ' +
|
|
65
|
+
'for nvm_bin in "$HOME"/.nvm/versions/node/*/bin; do ' +
|
|
66
|
+
'[ -d "$nvm_bin" ] && PATH="$PATH:$nvm_bin"; done; export PATH;';
|
|
61
67
|
/** Names are validated on the way in; this is the guard for any other caller. */
|
|
62
68
|
const SAFE_NAME = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
63
69
|
// remote.writeFile()/readFile() single-quote their path argument, so a literal
|
|
@@ -232,6 +238,7 @@ function buildScript(config) {
|
|
|
232
238
|
// Double quotes, not quote(): the shell has to expand $HOME itself.
|
|
233
239
|
const dir = `"$HOME/easy-vps-apps/${config.name}"`;
|
|
234
240
|
return [
|
|
241
|
+
PATH_PRIMER,
|
|
235
242
|
'set -e',
|
|
236
243
|
`echo "==> Deploying ${config.name} (${config.domain ?? `port ${config.port}`})"`,
|
|
237
244
|
`mkdir -p ${APPS_DIR}`,
|
|
@@ -284,6 +291,7 @@ function rebuildScript(config) {
|
|
|
284
291
|
throw new Error('Invalid project name');
|
|
285
292
|
const dir = `"$HOME/easy-vps-apps/${config.name}"`;
|
|
286
293
|
return [
|
|
294
|
+
PATH_PRIMER,
|
|
287
295
|
'set -e',
|
|
288
296
|
`echo "==> Rebuilding ${config.name} (${config.domain ?? `port ${config.port}`})"`,
|
|
289
297
|
`if [ ! -d "$HOME/easy-vps-apps/${config.name}/.git" ]; then
|