Skip to content

Commit a4b6b0a

Browse files
committed
refactor: Moved the broccoli-plugin for ember-app to it's own file.
1 parent 81d8853 commit a4b6b0a

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import mergeTrees = require("broccoli-merge-trees");
2+
import type { InputNode } from "broccoli-node-api";
3+
import Filter = require("broccoli-persistent-filter");
4+
import type { PluginOptions } from "broccoli-plugin/dist/interfaces";
5+
6+
export class CSSBlocksApplicationPlugin extends Filter {
7+
appName: string;
8+
constructor(appName: string, inputNodes: InputNode[], options?: PluginOptions) {
9+
super(mergeTrees(inputNodes), options || {});
10+
this.appName = appName;
11+
}
12+
processString(contents: string, _relativePath: string): string {
13+
return contents;
14+
}
15+
async build() {
16+
await super.build();
17+
console.log(`XXX ${this.appName}`);
18+
let entries = this.input.entries(".", {globs: ["**/*"]});
19+
for (let entry of entries) {
20+
console.log(entry.relativePath);
21+
}
22+
this.output.writeFileSync(
23+
`${this.appName}/services/-css-blocks-data.js`,
24+
`// CSS Blocks Generated Data. DO NOT EDIT.
25+
export const data = {className: "it-worked"};
26+
`);
27+
}
28+
}

Diff for: packages/@css-blocks/ember-app/src/index.ts

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
11
import funnel = require("broccoli-funnel");
2-
import mergeTrees = require("broccoli-merge-trees");
3-
import type { InputNode } from "broccoli-node-api";
4-
import Filter = require("broccoli-persistent-filter");
5-
import type { PluginOptions } from "broccoli-plugin/dist/interfaces";
62
import EmberApp from "ember-cli/lib/broccoli/ember-app";
73
import type Addon from "ember-cli/lib/models/addon";
84
import type { AddonImplementation, ThisAddon } from "ember-cli/lib/models/addon";
95
import Project from "ember-cli/lib/models/project";
106

11-
class CSSBlocksApplicationPlugin extends Filter {
12-
appName: string;
13-
constructor(appName: string, inputNodes: InputNode[], options?: PluginOptions) {
14-
super(mergeTrees(inputNodes), options || {});
15-
this.appName = appName;
16-
}
17-
processString(contents: string, _relativePath: string): string {
18-
return contents;
19-
}
20-
async build() {
21-
await super.build();
22-
// console.log(`XXX ${this.appName}`);
23-
// let entries = this.input.entries(".", {globs: ["**/*"]});
24-
// for (let entry of entries) {
25-
// console.log(entry.relativePath);
26-
// }
27-
this.output.writeFileSync(
28-
`${this.appName}/services/-css-blocks-data.js`,
29-
`// CSS Blocks Generated Data. DO NOT EDIT.
30-
export const data = {className: "it-worked"};
31-
`);
32-
}
33-
}
7+
import { CSSBlocksApplicationPlugin } from "./brocolli-plugin";
348

359
interface AddonEnvironment {
3610
parent: Addon | EmberApp;

0 commit comments

Comments
 (0)