Skip to content

Refactor code to typscript #256

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

Merged
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
20 changes: 12 additions & 8 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
node_modules
bower_components
.github
.travis
dist
coverage
.nyc_output
samples
node_modules/
bower_components/
.github/
.travis/
dist/
browser-dist/
coverage/
.nyc_output/
samples/
lib/API.js
test/
src/typings/obsWebsocket.ts
scripts/

# Adding an exclusion for the webpack config to make node 4 travis builds easier.
webpack.config.js
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser",
"env": {
"es2021": true,
"node": true
},
"extends": [
"xo",
"xo-typescript/space"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-implicit-any-catch": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off"
}
}
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# we may need this, not sure
# - run: npm install json -g
- run: npm ci
- run: npm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm test
# Currently broken
#- run: npm run node-coveralls
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ coverage

# Exclude build outputs (they'll get added automatically by CI).
dist
browser-dist
types/index.d.ts
CHANGELOG.md
31 changes: 0 additions & 31 deletions .travis/tsconfig.json

This file was deleted.

17 changes: 0 additions & 17 deletions .travis/tslint.json

This file was deleted.

14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ OBSWebSocket.JS allows Javascript-based connections to the Open Broadcaster plug
## Installation

```sh
# with npm
npm install obs-websocket-js --save

# with yarn
yarn add obs-websocket-js

# with bower
bower install obs-websocket-js --save
```

Expand All @@ -46,7 +51,7 @@ The web distributable exposes a global named `OBSWebSocket`.
In node...

```js
const OBSWebSocket = require('obs-websocket-js');
const { OBSWebSocket } = require('obs-websocket-js');
```

Create a new WebSocket connection using the following.
Expand All @@ -69,9 +74,6 @@ _Note that all response objects will supply both the original [obs-websocket][li
// Promise API
obs.send('RequestName', {args}) // returns Promise

// Callback API
obs.sendCallback('RequestName', {args}, callback(err, data)) // no return value

// The following are additional supported requests.
obs.connect({ address: 'address', password: 'password' }) // returns Promise
obs.disconnect();
Expand Down Expand Up @@ -112,7 +114,7 @@ obs.on('error', err => {
#### Example
See more examples in [`\samples`](samples).
```js
const OBSWebSocket = require('obs-websocket-js');
const { OBSWebSocket } = require('obs-websocket-js');

const obs = new OBSWebSocket();
obs.connect({
Expand Down Expand Up @@ -205,7 +207,7 @@ obs.on('SwitchScenes');
});

// Use this instead:
obs.sendCallback('StartStreaming', (error) => {
obs.send('StartStreaming').catch(error => {
// Code here...
});
```
Expand Down
179 changes: 0 additions & 179 deletions lib/Socket.js

This file was deleted.

Loading