INNER CODE UNIT · JavaScript

commandFilePath

sebastiancarlos/beachpatrol · beachpatrol.js:207

    const commandFilePath = commandCandidates.find((candidate) =>
      fs.existsSync(candidate),
    );

    // Check if command script exists.
    if (!commandFilePath) {
      writeError(`Command script ${commandName} does not exist.`);
    } else {
      // Import and run the command
      try {
        // import with a timestamp to avoid caching
        const moduleURL = pathToFileURL(commandFilePath).href;
        const { default: command } = await import(
          `${moduleURL}?t=${Date.now()}`
        );

        // Run command, passing `{ context, activePage }` as first argument.
        // A generator command streams its yielded values to the client, and 

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…