npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

remote-code

v1.0.1

Published

live-reload for ssh connected devices 🐪

Downloads

5

Readme

remote-code

Build Status npm Greenkeeper badge

live-reload for ssh connected devices 🐪

What is remote-code? remote-code is a developer tool that helps you to write code on your normal developer machine but actually run on a remote device (e.g. raspberry pi). It automagically syncs your local files with the remote, installs dependencies on the device if you update your package.json and makes sure the remote process keeps running while you develop using nodemon.

Why would I need that? You may need it depending on your project and how you want to develop; my need for a tool like this emerged from projects supposed to run on a raspberry pi that heavily relies on using pi specific hardware like bluetooth, IO ports etc. The alternative to remote coding would be to develop on the pi directly. That means either replicating your dev setup onto the machine or working with less familiar tools.

Install

⚠️ Please check that your remote host fulfills all prerequisites

Recommended to use as CLI

$ npm i -g remote-code

supported platforms

remote-code relies heavily on other node modules to achieve the functionality, while they claim to support all major operating systems there currently is no test suite for this. Feel free to contribute 🐳

It has been tested for the following combinations of local/remote

| local | remote | |------|--------| | MacBook Pro | raspbian | | MacBook 2017 | Ubuntu 18.04 (AWS EC2) | | MacBook 2017 | RHEL 7.6 (AWS EC2) |

prerequisites

At the moment your remote host needs to fulfill a few requirements for this to work:

  1. rsync installed
  2. npm & nodemon globally available (if you use the default start command)
  3. remote target needs to have reachable npm upstream to install dependencies (i.e. internet connection)

Usage

$ remote-code help
  live-reload for ssh connected devices 🐪

  Usage
    $ remote-code <[user@]host>

    This will happen:
    ✈️  sync local directory content with remote dir
    📦  run 'npm install' to install dependencies
    👀  open a ssh stream to view remote output
    🔃  run 'nodemon .' in the remote directory

    Note: Without specifying --source and/or --target default dirs will be used. You should only do this for testing as the directory could be dirty from previous runs.


  Options
    --identity-file,  -i    SSH keyfile
    --install-cmd,    -I    installation / setup command [npm install]
    --port,           -p    Custom port [22]
    --source,         -s    directory to synchronize (local) [CWD]
    --start-cmd,      -S    command to start on remote (should implement a file watcher) [nodemon .]
    --target,         -t    remote location to sync to ["~/remote-sync"]
    --user,           -u    SSH username
    --verbose,        -v    log all the things

  Examples
    $ remote-code [email protected]
    $ remote-code -p 23 -i ~/.ssh/id_rsa --user admin 192.168.0.4
    $ remote-code -i ~/.ssh/id_rsa [email protected] --source ~/myProject --target "~/myProject"
    $ remote-code -i ~/.ssh/id_rsa [email protected] -S 'sudo \`which node\` johnny5' -I "npm install"

FAQ

Error: rsync exited with code 12

Getting this error after the ✈️ syncing files message usually indicates issues with the availability of rsync on your client/server. Please check the following:

  • your identify file is correct
  • try running the command with --verbose and look for the rsync command that is being logged after the file sync is initiated, verify that the arguments look OK
  • compare the rsync versions of host and client using rsync --version, if the protocol versions differentiate too much it might be an issue

Note: See this list for other rsync error codes

Error: rsync exited with code 127

This error might pop up if the remote host does not have rsync installed. Please verify you have it installed.

Todo

  • [ ] ship with setup routine to install npm & nodemon if they are missing on remote
  • [ ] test if this works with virtual machines as a target (e.g. EC2)
  • [ ] test password authentication
  • [ ] move options logic to index to allow testing for defaults

If you find anything that you don't like create an issue.

License

MIT © Andreas Offenhaeuser

Credits

Kudos to the libraries I didn't have to worry about because someone else did:

  • chokidar: watch files on local system
  • rsync: a great wrapper around the rsync binary
  • nodemon: keep node process on remote running
  • ssh2: start remote processes like nodemon and npm install