@@ -1739,12 +1739,11 @@ exports.HashDiff = HashDiff;
17391739Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
17401740exports . prettyError = void 0 ;
17411741const types_1 = __webpack_require__ ( 6703 ) ;
1742- function outputOriginalErrorAndExit ( logger , error ) {
1742+ function logOriginalError ( logger , error ) {
17431743 logger . all ( ) ;
17441744 logger . all ( `----------------------------------------------------------------` ) ;
17451745 logger . all ( `---------------------- Full Error below ----------------------` ) ;
17461746 logger . all ( error ) ;
1747- process . exit ( ) ;
17481747}
17491748/**
17501749 * Converts a exception to helpful debug info
@@ -1755,41 +1754,36 @@ function prettyError(logger, args, error) {
17551754 logger . all ( `----------------------------------------------------------------` ) ;
17561755 logger . all ( `--------------- 🔥🔥🔥 A error occurred 🔥🔥🔥 --------------` ) ;
17571756 logger . all ( `----------------------------------------------------------------` ) ;
1757+ const ftpError = error ;
17581758 if ( typeof error . code === "string" ) {
17591759 const errorCode = error . code ;
17601760 if ( errorCode === "ENOTFOUND" ) {
17611761 logger . all ( `The server "${ args . server } " doesn't seem to exist. Do you have a typo?` ) ;
1762- outputOriginalErrorAndExit ( logger , error ) ;
17631762 }
17641763 }
1765- if ( typeof error . name === "string" ) {
1764+ else if ( typeof error . name === "string" ) {
17661765 const errorName = error . name ;
17671766 if ( errorName . includes ( "ERR_TLS_CERT_ALTNAME_INVALID" ) ) {
17681767 logger . all ( `The certificate for "${ args . server } " is likely shared. The host did not place your server on the list of valid domains for this cert.` ) ;
17691768 logger . all ( `This is a common issue with shared hosts. You have a few options:` ) ;
17701769 logger . all ( ` - Ignore this error by setting security back to loose` ) ;
17711770 logger . all ( ` - Contact your hosting provider and ask them for your servers hostname` ) ;
1772- outputOriginalErrorAndExit ( logger , error ) ;
17731771 }
17741772 }
1775- const ftpError = error ;
1776- if ( typeof ftpError . code === "number" ) {
1773+ else if ( typeof ftpError . code === "number" ) {
17771774 if ( ftpError . code === types_1 . ErrorCode . NotLoggedIn ) {
17781775 const serverRequiresFTPS = ftpError . message . toLowerCase ( ) . includes ( "must use encryption" ) ;
17791776 if ( serverRequiresFTPS ) {
17801777 logger . all ( `The server you are connecting to requires encryption (ftps)` ) ;
17811778 logger . all ( `Enable FTPS by using the protocol option.` ) ;
1782- outputOriginalErrorAndExit ( logger , error ) ;
17831779 }
17841780 else {
17851781 logger . all ( `Could not login with the username "${ args . username } " and password "${ args . password } ".` ) ;
17861782 logger . all ( `Make sure you can login with those credentials. If you have a space or a quote in your username or password be sure to escape them!` ) ;
1787- outputOriginalErrorAndExit ( logger , error ) ;
17881783 }
17891784 }
17901785 }
1791- // unknown error :(
1792- outputOriginalErrorAndExit ( logger , error ) ;
1786+ logOriginalError ( logger , error ) ;
17931787}
17941788exports . prettyError = prettyError ;
17951789
@@ -1833,7 +1827,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18331827 return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
18341828} ;
18351829Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1836- exports . deploy = exports . excludeDefaults = void 0 ;
1830+ exports . deploy = exports . getLocalFiles = exports . excludeDefaults = void 0 ;
18371831const ftp = __importStar ( __webpack_require__ ( 7957 ) ) ;
18381832const readdir_enhanced_1 = __importDefault ( __webpack_require__ ( 8811 ) ) ;
18391833const crypto_1 = __importDefault ( __webpack_require__ ( 6417 ) ) ;
@@ -1902,7 +1896,7 @@ function getLocalFiles(args) {
19021896 type : "file" ,
19031897 name : stat . path ,
19041898 size : stat . size ,
1905- hash : yield fileHash ( stat . path , "sha256" )
1899+ hash : yield fileHash ( args [ "local-dir" ] + stat . path , "sha256" )
19061900 } ) ;
19071901 continue ;
19081902 }
@@ -1912,12 +1906,13 @@ function getLocalFiles(args) {
19121906 }
19131907 return {
19141908 description : types_1 . syncFileDescription ,
1915- version : types_1 . currentVersion ,
1909+ version : types_1 . currentSyncFileVersion ,
19161910 generatedTime : new Date ( ) . getTime ( ) ,
19171911 data : records
19181912 } ;
19191913 } ) ;
19201914}
1915+ exports . getLocalFiles = getLocalFiles ;
19211916function downloadFileList ( client , logger , path ) {
19221917 return __awaiter ( this , void 0 , void 0 , function * ( ) {
19231918 // note: originally this was using a writable stream instead of a buffer file
@@ -2116,7 +2111,7 @@ function getServerFiles(client, logger, timings, args) {
21162111 // set the server state to nothing, because we don't know what the server state is
21172112 return {
21182113 description : types_1 . syncFileDescription ,
2119- version : types_1 . currentVersion ,
2114+ version : types_1 . currentSyncFileVersion ,
21202115 generatedTime : new Date ( ) . getTime ( ) ,
21212116 data : [ ] ,
21222117 } ;
@@ -2182,7 +2177,9 @@ function syncLocalToServer(client, diffs, logger, timings, args) {
21822177 }
21832178 logger . all ( `----------------------------------------------------------------` ) ;
21842179 logger . all ( `🎉 Sync complete. Saving current server state to "${ args [ "server-dir" ] + args [ "state-name" ] } "` ) ;
2185- yield utilities_1 . retryRequest ( logger , ( ) => __awaiter ( this , void 0 , void 0 , function * ( ) { return yield client . uploadFrom ( args [ "local-dir" ] + args [ "state-name" ] , args [ "state-name" ] ) ; } ) ) ;
2180+ if ( args [ "dry-run" ] === false ) {
2181+ yield utilities_1 . retryRequest ( logger , ( ) => __awaiter ( this , void 0 , void 0 , function * ( ) { return yield client . uploadFrom ( args [ "local-dir" ] + args [ "state-name" ] , args [ "server-dir" ] + args [ "state-name" ] ) ; } ) ) ;
2182+ }
21862183 } ) ;
21872184}
21882185function deploy ( deployArgs ) {
@@ -2194,7 +2191,7 @@ function deploy(deployArgs) {
21942191 // header
21952192 // todo allow swapping out library/version text based on if we are using action
21962193 logger . all ( `----------------------------------------------------------------` ) ;
2197- logger . all ( `🚀 Thanks for using ftp-deploy version ${ types_1 . currentVersion } . Let's deploy some stuff! ` ) ;
2194+ logger . all ( `🚀 Thanks for using ftp-deploy version ${ types_1 . currentSyncFileVersion } . Let's deploy some stuff! ` ) ;
21982195 logger . all ( `----------------------------------------------------------------` ) ;
21992196 logger . all ( `If you found this project helpful, please support it` ) ;
22002197 logger . all ( `by giving it a ⭐ on Github --> https://github.com/SamKirkland/FTP-Deploy-Action` ) ;
@@ -2216,8 +2213,10 @@ function deploy(deployArgs) {
22162213 yield global . reconnect ( ) ;
22172214 try {
22182215 const serverFiles = yield getServerFiles ( client , logger , timings , args ) ;
2216+ timings . start ( "logging" ) ;
22192217 const diffTool = new HashDiff_1 . HashDiff ( ) ;
22202218 const diffs = diffTool . getDiffs ( localFiles , serverFiles , logger ) ;
2219+ timings . stop ( "logging" ) ;
22212220 totalBytesUploaded = diffs . sizeUpload + diffs . sizeReplace ;
22222221 timings . start ( "upload" ) ;
22232222 try {
@@ -2226,11 +2225,9 @@ function deploy(deployArgs) {
22262225 catch ( e ) {
22272226 if ( e . code === types_1 . ErrorCode . FileNameNotAllowed ) {
22282227 logger . all ( "Error 553 FileNameNotAllowed, you don't have access to upload that file" ) ;
2229- logger . all ( e ) ;
2230- process . exit ( ) ;
22312228 }
22322229 logger . all ( e ) ;
2233- process . exit ( ) ;
2230+ throw e ;
22342231 }
22352232 finally {
22362233 timings . stop ( "upload" ) ;
@@ -2246,6 +2243,7 @@ function deploy(deployArgs) {
22462243 }
22472244 catch ( error ) {
22482245 errorHandling_1 . prettyError ( logger , args , error ) ;
2246+ throw error ;
22492247 }
22502248 finally {
22512249 client . close ( ) ;
@@ -2258,6 +2256,7 @@ function deploy(deployArgs) {
22582256 logger . all ( `Time spent connecting to server: ${ timings . getTimeFormatted ( "connecting" ) } ` ) ;
22592257 logger . all ( `Time spent deploying: ${ timings . getTimeFormatted ( "upload" ) } (${ uploadSpeed } /second)` ) ;
22602258 logger . all ( ` - changing dirs: ${ timings . getTimeFormatted ( "changingDir" ) } ` ) ;
2259+ logger . all ( ` - logging: ${ timings . getTimeFormatted ( "logging" ) } ` ) ;
22612260 logger . all ( `----------------------------------------------------------------` ) ;
22622261 logger . all ( `Total time: ${ timings . getTimeFormatted ( "total" ) } ` ) ;
22632262 logger . all ( `----------------------------------------------------------------` ) ;
@@ -2274,8 +2273,8 @@ exports.deploy = deploy;
22742273"use strict" ;
22752274
22762275Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
2277- exports . ErrorCode = exports . syncFileDescription = exports . currentVersion = void 0 ;
2278- exports . currentVersion = "1.0.0" ;
2276+ exports . ErrorCode = exports . syncFileDescription = exports . currentSyncFileVersion = void 0 ;
2277+ exports . currentSyncFileVersion = "1.0.0" ;
22792278exports . syncFileDescription = "DO NOT DELETE THIS FILE. This file is used to keep track of which files have been synced in the most recent deployment. If you delete this file a resync will need to be done (which can take a while) - read more: https://github.com/SamKirkland/FTP-Deploy-Action" ;
22802279var ErrorCode ;
22812280( function ( ErrorCode ) {
@@ -3303,12 +3302,8 @@ class Client {
33033302 return res ;
33043303 }
33053304 catch ( err ) {
3306- // Receiving an FTPError means that the last transfer strategy failed and we should
3307- // try the next one. Any other exception should stop the evaluation of strategies because
3308- // something else went wrong.
3309- if ( ! ( err instanceof FtpContext_1 . FTPError ) ) {
3310- throw err ;
3311- }
3305+ // Try the next candidate no matter the exact error. It's possible that a server
3306+ // answered incorrectly to a strategy, for example a PASV answer to an EPSV.
33123307 }
33133308 }
33143309 throw new Error ( "None of the available transfer strategies work." ) ;
@@ -3970,9 +3965,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
39703965 o [ k2 ] = m [ k ] ;
39713966} ) ) ;
39723967var __exportStar = ( this && this . __exportStar ) || function ( m , exports ) {
3973- for ( var p in m ) if ( p !== "default" && ! exports . hasOwnProperty ( p ) ) __createBinding ( exports , m , p ) ;
3968+ for ( var p in m ) if ( p !== "default" && ! Object . prototype . hasOwnProperty . call ( exports , p ) ) __createBinding ( exports , m , p ) ;
39743969} ;
39753970Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
3971+ exports . enterPassiveModeIPv6 = exports . enterPassiveModeIPv4 = void 0 ;
39763972/**
39773973 * Public API
39783974 */
@@ -4131,7 +4127,7 @@ function positiveIntermediate(code) {
41314127}
41324128exports . positiveIntermediate = positiveIntermediate ;
41334129function isNotBlank ( str ) {
4134- return str !== "" ;
4130+ return str . trim ( ) !== "" ;
41354131}
41364132
41374133
@@ -4157,7 +4153,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
41574153var __importStar = ( this && this . __importStar ) || function ( mod ) {
41584154 if ( mod && mod . __esModule ) return mod ;
41594155 var result = { } ;
4160- if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
4156+ if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
41614157 __setModuleDefault ( result , mod ) ;
41624158 return result ;
41634159} ;
@@ -6659,7 +6655,7 @@ function optionalStringArray(argumentName, rawValue) {
66596655 return undefined ;
66606656 }
66616657 // split value by space and comma
6662- return rawValue . split ( ", " ) ;
6658+ return rawValue . split ( " - " ) . filter ( str => str !== " ") ;
66636659}
66646660
66656661
0 commit comments