Skip to content

Commit

Permalink
VBLOCKS-1716 | Convert JS pipeline to TS (twilio#166)
Browse files Browse the repository at this point in the history
* VBLOCKS-1716 | Convert JS pipeline to TS

* Update CHANGELOG.md
  • Loading branch information
charliesantos authored May 30, 2023
1 parent 1706b94 commit d2b59bc
Show file tree
Hide file tree
Showing 51 changed files with 473 additions and 546 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ commands:
- build
- run:
name: Running build checks
command: npm run test:typecheck && npm run lint && npm run test:unit
command: npm run test:es5 && npm run test:typecheck && npm run lint && npm run test:unit
- store_artifacts:
path: coverage
destination: coverage
Expand Down
108 changes: 0 additions & 108 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ es5
extension/token.js
node_modules
docs
lib/twilio/constants.js
lib/twilio/constants.ts
nodemon.json
tests/webpack/package-lock.json
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
.idea
.nyc_output
BUILD.md
Expand All @@ -9,6 +10,7 @@ docs
extension
lib
node_modules
nodemon.json
scripts
server.js
tests
6 changes: 3 additions & 3 deletions .release.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"node ./node_modules/.bin/release --bump ${CURRENT_VERSION} ${RELEASE_VERSION}",
"git config user.name \"${GIT_USER_NAME}\"",
"git config user.email \"${GIT_USER_EMAIL}\"",
"git rm -rf --ignore-unmatch dist es5 docs lib/twilio/constants.js",
"git rm -rf --ignore-unmatch dist es5 docs lib/twilio/constants.ts",
"npm run build:release",
"git add package.json",
"git add -f dist es5 docs lib/twilio/constants.js",
"git add -f dist es5 docs lib/twilio/constants.ts",
"git commit -nm \"${RELEASE_VERSION}\"",
"git tag ${RELEASE_VERSION}",
"git remote set-url origin \"https://${GH_TOKEN}@${GH_REF}\"",
Expand All @@ -40,7 +40,7 @@
"development": {
"commands": [
"node ./node_modules/.bin/release --bump ${RELEASE_VERSION} ${DEVELOPMENT_VERSION}",
"git rm -rf dist es5 docs lib/twilio/constants.js",
"git rm -rf dist es5 docs lib/twilio/constants.ts",
"npm run clean",
"npm run docs:clean",
"git add package.json",
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.6.0 (In Progress)
===================

Changes (TODO)
-------

2.5.0 (May 9, 2023)
===================

Expand Down
4 changes: 2 additions & 2 deletions karma.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = function(config: any) {
},
files: [
'lib/twilio.ts',
'lib/twilio/**/*.+(ts|js)',
'lib/twilio/**/*.ts',
'tests/integration/*.ts',
],
frameworks: ['mocha', 'karma-typescript'],
Expand Down Expand Up @@ -102,7 +102,7 @@ module.exports = function(config: any) {
logLevel: config.LOG_INFO,
port: 9876,
preprocessors: {
'lib/**/*.+(ts|js)': 'karma-typescript',
'lib/**/*.ts': 'karma-typescript',
'tests/integration/*.ts': 'karma-typescript',
},
reporters: ['spec', 'karma-typescript'],
Expand Down
1 change: 0 additions & 1 deletion lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
$license
*/
/* eslint-disable */
(function(root) {
var bundle = $bundle;
var Voice = bundle($entry);
Expand Down
7 changes: 3 additions & 4 deletions lib/twilio/audiohelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import Device from './device';
import { InvalidArgumentError, NotSupportedError } from './errors';
import Log from './log';
import OutputDeviceCollection from './outputdevicecollection';
import * as getMediaDevicesInstance from './shims/mediadevices';
import MediaDeviceInfoShim from './shims/mediadeviceinfo';
import getMediaDevicesInstance from './shims/mediadevices';
import { average, difference, isFirefox } from './util';

const MediaDeviceInfoShim = require('./shims/mediadeviceinfo');

/**
* Aliases for audio kinds, used for labelling.
* @private
Expand Down Expand Up @@ -177,7 +176,7 @@ class AudioHelper extends EventEmitter {
}, options);

this._getUserMedia = getUserMedia;
this._mediaDevices = options.mediaDevices || getMediaDevicesInstance();
this._mediaDevices = options.mediaDevices || getMediaDevicesInstance() as AudioHelper.MediaDevicesLike;
this._onActiveInputChanged = onActiveInputChanged;
this._enumerateDevices = typeof options.enumerateDevices === 'function'
? options.enumerateDevices
Expand Down
8 changes: 4 additions & 4 deletions lib/twilio/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import {
UserMediaErrors,
} from './errors';
import Log from './log';
import { PeerConnection } from './rtc';
import { IceCandidate, RTCIceCandidate } from './rtc/icecandidate';
import RTCSample from './rtc/sample';
import { getPreferredCodecInfo } from './rtc/sdp';
import RTCWarning from './rtc/warning';
import StatsMonitor from './statsMonitor';
import { isChrome } from './util';
import { generateVoiceEventSid } from './uuid';

const Backoff = require('backoff');
const C = require('./constants');
const { PeerConnection } = require('./rtc');
const { getPreferredCodecInfo } = require('./rtc/sdp');
const { RELEASE_VERSION } = require('./constants');

// Placeholders until we convert the respective files to TypeScript.
/**
Expand Down Expand Up @@ -1005,7 +1005,7 @@ class Call extends EventEmitter {
const payload: Partial<Record<string, string|boolean>> = {
call_sid: this.parameters.CallSid,
dscp: !!this._options.dscp,
sdk_version: C.RELEASE_VERSION,
sdk_version: RELEASE_VERSION,
};

if (this._options.gateway) {
Expand Down
13 changes: 6 additions & 7 deletions lib/twilio/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { EventEmitter } from 'events';
import { levels as LogLevels, LogLevelDesc } from 'loglevel';
import AudioHelper from './audiohelper';
import Call from './call';
import * as C from './constants';
import DialtonePlayer from './dialtonePlayer';
import {
AuthorizationErrors,
Expand All @@ -20,8 +21,10 @@ import {
NotSupportedError,
TwilioError,
} from './errors';
import Publisher from './eventpublisher';
import Log from './log';
import { PreflightTest } from './preflight/preflight';
import PStream from './pstream';
import {
createEventGatewayURI,
createSignalingEndpointURL,
Expand All @@ -31,20 +34,16 @@ import {
Region,
regionToEdge,
} from './regions';
import * as rtc from './rtc';
import getUserMedia from './rtc/getusermedia';
import Sound from './sound';
import {
isLegacyEdge,
isUnifiedPlanDefault,
queryToJson,
} from './util';
import { generateVoiceEventSid } from './uuid';

const C = require('./constants');
const Publisher = require('./eventpublisher');
const PStream = require('./pstream');
const rtc = require('./rtc');
const getUserMedia = require('./rtc/getusermedia');
const Sound = require('./sound');

// Placeholders until we convert the respective files to TypeScript.
/**
* @private
Expand Down
Loading

0 comments on commit d2b59bc

Please sign in to comment.