A very thin wrapper around PTYs and processes.
npm install @replit/ruspty@replit/ruspty - PTY for JavaScript through Rust FFIA very thin wrapper around PTYs and processes.
``ts
const { Pty } = require('@replit/ruspty');
const pty = new Pty({
command: '/bin/sh',
args: [],
envs: {},
size: { rows: 24, cols: 80 },
onExit: (...result) => {
// TODO: Handle process exit.
},
});
const read = pty.read;
const write = pty.write;
read.on('data', (chunk) => {
// TODO: Handle data.
});
write.write('echo hello\n');
`
- npm installnpm run build
- npm run test
-
Following "Publish It" section from napi-rs docs:
1. git clean -f && npm install && npm run buildnpm version [major|minor|patch]
2. x.y.z
3. Send that as a Pull Request to GitHub. Ensure that the commit message consisting only of - this is how the CI decides to publish to npm!
NPM_TOKEN` is part of the repo secrets, generated like this.