NoneLauncher.js
734 Bytes
/**
* NoneLauncher — 不管理生命周期(连接已部署的服务)
*
* start() 直接返回 { url },不启动任何进程
* stop() no-op
*/
const { Launcher } = require('./Launcher');
class NoneLauncher extends Launcher {
/**
* @param {object} options
* @param {string} options.url - 已部署服务的 WebSocket 地址
* @returns {Promise<{ url: string }>}
*/
async start(options = {}) {
if (!options.url) {
throw new Error('[NoneLauncher] url 是必需配置项');
}
console.log(`[NoneLauncher] 连接已部署的服务: ${options.url}`);
return { url: options.url };
}
async stop() {
// 不管理外部服务的生命周期
}
}
module.exports = { NoneLauncher };