Skip to content

Commit

Permalink
chore(dev-utils): Update watch command for new sass modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Dec 31, 2021
1 parent 3521e9b commit 2e7a87a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/dev-utils/src/watch.ts
@@ -1,12 +1,11 @@
import { ChildProcess, spawn } from "child_process";
import chokidar from "chokidar";
import { copyFileSync } from "fs";
import log from "loglevel";
import { sep } from "path";
import { sys } from "typescript";

import { dist, src } from "./constants";
import { getPackages, list } from "./utils";
import { everythingScss, packagesRoot, src } from "./constants";
import { combineAllFiles, getPackages, list } from "./utils";

/**
* Creates a custom dev watcher for copying styles into dists correctly
Expand All @@ -28,7 +27,6 @@ export function watch(cjs: boolean): void {
const name =
packageName === "react-md" ? packageName : `@react-md/${packageName}`;
const { newLine } = sys;
const dest = pathname.replace(src, dist);

let output = "";
if (sys.clearScreen) {
Expand All @@ -41,12 +39,11 @@ export function watch(cjs: boolean): void {
output = `[${name} - ${new Date().toLocaleTimeString()}] `;
output += `Detected scss file change${newLine}`;
output += `${pathname.replace(prefix, "")} -> `;
output += `${dest.replace(prefix, "")}`;
output += `${everythingScss.replace(packagesRoot, "")}`;
output += newLine + newLine;
sys.write(output);

// I don't care about the non-webpack imports for this
copyFileSync(pathname, dest);
combineAllFiles();
});
watcher.on("ready", () => {
log.info("Started the watcher in the following packages:");
Expand Down

0 comments on commit 2e7a87a

Please sign in to comment.