Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bower support, clean up readme #882

Merged
merged 6 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ build/

# Directories needed for code coverage
/coverage/

# Keep legacy files out of the repo, this can be removed when we merge v3 into master
dist/
src/utils/TestUtils.ts
src/xterm.js
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true,
"**/build": true,
"**/lib": true
}
}
}
165 changes: 93 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,93 @@ It enables applications to provide fully featured terminals to their users and c
- Xterm.js is not a terminal application that you can download and use on your computer
- Xterm.js is not `bash`. Xterm.js can be connected to processes like `bash` and let you interact with them (provide input, receive output)

## Getting Started

First you need to install the module, we ship exclusively through [npm](https://www.npmjs.com/) so you need that installed and then add xterm.js as a dependency by running:

```
npm install
```

To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to the head of your html page. Then create a `<div id="terminal"></div>` onto which xterm can attach itself.

```html
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<script src="node_modules/xterm/dist/xterm.js"></script>
</head>
<body>
<div id="terminal"></div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \033[1;3;31mxterm.js\033[0m $ ')
</script>
</body>
</html>
```

Finally instantiate the `Terminal` object and then call the `open` function with the DOM object of the `div`.

### Addons

Addons are JavaScript modules that attach functions to the `Terminal` prototype to extend its functionality. There are a handful available in the main repository in the `dist/addons` directory, you can even write your own (though they may break when the internals of xterm.js change across versions).

To use an addon, just include the JavaScript file after xterm.js and before the `Terminal` object has been instantiated. The function should then be exposed on the `Terminal` object:

```html
<script src="node_modules/xterm/dist/xterm.js"></script>
<script src="node_modules/xterm/dist/addons/fit/fit.js"></script>
```

```js
// Instantiate the terminal and call fit
var xterm = new Terminal();
xterm.fit();
```

### Importing

If the environment allows it, you can import xterm.js like so:

```ts
// CommonJS
var Terminal = require('xterm').Terminal;

// ES6 / TypeScript
import { Terminal } from 'xterm';
```

Importing addons in this environment can be done using a `Terminal.loadAddon` call:

```ts
import { Terminal } from 'xterm';

// Notice it's called statically on the type, not an object
Terminal.loadAddon('fit');

// Instantiate the terminal and call fit
var xterm = new Terminal();
xterm.fit();
```

*Note: There are currently no typings for addons so you will need to upcast if using TypeScript, eg. `(<any>xterm).fit()`*

## Browser Support

Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Here is a list of the versions we aim to support:

- Chrome 48+
- Edge 13+
- Firefox 44+
- Internet Explorer 11+
- Opera 35+
- Safari 8+

Xterm.js works seamlessly in Electron apps and may even work on earlier versions of the browsers but these are the browsers we strive to keep working.

## Real-world uses
Xterm.js is used in several world-class applications to provide great terminal experiences.

Expand Down Expand Up @@ -46,30 +133,15 @@ computational environment for Jupyter, supporting interactive data science and s

Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it in our list.

## Browser Support

Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Here is a list of the versions we aim to support:

- Chrome 48+
- Edge 13+
- Firefox 44+
- Internet Explorer 11+
- Opera 35+
- Safari 8+

Xterm.js works seamlessly in Electron apps and may even work on earlier versions of the browsers but these are the browsers we strive to keep working.

## Demo

### Linux or macOS

First, be sure that a C++ compiler such as GCC-C++ or Clang is installed

Then run the following commands:
First, be sure that a C++ compiler such as GCC-C++ or Clang is installed, then run these commands:

```
$ npm install
$ npm start
npm install
npm start
```

Then open http://0.0.0.0:3000 in a web browser.
Expand All @@ -78,65 +150,14 @@ Then open http://0.0.0.0:3000 in a web browser.

First, ensure [node-gyp](https://github.com/nodejs/node-gyp) is installed and configured correctly, then run these commands.

Note: Do not use ConEmu, as it seems to break the demo for some reason.

```
> npm install
> npm start
npm install
npm start
```

Then open http://127.0.0.1:3000 in a web browser.

## Getting Started

To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to the head of your html page. Then create a `<div id="terminal"></div>` onto which xterm can attach itself.
```html
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="bower_components/xterm.js/dist/xterm.css" />
<script src="bower_components/xterm.js/dist/xterm.js"></script>
</head>
<body>
<div id="terminal"></div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \033[1;3;31mxterm.js\033[0m $ ')
</script>
</body>
</html>
```
Finally instantiate the `Terminal` object and then call the `open` function with the DOM object of the `div`.

## Addons

Addons are JavaScript modules that attach functions to the `Terminal` prototype to extend its functionality. There are a handful available in the main repository in the `dist/addons` directory, you can even write your own (though they may break when the internals of xterm.js change across versions).

To use an addon, just include the JavaScript file after xterm.js and before the `Terminal` object has been instantiated. The function should then be exposed on the `Terminal` object:

```html
<script src="node_modules/dist/xterm.js"></script>
<script src="node_modules/dist/addons/fit/fit.js"></script>
```

```js
var xterm = new Terminal();
// init code...
xterm.fit();
```

## CommonJS

Importing xterm.js in a CommonJS environment (eg. [Electron](https://electron.atom.io/)) can be done like so:

```ts
// JavaScript
var Terminal = require('xterm').Terminal;

// TypeScript
import { Terminal } from 'xterm';
```
*Note: Do not use ConEmu, as it seems to break the demo for some reason.*

## Releases

Expand Down
9 changes: 1 addition & 8 deletions bin/prepare-release
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ CURRENT_PACKAGE_JSON_VERSION=$(cat package.json \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
CURRENT_BOWER_JSON_VERSION=$(cat bower.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')

# Build xterm.js into `dist`
export BUILD_DIR=dist
Expand All @@ -26,9 +20,8 @@ npm run build
# Update AUTHORS file
sh bin/generate-authors

# Update version in package.json and bower.json
# Update version in package.json
sed -i "s/\"version\": \"$CURRENT_PACKAGE_JSON_VERSION\"/\"version\": \"$NEW_VERSION\"/g" package.json
sed -i "s/\"version\": \"$CURRENT_BOWER_JSON_VERSION\"/\"version\": \"$NEW_VERSION\"/g" bower.json

git commit -S -s -a -m "Bump version to $NEW_VERSION"
git tag $NEW_VERSION
9 changes: 0 additions & 9 deletions bower.json

This file was deleted.

126 changes: 0 additions & 126 deletions dist/addons/attach/attach.js

This file was deleted.

Loading