File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed
packages/s3-static-assets/src Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 11import path from "path" ;
22import fse from "fs-extra" ;
33import mime from "mime-types" ;
4- import klaw , { Item } from "klaw" ;
54import AWS from "aws-sdk" ;
5+ import readDirectoryFiles from "./lib/readDirectoryFiles" ;
66
77type UploadStaticAssetsOptions = {
88 bucketName : string ;
99 nextConfigDir : string ;
1010} ;
11+
1112const filePathToS3Key = ( filePath : string ) : string => {
1213 const relevantFilePathPart = filePath . substring (
1314 filePath . indexOf ( ".next" + path . sep )
1415 ) ;
1516 return relevantFilePathPart . replace ( ".next" , "_next" ) ;
1617} ;
17- const readDirectoryFiles = ( directory : string ) : Promise < Array < Item > > => {
18- const items : Item [ ] = [ ] ;
19- return new Promise ( ( resolve , reject ) => {
20- klaw ( directory . trim ( ) )
21- . on ( "data" , item => items . push ( item ) )
22- . on ( "end" , ( ) => {
23- resolve ( items ) ;
24- } )
25- . on ( "error" , reject ) ;
26- } ) ;
27- } ;
2818
2919const uploadStaticAssets = async (
3020 options : UploadStaticAssetsOptions
@@ -90,7 +80,6 @@ const uploadStaticAssets = async (
9080 await Promise . all ( uploadTasks ) ;
9181 // read public/ folder and upload files
9282 // read static/ folder and upload files
93- // get HTML pages from pages manifest
9483 // get JSON data files from prerender manifest
9584} ;
9685
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import klaw , { Item } from "klaw" ;
2+
3+ const readDirectoryFiles = ( directory : string ) : Promise < Array < Item > > => {
4+ const items : Item [ ] = [ ] ;
5+ return new Promise ( ( resolve , reject ) => {
6+ klaw ( directory . trim ( ) )
7+ . on ( "data" , item => items . push ( item ) )
8+ . on ( "end" , ( ) => {
9+ resolve ( items ) ;
10+ } )
11+ . on ( "error" , reject ) ;
12+ } ) ;
13+ } ;
14+
15+ export default readDirectoryFiles ;
You can’t perform that action at this time.
0 commit comments