Skip to content

Commit 4964e8e

Browse files
authored
Merge pull request #2 from faucet-pipeline/improve-manifest
[BREAKING CHANGE] Provide the filePath to the baseURI function
2 parents ecec234 + 4a1ed7f commit 4964e8e

File tree

9 files changed

+27
-4
lines changed

9 files changed

+27
-4
lines changed

lib/build-bundler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ module.exports = ({ source, target, fingerprint, configDir }) => {
3232
return {
3333
changed: true,
3434
target: path.relative(configDir, targetPath),
35-
output: path.relative(configDir, outputPath)
35+
output: path.relative(configDir, outputPath),
36+
filePath: path.relative(target, outputPath)
3637
};
3738
});
3839
});

lib/build-manifest-writer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
let { createFile } = require("faucet-pipeline-util");
2-
let { basename } = require("path");
32

43
// Create a writer for a manifest
54
//
@@ -20,7 +19,7 @@ module.exports = manifestConfig => {
2019

2120
function updateManifest(results, manifest, { baseURI }) {
2221
return results.reduce((acc, result) => {
23-
acc[result.target] = baseURI(result.output, basename(result.output));
22+
acc[result.target] = baseURI(result.output, result.filePath);
2423
return acc;
2524
}, manifest);
2625
}

test/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ begin "./test_fingerprint"
6464
assert_identical "./dist/test-e59ff97941044f85df5297e1c302d260.txt" "./src/test.txt"
6565
assert_identical "./dist/manifest.json" "./expected.json"
6666
end
67+
68+
begin "./test_manifest_base_uri"
69+
faucet
70+
assert_identical "./dist/manifest.json" "./expected.json"
71+
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"dist/test.txt":"/assets/dist/test-e59ff97941044f85df5297e1c302d260.txt"}
1+
{"dist/inner/test2.txt":"/assets/dist/inner/test2-e59ff97941044f85df5297e1c302d260.txt","dist/test.txt":"/assets/dist/test-e59ff97941044f85df5297e1c302d260.txt"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"dist/inner/test2.txt":"/assets/inner/test2-e59ff97941044f85df5297e1c302d260.txt","dist/test.txt":"/assets/test-e59ff97941044f85df5297e1c302d260.txt"}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"use strict";
2+
3+
module.exports = {
4+
static: {
5+
manifest: {
6+
file: "./dist/manifest.json",
7+
baseURI: (bundlePath, filePath) => `/assets/${filePath}`
8+
},
9+
bundles: [{
10+
source: "src",
11+
target: "dist"
12+
}]
13+
}
14+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World

0 commit comments

Comments
 (0)