Skip to content

Commit 136acee

Browse files
committed
Adjust to the new API of core
1 parent 9cd2269 commit 136acee

File tree

13 files changed

+50
-29
lines changed

13 files changed

+50
-29
lines changed

index.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,12 @@ let FileFinder = require("faucet-pipeline-core/lib/util/files/finder");
55
let readFile = promisify(require("fs").readFile);
66
let stat = promisify(require("fs").stat);
77

8-
module.exports = (pluginConfig, assetManager, { watcher }) => {
9-
let copyAll = buildCopyAll(pluginConfig, assetManager);
10-
11-
// Run once for all files
12-
copyAll();
13-
14-
if(watcher) {
15-
watcher.on("edit", copyAll);
16-
}
17-
};
18-
19-
function buildCopyAll(copyConfigs, assetManager) {
20-
let copiers = copyConfigs.map(copyConfig =>
8+
module.exports = (pluginConfig, assetManager) => {
9+
let copiers = pluginConfig.map(copyConfig =>
2110
buildCopier(copyConfig, assetManager));
2211

23-
return files => copiers.forEach(copier => copier(files));
24-
}
12+
return files => Promise.all(copiers.map(copier => copier(files)));
13+
};
2514

2615
function buildCopier(copyConfig, assetManager) {
2716
let source = assetManager.resolvePath(copyConfig.source);
@@ -32,11 +21,10 @@ function buildCopier(copyConfig, assetManager) {
3221
skipDotfiles: true,
3322
filter: copyConfig.filter
3423
});
35-
3624
let { fingerprint } = copyConfig;
3725

3826
return files => {
39-
Promise.all([
27+
return Promise.all([
4028
(files ? fileFinder.match(files) : fileFinder.all()),
4129
determineTargetDir(source, target)
4230
]).then(([fileNames, targetDir]) => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"homepage": "http://www.faucet-pipeline.org",
2121
"dependencies": {
22-
"faucet-pipeline-core": "~1.0.0-rc.10"
22+
"faucet-pipeline-core": "^1.0.0-rc.11"
2323
},
2424
"devDependencies": {
2525
"eslint-config-fnd": "^1.6.0",

test/test_basic/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ module.exports = {
77
target: "./dist"
88
}],
99
plugins: {
10-
"static": path.resolve("../..")
10+
"static": {
11+
plugin: path.resolve("../.."),
12+
bucket: "static"
13+
}
1114
}
1215
};

test/test_fingerprint/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
target: "./dist/manifest.json"
1111
},
1212
plugins: {
13-
"static": path.resolve("../..")
13+
"static": {
14+
plugin: path.resolve("../.."),
15+
bucket: "static"
16+
}
1417
}
1518
};

test/test_key_config/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ module.exports = {
1111
key: (f, targetDir) => path.relative(targetDir, f)
1212
},
1313
plugins: {
14-
"static": path.resolve("../..")
14+
"static": {
15+
plugin: path.resolve("../.."),
16+
bucket: "static"
17+
}
1518
}
1619
};

test/test_key_for_single_file/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ module.exports = {
1111
key: (f, targetDir) => path.relative(targetDir, f)
1212
},
1313
plugins: {
14-
"static": path.resolve("../..")
14+
"static": {
15+
plugin: path.resolve("../.."),
16+
bucket: "static"
17+
}
1518
}
1619
};

test/test_manifest_base_uri/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ module.exports = {
1111
value: f => `/assets/${path.relative("./dist", f)}`
1212
},
1313
plugins: {
14-
"static": path.resolve("../..")
14+
"static": {
15+
plugin: path.resolve("../.."),
16+
bucket: "static"
17+
}
1518
}
1619
};

test/test_match_dirname/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ module.exports = {
88
filter: path => path.startsWith("inner/")
99
}],
1010
plugins: {
11-
"static": path.resolve("../..")
11+
"static": {
12+
plugin: path.resolve("../.."),
13+
bucket: "static"
14+
}
1215
}
1316
};

test/test_match_extension/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ module.exports = {
88
filter: path => path.endsWith(".txt")
99
}],
1010
plugins: {
11-
"static": path.resolve("../..")
11+
"static": {
12+
plugin: path.resolve("../.."),
13+
bucket: "static"
14+
}
1215
}
1316
};

test/test_match_multiple/faucet.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ module.exports = {
88
filter: path => path.endsWith(".txt") && !path.startsWith("inner/")
99
}],
1010
plugins: {
11-
"static": path.resolve("../..")
11+
"static": {
12+
plugin: path.resolve("../.."),
13+
bucket: "static"
14+
}
1215
}
1316
};

0 commit comments

Comments
 (0)