Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload files, that was changed but withour saving buffer? #1

Open
seriiserii825 opened this issue Jul 18, 2024 · 4 comments
Open

Upload files, that was changed but withour saving buffer? #1

seriiserii825 opened this issue Jul 18, 2024 · 4 comments

Comments

@seriiserii825
Copy link

Hi, i has a project. that works with vite.
And when i changed scss, and save file, that it's ok, file uploaded to server.
But i need to call yarn build, than another compiled files, like my.css will change, but without saving buffer manualy, and this file will not uploaded.

May be to add an watcher?

Thansk for you plugin

@gorillamoe
Copy link
Owner

Ye, totally can implement that, if you're using neovim 0.10.0+

@seriiserii825
Copy link
Author

What you mean?

@seriiserii825
Copy link
Author

I wrote a script and run afte build

sftp_config_file_json=".AutoRemoteSync.json"
if [ -f $sftp_config_file_json ]; then
  echo "File $sftp_config_file_json exists."
  host=$(jq -r '.remote.host' $sftp_config_file_json)
  user=$(jq -r '.remote.user' $sftp_config_file_json)
  remote_path=$(jq -r '.remote.path' $sftp_config_file_json)
  modified_files=$(git ls-files --modified)
  for file in $modified_files; do
    echo "${tblue}file: $file${treset}"
    full_path=$remote_path/$file
    echo "${tgreen}full_path: $full_path${treset}"
    rsync -avz -e ssh $file $user@$host:$full_path
  done
else
  echo "${tmagenta}File $sftp_config_file_json does not exist.${treset}"
  echo "${tyellow}Please create a file $sftp_config_file_json with the following content:${treset}"
  exit 1
fi

@num8er
Copy link

num8er commented Oct 27, 2024

@gorillamoe I think I would be nice to have ability to run shell script on save.
Something like "runAfterUpload": "relative/path/to/script.sh" which will execute shell script on remote machine.

P.S. it's not related to main question to upload without saving, I also would disagree to have such feature.
It's unsafe to do that for different security related reasons.

I wrote a script and run afte build

sftp_config_file_json=".AutoRemoteSync.json"
if [ -f $sftp_config_file_json ]; then
  echo "File $sftp_config_file_json exists."
  host=$(jq -r '.remote.host' $sftp_config_file_json)
  user=$(jq -r '.remote.user' $sftp_config_file_json)
  remote_path=$(jq -r '.remote.path' $sftp_config_file_json)
  modified_files=$(git ls-files --modified)
  for file in $modified_files; do
    echo "${tblue}file: $file${treset}"
    full_path=$remote_path/$file
    echo "${tgreen}full_path: $full_path${treset}"
    rsync -avz -e ssh $file $user@$host:$full_path
  done
else
  echo "${tmagenta}File $sftp_config_file_json does not exist.${treset}"
  echo "${tyellow}Please create a file $sftp_config_file_json with the following content:${treset}"
  exit 1
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants