File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11let fs = require ( "fs" ) ;
22let path = require ( "path" ) ;
3- let { createFile } = require ( "faucet-pipeline-util" ) ;
3+ let { createFile, generateFingerprint } = require ( "faucet-pipeline-util" ) ;
44// TODO: Not available on all supported Node versions
55let { promisify } = require ( "util" ) ;
66let readFile = promisify ( fs . readFile ) ;
77let readdir = promisify ( fs . readdir ) ;
88
9- module . exports = ( { source, target } ) => {
9+ module . exports = ( { source, target, fingerprint } ) => {
1010 // TODO: Only copy changed files
1111 return _ => {
1212 readdir ( source ) . then ( sources => {
1313 return Promise . all ( sources . map ( filePath => {
1414 let sourcePath = path . join ( source , filePath ) ;
15- let targetPath = path . join ( target , filePath ) ;
1615
1716 return readFile ( sourcePath ) . then ( content => {
17+ if ( fingerprint ) {
18+ filePath = generateFingerprint ( filePath , content ) ;
19+ }
20+
21+ let targetPath = path . join ( target , filePath ) ;
22+
1823 return createFile ( targetPath , content ) ;
1924 } ) ;
2025 } ) ) ;
Original file line number Diff line number Diff line change @@ -57,3 +57,9 @@ begin "./test_basic"
5757 faucet --no-fingerprint
5858 assert_identical " ./dist/test.txt" " ./src/test.txt"
5959end
60+
61+ # Once again with fingerprinting
62+ begin " ./test_basic"
63+ faucet
64+ assert_identical " ./dist/test-e59ff97941044f85df5297e1c302d260.txt" " ./src/test.txt"
65+ end
You can’t perform that action at this time.
0 commit comments