INNER CODE UNIT · TypeScript

onAddOrChange

hypermodeinc/modus · cli/src/commands/dev/index.ts:207

    const onAddOrChange = async (sourcePath: string) => {
      const filename = path.basename(sourcePath);
      const outputPath = path.join(appPath, "build", filename);
      try {
        runtimeOutput.pause();
        this.log();
        this.log(chalk.magentaBright(`Detected change in ${filename} file. Applying...`));
        await fs.copyFile(sourcePath, outputPath);
      } catch (e) {
        this.log(chalk.red(`Failed to copy ${filename} to build directory.`), e);
      } finally {
        this.log();
        runtimeOutput.resume();
      }
    };

    chokidar
      .watch(appPath, {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…