INNER CODE UNIT · JavaScript

commandFiles

sebastiancarlos/beachpatrol · beachmsg.js:237

const commandFiles = [USER_COMMANDS_DIR, PROJECT_COMMANDS_DIR].flatMap((dir) =>
  [".js", ".ts"].map((extension) =>
    path.join(dir, `${commandName}${extension}`),
  ),
);
if (!commandFiles.some(fs.existsSync)) {
  console.error(`Error: Command script ${commandName} does not exist.`);
  process.exit(1);
}

// Send command and args, streaming lines to stdout as they arrive (so
// generator commands show progress), and report the outcome.
const socketName = `${browser}-${profileName}${incognito ? "-incognito" : ""}`;
const endpoint = instanceEndpoint(socketName);
try {
  for await (const line of sendCommand(endpoint, [commandName, ...args])) {
    process.stdout.write(`${line}\n`);
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…