-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Rebuild JS app when files change in discourse-markdown-it (#24379)
Based on a workaround shared in embroider-build/embroider#1635 (comment)
- Loading branch information
1 parent
0c712ea
commit 8c16482
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// From https://github.com/cardstack/boxel/blob/d54f834f/packages/host/lib/with-side-watch.js (MIT license) | ||
|
||
const mergeTrees = require("broccoli-merge-trees"); | ||
const { WatchedDir } = require("broccoli-source"); | ||
const Plugin = require("broccoli-plugin"); | ||
|
||
class BroccoliNoOp extends Plugin { | ||
constructor(path) { | ||
super([new WatchedDir(path)]); | ||
} | ||
build() {} | ||
} | ||
|
||
/* | ||
Doesn't change your actualTree, but causes a rebuild when any of opts.watching | ||
trees change. | ||
This is helpful when your build pipeline doesn't naturally watch some | ||
dependencies that you're actively developing. For example, right now | ||
@embroider/webpack doesn't rebuild itself when non-ember libraries change. | ||
*/ | ||
module.exports = function withSideWatch(actualTree, opts) { | ||
return mergeTrees([ | ||
actualTree, | ||
...opts.watching.map((w) => new BroccoliNoOp(w)), | ||
]); | ||
}; |