Skip to content

Commit 57b8137

Browse files
committedSep 25, 2018
fix(broccoli): Modification of the output does not throw on rebuild.
1 parent ff3d758 commit 57b8137

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

Diff for: ‎packages/@css-blocks/broccoli/src/Analyze.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ export class CSSBlocksAnalyze extends BroccoliPlugin {
7575
let newFsTree = FSTree.fromEntries(walkSync.entries(input));
7676
let diff = this.previousInput.calculatePatch(newFsTree);
7777
if (!diff.length) { return; }
78+
79+
// Save the current state of our output dir for future diffs.
80+
this.previousOutput = FSTree.fromEntries(walkSync.entries(output));
7881
FSTree.applyPatch(input, output, this.previousOutput.calculatePatch(newFsTree));
7982
this.previousInput = newFsTree;
8083

@@ -122,9 +125,6 @@ export class CSSBlocksAnalyze extends BroccoliPlugin {
122125
}
123126
}
124127

125-
// Save the current state of our output dir for future diffs.
126-
this.previousOutput = FSTree.fromEntries(walkSync.entries(output));
127-
128128
// Add each Analysis to the Optimizer.
129129
this.analyzer.eachAnalysis((a) => optimizer.addAnalysis(a.forOptimizer(options)));
130130

Diff for: ‎packages/@css-blocks/broccoli/test/Analyze.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as assert from "assert";
2+
import * as fs from "fs";
23

34
import { GlimmerAnalyzer } from "@css-blocks/glimmer";
45

@@ -80,6 +81,8 @@ describe("Broccoli Analyze Plugin Test", function () {
8081
});
8182

8283
// Modifications to block files trigger build but result in no output tree changes.
84+
// Accidental modification of output directory does not make the plugin explode.
85+
fs.unlinkSync(output.path("src/ui/components/Chrisrng/template.hbs"));
8386
input.write({
8487
src: { ui: { components: { [entryComponentName]: {
8588
"stylesheet.css": `:scope { color: blue; } .foo { color: yellow; }`,

0 commit comments

Comments
 (0)
Please sign in to comment.