diff --git a/node-test/README.md b/node-test/README.md new file mode 100644 index 00000000..e4cf19b0 --- /dev/null +++ b/node-test/README.md @@ -0,0 +1,10 @@ +Cursory test that 'xterm-core' works: + +``` +# From root of this repo +npm run compile # Outputs to xterm-core +npx webpack --config core-webpack.config.js # Outputs to lib +cd node-test +npm link ../lib/ +node index.js +``` \ No newline at end of file diff --git a/node-test/index.js b/node-test/index.js new file mode 100644 index 00000000..19bff5dc --- /dev/null +++ b/node-test/index.js @@ -0,0 +1,12 @@ +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); +const xterm = require('xterm-core'); + +console.log('Creating xterm-core terminal...'); +const terminal = new xterm.Terminal(); +console.log('Writing `ls` to terminal...') +terminal.write('ls', () => { + const bufferLine = terminal.buffer.normal.getLine(terminal.buffer.normal.cursorY); + const contents = bufferLine.translateToString(); + console.log(`Contents of terminal active buffer are: ${contents}`); // ls +}); diff --git a/node-test/package.json b/node-test/package.json new file mode 100644 index 00000000..93549623 --- /dev/null +++ b/node-test/package.json @@ -0,0 +1,11 @@ +{ + "name": "test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "" +}