{"id":16712923,"url":"https://github.com/gabrielcsapo/run-anything","last_synced_at":"2025-03-15T05:18:12.884Z","repository":{"id":70619873,"uuid":"94594590","full_name":"gabrielcsapo/run-anything","owner":"gabrielcsapo","description":"🏃 configuration based application development for IOT","archived":false,"fork":false,"pushed_at":"2017-12-02T03:48:50.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T01:53:29.317Z","etag":null,"topics":["iot","javascript","product"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielcsapo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-17T02:07:03.000Z","updated_at":"2021-03-19T05:28:27.000Z","dependencies_parsed_at":"2023-04-03T21:01:39.088Z","dependency_job_id":null,"html_url":"https://github.com/gabrielcsapo/run-anything","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"21e6e97825f701610aaacb0af37c4a3ac3ddbc41"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielcsapo%2Frun-anything","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielcsapo%2Frun-anything/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielcsapo%2Frun-anything/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielcsapo%2Frun-anything/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielcsapo","download_url":"https://codeload.github.com/gabrielcsapo/run-anything/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685701,"owners_count":20331004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iot","javascript","product"],"created_at":"2024-10-12T20:44:41.461Z","updated_at":"2025-03-15T05:18:12.855Z","avatar_url":"https://github.com/gabrielcsapo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# run-anywhere\n\n\u003e 🏃 configuration based application development for IOT\n\n[![Npm Version](https://img.shields.io/npm/v/run-anything.svg)](https://www.npmjs.com/package/run-anything)\n[![Build Status](https://travis-ci.org/gabrielcsapo/run-anything.svg?branch=master)](https://travis-ci.org/gabrielcsapo/run-anything)\n[![Coverage Status](https://lcov-server.gabrielcsapo.com/badge/github%2Ecom/gabrielcsapo/run-anything.svg)](https://lcov-server.gabrielcsapo.com/coverage/github%2Ecom/gabrielcsapo/run-anything)\n[![Dependency Status](https://starbuck.gabrielcsapo.com/badge/github/gabrielcsapo/run-anything/status.svg)](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/run-anything)\n[![devDependency Status](https://starbuck.gabrielcsapo.com/badge/github/gabrielcsapo/run-anything/dev-status.svg)](https://starbuck.gabrielcsapo.com/github/gabrielcsapo/run-anything#info=devDependencies)\n[![npm](https://img.shields.io/npm/dt/run-anything.svg)]()\n[![npm](https://img.shields.io/npm/dm/run-anything.svg)]()\n\n## Installation\n\n```\nnpm install run-anywhere\n```\n\n## Usage\n\n\u003e to get more information use `DEBUG=run-anything` before starting the process\n\n\u003e programmatic usage of run-anything\n\n```javascript\nconst { Run } = require('run-anything');\n\nconst instance = new Run([{\n  state: {\n    on: 0,\n    color: '#efefef'\n  },\n  name: 'light',\n  commands: {\n    'on': function(socket) {\n      this.state.set('on', 1);\n\n      socket.write('turned light on');\n    },\n    'off': function(socket) {\n      this.state.set('on', 0);\n\n      socket.write('turned light off');\n    },\n    'color [color]': function(socket, color) {\n      this.state.set('color', color);\n\n      socket.write(`changed color of light to ${color}`)\n    }\n  }\n}]);\n\ninstance.start((server) =\u003e {\n  console.log(`run-anything running at port ${instance.port}`)\n\n  process.on('exit', () =\u003e {\n    instance.close();\n  });\n});\n```\n\n\u003e running run-anything as a binary\n\n```\nUsage: run-anything [options]\n\nCommand:\n  -h, --help, help     outputs this screen and exists the process\n\nOptions:\n  -p, --port [port]     overrides the randomized port for serving application\n  -c, --config [path]   the config that is to be run\n```\n\nThe config file for `run-anything` would look something like:\n\n```javascript\nmodule.exports = {\n  state: {\n    on: 0,\n    color: '#efefef'\n  },\n  name: 'light',\n  commands: {\n    'on': function(socket) {\n      this.state.set('on', 1);\n\n      socket.write('turned light on');\n    },\n    'off': function(socket) {\n      this.state.set('on', 0);\n\n      socket.write('turned light off');\n    },\n    'color [color]': function(socket, color) {\n      this.state.set('color', color);\n\n      socket.write(`changed color of light to ${color}`)\n    }\n  }\n};\n```\n\n## Direction\n\nWhat if building a IOT device could automatically generate a UI. Where you could ask a device for the functions and state of the device and it would respond with it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielcsapo%2Frun-anything","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielcsapo%2Frun-anything","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielcsapo%2Frun-anything/lists"}