{"id":19529903,"url":"https://github.com/loopmode/xpty","last_synced_at":"2025-04-26T12:30:30.285Z","repository":{"id":36318382,"uuid":"223386129","full_name":"loopmode/xpty","owner":"loopmode","description":"xterm.js and node-pty for react and electron","archived":false,"fork":false,"pushed_at":"2022-02-12T18:50:43.000Z","size":183,"stargazers_count":8,"open_issues_count":7,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T12:22:01.473Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loopmode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-22T11:05:26.000Z","updated_at":"2024-08-01T03:30:01.000Z","dependencies_parsed_at":"2022-08-08T14:02:23.573Z","dependency_job_id":null,"html_url":"https://github.com/loopmode/xpty","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fxpty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fxpty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fxpty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fxpty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loopmode","download_url":"https://codeload.github.com/loopmode/xpty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250746201,"owners_count":21480348,"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":[],"created_at":"2024-11-11T01:28:04.818Z","updated_at":"2025-04-26T12:30:30.008Z","avatar_url":"https://github.com/loopmode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @loopmode/pty\n\nA react component and some helpers for building terminals in electron apps.  \nBased on [`xterm`](https://www.npmjs.com/package/xterm) and [`node-pty`](https://www.npmjs.com/package/node-pty).\n\n## Usage\n\nThere are two parts to this:\n\n1. A child process that is managed by node-pty and\n2. a view that is managed by xterm.\n\n### Creating a child process\n\n```ts\nimport { PtyManager, createCommand } from '@loopmode/xpty';\nconst command = createCommand({\n  cmd: 'ls -lah',\n  cwd: '~'\n});\nconst ptyProcess = PtyManager.connect(command);\n```\n\nIf you do not want to immediatly execute the command, pass `false` as second argument.\n\nThe returned object is an [`pty.IPty`](https://github.com/microsoft/node-pty/blob/master/typings/node-pty.d.ts#L108) instance.\n\n### Rendering a view\n\nBasically, you render the `XTerminal` component and pass a `ptyProcess` prop to it.\n\n```tsx\nimport React from 'react';\nimport { XTerminal } from '@loopmode/xpty';\n\nexport const Example = ({ ptyProcess }) =\u003e {\n  return (\n    \u003cXTerminal ptyProcess={ptyProcess}\u003e\n  )\n}\n```\n\n### TODO\n\n- hook, e.g. `usePty`, to get a `ptyProcess` easily\n- docs for existing features and props\n- more features and props\n- tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopmode%2Fxpty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floopmode%2Fxpty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopmode%2Fxpty/lists"}