simple command exists

This commit is contained in:
Dragan Filipovic 2023-01-02 02:01:20 +01:00
parent 8e3c961ec3
commit 6e50b54a1b
4 changed files with 15 additions and 32 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

31
package-lock.json generated
View file

@ -9,8 +9,7 @@
"version": "3.1.0", "version": "3.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"rsyncwrapper": "^3.0.1", "rsyncwrapper": "^3.0.1"
"which": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.36.0", "@vercel/ncc": "^0.36.0",
@ -1290,7 +1289,8 @@
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
}, },
"node_modules/js-sdsl": { "node_modules/js-sdsl": {
"version": "4.2.0", "version": "4.2.0",
@ -1931,20 +1931,6 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/which": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/which/-/which-3.0.0.tgz",
"integrity": "sha512-nla//68K9NU6yRiwDY/Q8aU6siKlSs64aEC7+IV56QoAuyQT2ovsJcgGYGyqMOmI/CGN1BOR6mM5EN0FBO+zyQ==",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/which.js"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/which-boxed-primitive": { "node_modules/which-boxed-primitive": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz",
@ -2926,7 +2912,8 @@
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
}, },
"js-sdsl": { "js-sdsl": {
"version": "4.2.0", "version": "4.2.0",
@ -3372,14 +3359,6 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"which": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/which/-/which-3.0.0.tgz",
"integrity": "sha512-nla//68K9NU6yRiwDY/Q8aU6siKlSs64aEC7+IV56QoAuyQT2ovsJcgGYGyqMOmI/CGN1BOR6mM5EN0FBO+zyQ==",
"requires": {
"isexe": "^2.0.0"
}
},
"which-boxed-primitive": { "which-boxed-primitive": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz",

View file

@ -30,8 +30,7 @@
}, },
"homepage": "https://github.com/easingthemes/ssh-deploy#readme", "homepage": "https://github.com/easingthemes/ssh-deploy#readme",
"dependencies": { "dependencies": {
"rsyncwrapper": "^3.0.1", "rsyncwrapper": "^3.0.1"
"which": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.36.0", "@vercel/ncc": "^0.36.0",

View file

@ -1,11 +1,16 @@
const { execSync } = require('child_process'); const { execSync } = require('child_process');
const which = require('which');
const nodeRsync = require('rsyncwrapper'); const nodeRsync = require('rsyncwrapper');
// eslint-disable-next-line no-async-promise-executor // eslint-disable-next-line no-async-promise-executor
const validateRsync = new Promise(async (resolve, reject) => { const validateRsync = new Promise(async (resolve, reject) => {
const rsyncCli = await which('rsync', { nothrow: true }); let rsyncCli = false;
execSync('rsync --version', { stdio: 'inherit' }); try {
execSync('rsync --version', { stdio: 'inherit' });
rsyncCli = true;
} catch (e) {
rsyncCli = true;
}
if (rsyncCli) { if (rsyncCli) {
console.log('⚠️ [CLI] Rsync exists'); console.log('⚠️ [CLI] Rsync exists');
execSync('rsync --version', { stdio: 'inherit' }); execSync('rsync --version', { stdio: 'inherit' });