@@ -1739,12 +1739,11 @@ exports.HashDiff = HashDiff;
1739
1739
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1740
1740
exports . prettyError = void 0 ;
1741
1741
const types_1 = __webpack_require__ ( 6703 ) ;
1742
- function outputOriginalErrorAndExit ( logger , error ) {
1742
+ function logOriginalError ( logger , error ) {
1743
1743
logger . all ( ) ;
1744
1744
logger . all ( `----------------------------------------------------------------` ) ;
1745
1745
logger . all ( `---------------------- Full Error below ----------------------` ) ;
1746
1746
logger . all ( error ) ;
1747
- process . exit ( ) ;
1748
1747
}
1749
1748
/**
1750
1749
* Converts a exception to helpful debug info
@@ -1755,41 +1754,36 @@ function prettyError(logger, args, error) {
1755
1754
logger . all ( `----------------------------------------------------------------` ) ;
1756
1755
logger . all ( `--------------- 🔥🔥🔥 A error occurred 🔥🔥🔥 --------------` ) ;
1757
1756
logger . all ( `----------------------------------------------------------------` ) ;
1757
+ const ftpError = error ;
1758
1758
if ( typeof error . code === "string" ) {
1759
1759
const errorCode = error . code ;
1760
1760
if ( errorCode === "ENOTFOUND" ) {
1761
1761
logger . all ( `The server "${ args . server } " doesn't seem to exist. Do you have a typo?` ) ;
1762
- outputOriginalErrorAndExit ( logger , error ) ;
1763
1762
}
1764
1763
}
1765
- if ( typeof error . name === "string" ) {
1764
+ else if ( typeof error . name === "string" ) {
1766
1765
const errorName = error . name ;
1767
1766
if ( errorName . includes ( "ERR_TLS_CERT_ALTNAME_INVALID" ) ) {
1768
1767
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.` ) ;
1769
1768
logger . all ( `This is a common issue with shared hosts. You have a few options:` ) ;
1770
1769
logger . all ( ` - Ignore this error by setting security back to loose` ) ;
1771
1770
logger . all ( ` - Contact your hosting provider and ask them for your servers hostname` ) ;
1772
- outputOriginalErrorAndExit ( logger , error ) ;
1773
1771
}
1774
1772
}
1775
- const ftpError = error ;
1776
- if ( typeof ftpError . code === "number" ) {
1773
+ else if ( typeof ftpError . code === "number" ) {
1777
1774
if ( ftpError . code === types_1 . ErrorCode . NotLoggedIn ) {
1778
1775
const serverRequiresFTPS = ftpError . message . toLowerCase ( ) . includes ( "must use encryption" ) ;
1779
1776
if ( serverRequiresFTPS ) {
1780
1777
logger . all ( `The server you are connecting to requires encryption (ftps)` ) ;
1781
1778
logger . all ( `Enable FTPS by using the protocol option.` ) ;
1782
- outputOriginalErrorAndExit ( logger , error ) ;
1783
1779
}
1784
1780
else {
1785
1781
logger . all ( `Could not login with the username "${ args . username } " and password "${ args . password } ".` ) ;
1786
1782
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 ) ;
1788
1783
}
1789
1784
}
1790
1785
}
1791
- // unknown error :(
1792
- outputOriginalErrorAndExit ( logger , error ) ;
1786
+ logOriginalError ( logger , error ) ;
1793
1787
}
1794
1788
exports . prettyError = prettyError ;
1795
1789
@@ -1833,7 +1827,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1833
1827
return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
1834
1828
} ;
1835
1829
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1836
- exports . deploy = exports . excludeDefaults = void 0 ;
1830
+ exports . deploy = exports . getLocalFiles = exports . excludeDefaults = void 0 ;
1837
1831
const ftp = __importStar ( __webpack_require__ ( 7957 ) ) ;
1838
1832
const readdir_enhanced_1 = __importDefault ( __webpack_require__ ( 8811 ) ) ;
1839
1833
const crypto_1 = __importDefault ( __webpack_require__ ( 6417 ) ) ;
@@ -1902,7 +1896,7 @@ function getLocalFiles(args) {
1902
1896
type : "file" ,
1903
1897
name : stat . path ,
1904
1898
size : stat . size ,
1905
- hash : yield fileHash ( stat . path , "sha256" )
1899
+ hash : yield fileHash ( args [ "local-dir" ] + stat . path , "sha256" )
1906
1900
} ) ;
1907
1901
continue ;
1908
1902
}
@@ -1912,12 +1906,13 @@ function getLocalFiles(args) {
1912
1906
}
1913
1907
return {
1914
1908
description : types_1 . syncFileDescription ,
1915
- version : types_1 . currentVersion ,
1909
+ version : types_1 . currentSyncFileVersion ,
1916
1910
generatedTime : new Date ( ) . getTime ( ) ,
1917
1911
data : records
1918
1912
} ;
1919
1913
} ) ;
1920
1914
}
1915
+ exports . getLocalFiles = getLocalFiles ;
1921
1916
function downloadFileList ( client , logger , path ) {
1922
1917
return __awaiter ( this , void 0 , void 0 , function * ( ) {
1923
1918
// note: originally this was using a writable stream instead of a buffer file
@@ -2116,7 +2111,7 @@ function getServerFiles(client, logger, timings, args) {
2116
2111
// set the server state to nothing, because we don't know what the server state is
2117
2112
return {
2118
2113
description : types_1 . syncFileDescription ,
2119
- version : types_1 . currentVersion ,
2114
+ version : types_1 . currentSyncFileVersion ,
2120
2115
generatedTime : new Date ( ) . getTime ( ) ,
2121
2116
data : [ ] ,
2122
2117
} ;
@@ -2182,7 +2177,9 @@ function syncLocalToServer(client, diffs, logger, timings, args) {
2182
2177
}
2183
2178
logger . all ( `----------------------------------------------------------------` ) ;
2184
2179
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
+ }
2186
2183
} ) ;
2187
2184
}
2188
2185
function deploy ( deployArgs ) {
@@ -2194,7 +2191,7 @@ function deploy(deployArgs) {
2194
2191
// header
2195
2192
// todo allow swapping out library/version text based on if we are using action
2196
2193
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! ` ) ;
2198
2195
logger . all ( `----------------------------------------------------------------` ) ;
2199
2196
logger . all ( `If you found this project helpful, please support it` ) ;
2200
2197
logger . all ( `by giving it a ⭐ on Github --> https://github.com/SamKirkland/FTP-Deploy-Action` ) ;
@@ -2216,8 +2213,10 @@ function deploy(deployArgs) {
2216
2213
yield global . reconnect ( ) ;
2217
2214
try {
2218
2215
const serverFiles = yield getServerFiles ( client , logger , timings , args ) ;
2216
+ timings . start ( "logging" ) ;
2219
2217
const diffTool = new HashDiff_1 . HashDiff ( ) ;
2220
2218
const diffs = diffTool . getDiffs ( localFiles , serverFiles , logger ) ;
2219
+ timings . stop ( "logging" ) ;
2221
2220
totalBytesUploaded = diffs . sizeUpload + diffs . sizeReplace ;
2222
2221
timings . start ( "upload" ) ;
2223
2222
try {
@@ -2226,11 +2225,9 @@ function deploy(deployArgs) {
2226
2225
catch ( e ) {
2227
2226
if ( e . code === types_1 . ErrorCode . FileNameNotAllowed ) {
2228
2227
logger . all ( "Error 553 FileNameNotAllowed, you don't have access to upload that file" ) ;
2229
- logger . all ( e ) ;
2230
- process . exit ( ) ;
2231
2228
}
2232
2229
logger . all ( e ) ;
2233
- process . exit ( ) ;
2230
+ throw e ;
2234
2231
}
2235
2232
finally {
2236
2233
timings . stop ( "upload" ) ;
@@ -2246,6 +2243,7 @@ function deploy(deployArgs) {
2246
2243
}
2247
2244
catch ( error ) {
2248
2245
errorHandling_1 . prettyError ( logger , args , error ) ;
2246
+ throw error ;
2249
2247
}
2250
2248
finally {
2251
2249
client . close ( ) ;
@@ -2258,6 +2256,7 @@ function deploy(deployArgs) {
2258
2256
logger . all ( `Time spent connecting to server: ${ timings . getTimeFormatted ( "connecting" ) } ` ) ;
2259
2257
logger . all ( `Time spent deploying: ${ timings . getTimeFormatted ( "upload" ) } (${ uploadSpeed } /second)` ) ;
2260
2258
logger . all ( ` - changing dirs: ${ timings . getTimeFormatted ( "changingDir" ) } ` ) ;
2259
+ logger . all ( ` - logging: ${ timings . getTimeFormatted ( "logging" ) } ` ) ;
2261
2260
logger . all ( `----------------------------------------------------------------` ) ;
2262
2261
logger . all ( `Total time: ${ timings . getTimeFormatted ( "total" ) } ` ) ;
2263
2262
logger . all ( `----------------------------------------------------------------` ) ;
@@ -2274,8 +2273,8 @@ exports.deploy = deploy;
2274
2273
"use strict" ;
2275
2274
2276
2275
Object . 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" ;
2279
2278
exports . 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" ;
2280
2279
var ErrorCode ;
2281
2280
( function ( ErrorCode ) {
@@ -3303,12 +3302,8 @@ class Client {
3303
3302
return res ;
3304
3303
}
3305
3304
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.
3312
3307
}
3313
3308
}
3314
3309
throw new Error ( "None of the available transfer strategies work." ) ;
@@ -3970,9 +3965,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
3970
3965
o [ k2 ] = m [ k ] ;
3971
3966
} ) ) ;
3972
3967
var __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 ) ;
3974
3969
} ;
3975
3970
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
3971
+ exports . enterPassiveModeIPv6 = exports . enterPassiveModeIPv4 = void 0 ;
3976
3972
/**
3977
3973
* Public API
3978
3974
*/
@@ -4131,7 +4127,7 @@ function positiveIntermediate(code) {
4131
4127
}
4132
4128
exports . positiveIntermediate = positiveIntermediate ;
4133
4129
function isNotBlank ( str ) {
4134
- return str !== "" ;
4130
+ return str . trim ( ) !== "" ;
4135
4131
}
4136
4132
4137
4133
@@ -4157,7 +4153,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
4157
4153
var __importStar = ( this && this . __importStar ) || function ( mod ) {
4158
4154
if ( mod && mod . __esModule ) return mod ;
4159
4155
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 ) ;
4161
4157
__setModuleDefault ( result , mod ) ;
4162
4158
return result ;
4163
4159
} ;
@@ -6659,7 +6655,7 @@ function optionalStringArray(argumentName, rawValue) {
6659
6655
return undefined ;
6660
6656
}
6661
6657
// split value by space and comma
6662
- return rawValue . split ( ", " ) ;
6658
+ return rawValue . split ( " - " ) . filter ( str => str !== " ") ;
6663
6659
}
6664
6660
6665
6661
0 commit comments