UNPKG

@onboardbase/cli

Version:

[![Version](https://img.shields.io/npm/v/@onboardbase/cli.svg)](https://www.npmjs.com/package/@onboardbase/cli) [![Downloads/week](https://img.shields.io/npm/dw/@onboardbase/cli.svg)](https://www.npmjs.com/package/@onboardbase/cli) [![License](https://img

61 lines (53 loc) 2.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const os_1 = require("os"); /** * Incase you're wondering why I'm passing a `HOME` environment variable? * * Here's why... * * Some unix OS like MacOS changes the `HOME` variable to /var/root once it's * being called from a LaunchDaemons/LaunchAgent plist file. * * This is because naturally, plist files have their own `HOME` directory/env which * is /var/root so nodejs `os.homedir()` basically depends on `process.env.HOME` meaning * once `process.env.HOME` is changed to another path, then `os.homedir()` just returns * that path be it the path that we need or not. * * Now to make sure we have access to the correct `HOME` directory where the `.onboardbase` * files are located, we need to manually override the `onboardbase.application.plist` file * and pass our own custom `HOME` path which is `os.homedir()` that is, the OS that compiled the CLI. */ function default_1(ONBOARDBASE_WORKING_DIRECTORY, ONBOARDBASE_SERVICE_FILE) { return `<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>onboardbase.application</string> <key>WorkingDirectory</key> <string>${ONBOARDBASE_WORKING_DIRECTORY}</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/node</string> <string>${ONBOARDBASE_SERVICE_FILE}</string> </array> <key>EnvironmentVariables</key> <dict> <key>HOME</key> <string>${(0, os_1.homedir)()}</string> </dict> <key>StartInterval</key> <integer>60</integer> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>StandardOutPath</key> <string>${(0, os_1.homedir)()}/.onboardbase/out.log</string> <key>StandardErrorPath</key> <string>${(0, os_1.homedir)()}/.onboardbase/error.log</string> </dict> </plist>`; } exports.default = default_1;