sftp-zip-deploy 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -8
- package/dist/config.d.ts +5 -6
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
Fast and efficient way to auto-deploy your project to a server:
|
|
7
7
|
|
|
8
8
|
- It zips your distribution folder and sends the archive to your server via SFTP
|
|
9
|
-
- It
|
|
9
|
+
- It supports remote commands for before / after zip deployment, via SSH2
|
|
10
10
|
- It provides detailed data about what is going on all the way
|
|
11
11
|
|
|
12
12
|
**IMPORTANT:**
|
|
13
13
|
|
|
14
|
-
This library relies on
|
|
14
|
+
This library relies on NodeJS-native support for SSH2 and ZIP, and therefore requires Node v26 or newer.
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -54,18 +54,15 @@ So avoid running commands that may trigger an input prompt.
|
|
|
54
54
|
|
|
55
55
|
## API
|
|
56
56
|
|
|
57
|
-
The library shares connection options for SFTP / SSH2, and reuses `ConnectOptions` from `ssh2-sftp-client` module.
|
|
58
|
-
To use that type explicitly, you will need to add `@types/ssh2-sftp-client` as a DEV dependency.
|
|
59
|
-
|
|
60
57
|
The main interface [ISftpZipDeployConfig] has a number of options, including events for providing progress details:
|
|
61
58
|
|
|
62
59
|
* [onZipReady] - notifies when zip is ready
|
|
63
60
|
* [onFilter] - to let you filter files inside distribution folder
|
|
64
61
|
* [onCmdOutput] - to get all output from remote commands
|
|
65
62
|
|
|
66
|
-
[onZipReady]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#
|
|
67
|
-
[onFilter]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#
|
|
68
|
-
[onCmdOutput]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#
|
|
63
|
+
[onZipReady]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#L67
|
|
64
|
+
[onFilter]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#L61
|
|
65
|
+
[onCmdOutput]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#L84
|
|
69
66
|
|
|
70
67
|
[ISftpZipDeployConfig]:https://github.com/vitaly-t/sftp-zip-deploy/blob/main/src/config.ts#L6
|
|
71
68
|
|
package/dist/config.d.ts
CHANGED
|
@@ -47,8 +47,7 @@ export interface ISftpZipDeployConfig {
|
|
|
47
47
|
after?: string;
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
|
-
* Optional filter on file enumeration (found in `srcDir`),
|
|
51
|
-
* returning:
|
|
50
|
+
* Optional filter on file enumeration (found in `srcDir`), returning:
|
|
52
51
|
*
|
|
53
52
|
* - true for files to be added;
|
|
54
53
|
* - false for files to be skipped.
|
|
@@ -63,13 +62,13 @@ export interface ISftpZipDeployConfig {
|
|
|
63
62
|
* Notification of every output produced by a remote command.
|
|
64
63
|
*
|
|
65
64
|
* @param cmd
|
|
66
|
-
* Command that produced
|
|
65
|
+
* Command that produced the output.
|
|
67
66
|
*
|
|
68
67
|
* @param err
|
|
69
68
|
* Set when the output was sent into StdErr, i.e. an error is reported.
|
|
70
69
|
*
|
|
71
|
-
* In most cases
|
|
72
|
-
* an error code,
|
|
70
|
+
* In most cases, when there is an issue, the command also returns
|
|
71
|
+
* an error code, which makes the API throw an error.
|
|
73
72
|
*
|
|
74
73
|
* @param std
|
|
75
74
|
* Set when normal/standard output is generated (not an error).
|
|
@@ -89,7 +88,7 @@ export interface IZipDetails {
|
|
|
89
88
|
*/
|
|
90
89
|
zipLocalPath: string;
|
|
91
90
|
/**
|
|
92
|
-
* Remote path to the zip file.
|
|
91
|
+
* Remote path to the zip file (projected).
|
|
93
92
|
*/
|
|
94
93
|
zipRemotePath: string;
|
|
95
94
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ export type { ConnectOptions } from 'ssh2-sftp-client';
|
|
|
5
5
|
* From the configuration object, it implements the following steps:
|
|
6
6
|
*
|
|
7
7
|
* 1. Executes `cmd.before` commands, if such were specified
|
|
8
|
-
* 2. Enumerates all files inside `srcDir`, plus filters them via `onFilter` (if
|
|
9
|
-
* 3. Produces zip file with all the resulting files and triggers `onZipReady` (if
|
|
8
|
+
* 2. Enumerates all files inside `srcDir`, plus filters them via `onFilter` (if specified)
|
|
9
|
+
* 3. Produces zip file with all the resulting files and triggers `onZipReady` (if specified)
|
|
10
10
|
* 4. Uploads zip file to the remote machine
|
|
11
|
-
* 5. Executes `cmd.after` commands, if such were specified
|
|
12
|
-
* 6. Resolves with `true`, if at least one file was found and zip was created,
|
|
11
|
+
* 5. Executes `cmd.after` commands, if such were specified (and zip was actually deployed).
|
|
12
|
+
* 6. Resolves with `true`, if at least one file was found and zip was created + deployed,
|
|
13
13
|
* or `false` otherwise (i.e. it does not create an empty zip)
|
|
14
14
|
*/
|
|
15
15
|
export declare function zipAndDeploy(cfg: ISftpZipDeployConfig): Promise<boolean>;
|
package/dist/index.js
CHANGED
|
@@ -7,11 +7,11 @@ import path from 'node:path';
|
|
|
7
7
|
* From the configuration object, it implements the following steps:
|
|
8
8
|
*
|
|
9
9
|
* 1. Executes `cmd.before` commands, if such were specified
|
|
10
|
-
* 2. Enumerates all files inside `srcDir`, plus filters them via `onFilter` (if
|
|
11
|
-
* 3. Produces zip file with all the resulting files and triggers `onZipReady` (if
|
|
10
|
+
* 2. Enumerates all files inside `srcDir`, plus filters them via `onFilter` (if specified)
|
|
11
|
+
* 3. Produces zip file with all the resulting files and triggers `onZipReady` (if specified)
|
|
12
12
|
* 4. Uploads zip file to the remote machine
|
|
13
|
-
* 5. Executes `cmd.after` commands, if such were specified
|
|
14
|
-
* 6. Resolves with `true`, if at least one file was found and zip was created,
|
|
13
|
+
* 5. Executes `cmd.after` commands, if such were specified (and zip was actually deployed).
|
|
14
|
+
* 6. Resolves with `true`, if at least one file was found and zip was created + deployed,
|
|
15
15
|
* or `false` otherwise (i.e. it does not create an empty zip)
|
|
16
16
|
*/
|
|
17
17
|
export async function zipAndDeploy(cfg) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sftp-zip-deploy",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Zip and deploy folder over SFTP",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"node": ">=26"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@types/node": "26.6.6",
|
|
36
|
+
"@types/ssh2-sftp-client": "9.0.6",
|
|
35
37
|
"glob": "14.0.6",
|
|
36
38
|
"ssh2-sftp-client": "12.1.1"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
|
-
"@types/node": "26.6.6",
|
|
40
|
-
"@types/ssh2-sftp-client": "9.0.6",
|
|
41
41
|
"typescript": "7.0.2"
|
|
42
42
|
}
|
|
43
43
|
}
|