mirror of
https://github.com/easingthemes/ssh-deploy
synced 2026-06-03 00:59:40 +08:00
Compare commits
26 Commits
v5.0.2
...
refactor/r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e75a8e721 | ||
|
|
aea56817cd | ||
|
|
a4b077c853 | ||
|
|
33880d2926 | ||
|
|
c81b43c5bf | ||
|
|
71b8eb300f | ||
|
|
76668b2cd6 | ||
|
|
be39df3f93 | ||
|
|
b11fb7f911 | ||
|
|
922253577e | ||
|
|
1326d0a611 | ||
|
|
681efb59f1 | ||
|
|
2644554bce | ||
|
|
a1aa0b6cf9 | ||
|
|
f007431332 | ||
|
|
ece05a2275 | ||
|
|
b99511bf85 | ||
|
|
b82eced457 | ||
|
|
1befdb1c6b | ||
|
|
01a39e3348 | ||
|
|
f517598798 | ||
|
|
4d8bbf0deb | ||
|
|
428f2b152b | ||
|
|
d42d2576ab | ||
|
|
bed42ef321 | ||
|
|
07d369f5c8 |
25
.eslintrc.js
25
.eslintrc.js
@@ -1,25 +0,0 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'airbnb-base'
|
||||
],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly'
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018
|
||||
},
|
||||
rules: {
|
||||
'comma-dangle': [
|
||||
'error',
|
||||
'never'
|
||||
],
|
||||
'no-console': 'off',
|
||||
'object-curly-newline': 'off'
|
||||
}
|
||||
};
|
||||
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -14,13 +14,13 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node-version: [20.x]
|
||||
node-version: [24.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Install dependencies
|
||||
|
||||
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -31,11 +31,11 @@ jobs:
|
||||
language: [ 'javascript' ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
@@ -44,4 +44,4 @@ jobs:
|
||||
npm run build --if-present
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
2
.github/workflows/e2e-manual.yml
vendored
2
.github/workflows/e2e-manual.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# START E2E Test Specific - steps
|
||||
|
||||
6
.github/workflows/e2e.yml
vendored
6
.github/workflows/e2e.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# : ---------------------------------------------------------------
|
||||
# : START E2E Test Specific - steps
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# : ---------------------------------------------------------------
|
||||
# : START E2E Test Specific - steps
|
||||
@@ -169,7 +169,7 @@ jobs:
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
- name: e2e Test ssh-deploy action - Target 1
|
||||
uses: easingthemes/ssh-deploy@v3
|
||||
uses: easingthemes/ssh-deploy@main
|
||||
env:
|
||||
# Shared ENV Vars created in previous steps
|
||||
REMOTE_USER: ${{ env.TEST_USER }}
|
||||
|
||||
7
.github/workflows/manual-release.yml
vendored
7
.github/workflows/manual-release.yml
vendored
@@ -49,9 +49,9 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup Node.js ${{ matrix.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ matrix.NODE_VERSION }}
|
||||
- name: Commit trigger
|
||||
@@ -64,8 +64,9 @@ jobs:
|
||||
- name: Run Tests
|
||||
run: npm test --if-present
|
||||
- name: Create a release - ${{ github.event.inputs.version }}
|
||||
uses: cycjimmy/semantic-release-action@v3
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
with:
|
||||
semantic_version: 24
|
||||
dry_run: ${{ github.event.inputs.dryRun == 'true' }}
|
||||
extra_plugins: |
|
||||
@semantic-release/changelog
|
||||
|
||||
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@@ -12,13 +12,13 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest ]
|
||||
node-version: [ 20.x ]
|
||||
node-version: [ 24.x ]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ matrix['node-version'] }}
|
||||
- name: Install dependencies
|
||||
@@ -28,8 +28,9 @@ jobs:
|
||||
- name: Run Tests
|
||||
run: npm test --if-present
|
||||
- name: Release
|
||||
uses: cycjimmy/semantic-release-action@v3
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
with:
|
||||
semantic_version: 24
|
||||
dry_run: false
|
||||
extra_plugins: |
|
||||
@semantic-release/changelog
|
||||
|
||||
8
.github/workflows/stale.yml
vendored
8
.github/workflows/stale.yml
vendored
@@ -17,10 +17,10 @@ jobs:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v7
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
days-before-stale: 90
|
||||
days-before-close: 15
|
||||
stale-issue-message: 'This issue is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 30 days.'
|
||||
days-before-stale: 150
|
||||
days-before-close: 30
|
||||
stale-issue-label: 'stale'
|
||||
|
||||
23
.github/workflows/update-major-tag.yml
vendored
Normal file
23
.github/workflows/update-major-tag.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Update major version tag
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
update-tag:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Update major version tag
|
||||
run: |
|
||||
VERSION="${{ github.event.release.tag_name }}"
|
||||
MAJOR="v$(echo "$VERSION" | sed 's/^v//' | cut -d. -f1)"
|
||||
echo "Updating $MAJOR tag to point to $VERSION"
|
||||
git tag -f "$MAJOR" "$VERSION"
|
||||
git push -f origin "$MAJOR"
|
||||
14
README.md
14
README.md
@@ -67,19 +67,27 @@ Execution is preformed by storing commands in `.sh` file and executing it via `.
|
||||
If you have issues with `ssh` connection, use this var, eg `SCRIPT_BEFORE: ls`.
|
||||
This will force `known_hosts` update, adding your host via `ssh-keyscan`.
|
||||
|
||||
##### 10. `SCRIPT_AFTER` (optional, default '')
|
||||
##### 10. `SCRIPT_BEFORE_REQUIRED` (optional, default false)
|
||||
|
||||
If set to `true`, Job will fail if SCRIPT_BEFORE fails.
|
||||
|
||||
##### 11. `SCRIPT_AFTER` (optional, default '')
|
||||
|
||||
Script to run on host machine after rsync.
|
||||
Rsync output is stored in `$RSYNC_STDOUT` env variable.
|
||||
|
||||
##### 11. `SSH_CMD_ARGS` (optional, default '-o StrictHostKeyChecking=no')
|
||||
##### 12. `SCRIPT_AFTER_REQUIRED` (optional, default false)
|
||||
|
||||
If set to `true`, Job will fail if SCRIPT_AFTER fails.
|
||||
|
||||
##### 13. `SSH_CMD_ARGS` (optional, default '-o StrictHostKeyChecking=no')
|
||||
|
||||
A list of ssh arguments, they must be prefixed with -o and separated by a comma, for example: -o SomeArgument=no, -o SomeOtherArgument=5
|
||||
|
||||
|
||||
# Usage
|
||||
|
||||
Use the latest version from Marketplace,eg: ssh-deploy@v2
|
||||
Use the latest version from Marketplace,eg: ssh-deploy@v5.1.0
|
||||
or use the latest version from a branch, eg: ssh-deploy@main
|
||||
|
||||
```
|
||||
|
||||
@@ -55,7 +55,7 @@ outputs:
|
||||
status:
|
||||
description: "Status"
|
||||
runs:
|
||||
using: "node20"
|
||||
using: "node24"
|
||||
main: "dist/index.js"
|
||||
branding:
|
||||
color: "green"
|
||||
|
||||
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,3 +1,32 @@
|
||||
## [5.1.2](https://github.com/easingthemes/ssh-deploy/compare/v5.1.1...v5.1.2) (2026-04-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update Node.js runtime from 20 to 24 ([681efb5](https://github.com/easingthemes/ssh-deploy/commit/681efb59f1b7a4f41e72cf98a4e30f8860ab66f9)), closes [#207](https://github.com/easingthemes/ssh-deploy/issues/207)
|
||||
|
||||
## [5.1.1](https://github.com/easingthemes/ssh-deploy/compare/v5.1.0...v5.1.1) (2024-07-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update README.md ([f007431](https://github.com/easingthemes/ssh-deploy/commit/f007431332cb2dae49153363ad22fb9f90f4aa75))
|
||||
|
||||
# [5.1.0](https://github.com/easingthemes/ssh-deploy/compare/v5.0.3...v5.1.0) (2024-07-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add deleteFile function to helpers module ([1befdb1](https://github.com/easingthemes/ssh-deploy/commit/1befdb1c6bf3282aa34e6caa431cb2da23d2b17d))
|
||||
* apply deleteFile function to remoteCmd ([b82eced](https://github.com/easingthemes/ssh-deploy/commit/b82eced4571cb3f63369d51760a81820ffb1bc7f))
|
||||
|
||||
## [5.0.3](https://github.com/easingthemes/ssh-deploy/compare/v5.0.2...v5.0.3) (2024-02-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* trigger automated release ([4d8bbf0](https://github.com/easingthemes/ssh-deploy/commit/4d8bbf0debaade9fb03b8dc3be3c020955557b12))
|
||||
|
||||
## [5.0.2](https://github.com/easingthemes/ssh-deploy/compare/v5.0.1...v5.0.2) (2024-02-18)
|
||||
|
||||
|
||||
|
||||
52
eslint.config.js
Normal file
52
eslint.config.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const js = require('@eslint/js');
|
||||
const stylistic = require('@stylistic/eslint-plugin');
|
||||
const globals = require('globals');
|
||||
|
||||
module.exports = [
|
||||
js.configs.recommended,
|
||||
{
|
||||
plugins: {
|
||||
'@stylistic': stylistic
|
||||
},
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'commonjs',
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.commonjs,
|
||||
...globals.es2020,
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly'
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
// Stylistic rules (migrated from airbnb-base)
|
||||
'@stylistic/comma-dangle': ['error', 'never'],
|
||||
'@stylistic/indent': ['error', 2, { SwitchCase: 1 }],
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
||||
'@stylistic/arrow-parens': ['error', 'always'],
|
||||
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
||||
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
||||
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
||||
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
|
||||
'@stylistic/eol-last': ['error', 'always'],
|
||||
'@stylistic/no-trailing-spaces': 'error',
|
||||
'@stylistic/space-before-blocks': 'error',
|
||||
'@stylistic/space-infix-ops': 'error',
|
||||
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
||||
|
||||
// JS rules (migrated from airbnb-base)
|
||||
'no-console': 'off',
|
||||
'no-var': 'error',
|
||||
'prefer-const': 'error',
|
||||
'prefer-arrow-callback': 'error',
|
||||
'prefer-template': 'error',
|
||||
'object-shorthand': ['error', 'always'],
|
||||
'no-shadow': 'error',
|
||||
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
|
||||
'camelcase': ['error', { properties: 'never' }],
|
||||
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }]
|
||||
}
|
||||
}
|
||||
];
|
||||
3207
package-lock.json
generated
3207
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@draganfilipovic/ssh-deploy",
|
||||
"version": "5.0.2",
|
||||
"version": "5.1.2",
|
||||
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
@@ -29,17 +29,11 @@
|
||||
"url": "https://github.com/easingthemes/ssh-deploy/issues"
|
||||
},
|
||||
"homepage": "https://github.com/easingthemes/ssh-deploy#readme",
|
||||
"dependencies": {
|
||||
"rsyncwrapper": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.26.0"
|
||||
},
|
||||
"overrides": {
|
||||
"word-wrap": "npm:@aashutoshrathi/word-wrap@1.2.5",
|
||||
"semver": "^7.5.2"
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@stylistic/eslint-plugin": "^5.10.0",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"eslint": "^10.1.0",
|
||||
"globals": "^17.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { existsSync, mkdirSync, writeFileSync } = require('fs');
|
||||
const { existsSync, mkdirSync, writeFileSync, unlink } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
const validateDir = (dir) => {
|
||||
@@ -45,6 +45,29 @@ const writeToFile = ({ dir, filename, content, isRequired, mode = '0644' }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const deleteFile = ({ dir, filename, isRequired }) => {
|
||||
validateDir(dir);
|
||||
const filePath = join(dir, filename);
|
||||
|
||||
if (existsSync(filePath)) {
|
||||
const message = `⚠️ [FILE] ${filePath} Required file exist.`;
|
||||
handleError(message, isRequired);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`[FILE] Deleting ${filePath} file ...`);
|
||||
unlink(filePath, (error) => {
|
||||
if (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
const message = `⚠️[FILE] Deleting file error. filePath: ${filePath}, message: ${error.message}`;
|
||||
handleError(message, isRequired);
|
||||
}
|
||||
};
|
||||
|
||||
const validateRequiredInputs = (inputs) => {
|
||||
const inputKeys = Object.keys(inputs);
|
||||
const validInputs = inputKeys.filter((inputKey) => {
|
||||
@@ -66,6 +89,7 @@ const snakeToCamel = (str) => str.replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.t
|
||||
|
||||
module.exports = {
|
||||
writeToFile,
|
||||
deleteFile,
|
||||
validateRequiredInputs,
|
||||
snakeToCamel
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@ const run = async () => {
|
||||
if (scriptBefore) {
|
||||
await remoteCmdBefore(scriptBefore, privateKeyPath, scriptBeforeRequired);
|
||||
}
|
||||
/* eslint-disable object-property-newline */
|
||||
await sshDeploy({
|
||||
source, rsyncServer, exclude, remotePort,
|
||||
privateKeyPath, args, sshCmdArgs
|
||||
|
||||
@@ -27,7 +27,6 @@ inputNames.forEach((input) => {
|
||||
const inputVal = process.env[input] || process.env[`INPUT_${input}`] || defaultInputs[inputName];
|
||||
const validVal = inputVal === undefined ? defaultInputs[inputName] : inputVal;
|
||||
let extendedVal = validVal;
|
||||
// eslint-disable-next-line default-case
|
||||
switch (inputName) {
|
||||
case 'source':
|
||||
extendedVal = validVal.split(' ').map((src) => `${githubWorkspace}/${src}`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { exec } = require('child_process');
|
||||
const crypto = require('crypto');
|
||||
const { sshServer, githubWorkspace, remotePort } = require('./inputs');
|
||||
const { writeToFile } = require('./helpers');
|
||||
const { writeToFile, deleteFile } = require('./helpers');
|
||||
|
||||
const handleError = (message, isRequired, callback) => {
|
||||
if (isRequired) {
|
||||
@@ -11,7 +11,6 @@ const handleError = (message, isRequired, callback) => {
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Promise((resolve, reject) => {
|
||||
const uuid = crypto.randomUUID();
|
||||
const filename = `local_ssh_script-${label}-${uuid}.sh`;
|
||||
@@ -30,6 +29,8 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom
|
||||
} else {
|
||||
const limited = data.substring(0, dataLimit);
|
||||
console.log('✅ [CMD] Remote script executed. \n', limited, stderr);
|
||||
deleteFile({ dir: githubWorkspace, filename });
|
||||
console.log('✅ [FILE] Script file deleted.');
|
||||
resolve(limited);
|
||||
}
|
||||
}
|
||||
|
||||
56
src/rsync.js
Normal file
56
src/rsync.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
const escapeSpaces = (str) => (typeof str === 'string' ? str.replace(/\b\s/g, '\\ ') : str);
|
||||
|
||||
const buildRsyncCommand = ({ src, dest, excludeFirst, port, privateKey, args, sshCmdArgs }) => {
|
||||
const cmdParts = [];
|
||||
|
||||
const sources = Array.isArray(src) ? src : [src];
|
||||
cmdParts.push(...sources.map(escapeSpaces));
|
||||
cmdParts.push(escapeSpaces(dest));
|
||||
|
||||
let sshCmd = `ssh -p ${port || 22} -i ${privateKey}`;
|
||||
if (sshCmdArgs && sshCmdArgs.length > 0) {
|
||||
sshCmd += ` ${sshCmdArgs.join(' ')}`;
|
||||
}
|
||||
cmdParts.push('--rsh', `"${sshCmd}"`);
|
||||
|
||||
cmdParts.push('--recursive');
|
||||
|
||||
if (Array.isArray(excludeFirst)) {
|
||||
excludeFirst.forEach((pattern) => {
|
||||
if (pattern) cmdParts.push(`--exclude=${escapeSpaces(pattern)}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (Array.isArray(args)) {
|
||||
cmdParts.push(...args);
|
||||
}
|
||||
|
||||
return `rsync ${[...new Set(cmdParts)].join(' ')}`;
|
||||
};
|
||||
|
||||
module.exports = (options, callback) => {
|
||||
const cmd = buildRsyncCommand(options);
|
||||
const noop = () => {};
|
||||
const onStdout = options.onStdout || noop;
|
||||
const onStderr = options.onStderr || noop;
|
||||
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
const proc = spawn('/bin/sh', ['-c', cmd]);
|
||||
|
||||
proc.stdout.on('data', (data) => { onStdout(data); stdout += data; });
|
||||
proc.stderr.on('data', (data) => { onStderr(data); stderr += data; });
|
||||
|
||||
proc.on('exit', (code) => {
|
||||
let error = null;
|
||||
if (code !== 0) {
|
||||
error = new Error(`rsync exited with code ${code}`);
|
||||
error.code = code;
|
||||
}
|
||||
callback(error, stdout, stderr, cmd);
|
||||
});
|
||||
|
||||
proc.on('error', (err) => callback(err, stdout, stderr, cmd));
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
const { execSync } = require('child_process');
|
||||
const nodeRsync = require('rsyncwrapper');
|
||||
const nodeRsync = require('./rsync');
|
||||
|
||||
const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
|
||||
const logCMD = (cmd) => {
|
||||
@@ -46,7 +46,7 @@ const validateRsync = async () => {
|
||||
execSync('sudo DEBIAN_FRONTEND=noninteractive apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install rsync', { stdio: 'inherit' });
|
||||
console.log('✅ [CLI] Rsync installed. \n');
|
||||
} catch (error) {
|
||||
throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${error.message}`);
|
||||
throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${error.message}`, { cause: error });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,6 @@ const rsyncCli = async ({
|
||||
};
|
||||
|
||||
// RSYNC COMMAND
|
||||
/* eslint-disable object-property-newline */
|
||||
return nodeRsyncPromise({
|
||||
...defaultOptions,
|
||||
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,
|
||||
|
||||
Reference in New Issue
Block a user