Skip to content

Commit

Permalink
Initial OSS commit
Browse files Browse the repository at this point in the history
  • Loading branch information
liberty-rowland committed May 16, 2019
0 parents commit cbc566c
Show file tree
Hide file tree
Showing 185 changed files with 39,314 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"plugins": ["transform-class-properties"]
}
108 changes: 108 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
root: true

env:
es6: true
node: true
browser: true

extends:
'eslint:recommended'

parser:
babel-eslint

plugins:
- babel

globals:
Map: true
Set: true
Promise: true
Uint8Array: true
Symbol: true
webkitAudioContext: true

rules:
array-bracket-spacing: 2
babel/new-cap: 2
babel/object-curly-spacing: [2, always]
babel/no-invalid-this: 2
babel/semi: 2
block-spacing: 2
callback-return: 2
camelcase: 2
comma-spacing: 2
comma-style: [2, last]
computed-property-spacing: 2
consistent-return: 2
consistent-this: [2, self]
dot-location: [2, property]
dot-notation: 2
eol-last: 2
eqeqeq: 2
func-style: [2, declaration]
handle-callback-err: 2
key-spacing: 2
linebreak-style: [2, unix]
new-cap: 0
new-parens: 2
no-alert: 2
no-caller: 2
no-case-declarations: 0
no-console: 2
no-const-assign: 2
no-else-return: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
no-implicit-coercion: 0
no-implied-eval: 2
no-invalid-this: 0
no-iterator: 2
no-labels: 2
no-lone-blocks: 2
no-lonely-if: 2
no-loop-func: 2
no-multiple-empty-lines: 2
no-nested-ternary: 0
no-new-object: 2
no-new-require: 2
no-path-concat: 2
no-process-env: 2
no-process-exit: 2
no-proto: 2
no-return-assign: 2
no-shadow: 2
no-shadow-restricted-names: 2
no-script-url: 2
no-self-compare: 2
no-sequences: 2
no-spaced-func: 2
no-throw-literal: 2
no-trailing-spaces: 2
no-undef-init: 2
no-undefined: 2
no-unneeded-ternary: 2
no-unused-expressions: 2
no-use-before-define: [2, nofunc]
no-useless-call: 2
no-useless-concat: 2
no-warning-comments: 1
no-with: 1
object-curly-spacing: 0
one-var: [2, never]
operator-assignment: [2, always]
quote-props: [2, as-needed]
quotes: [2, single]
semi: 0
keyword-spacing: 2
space-before-blocks: [2, always]
space-before-function-paren: [2, {
anonymous: 'never',
named: 'never',
asyncArrow: 'always'
}]
space-infix-ops: 2
space-unary-ops: 2
spaced-comment: 1
strict: [2, global]
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Describe your Pull Request. You may remove some parts that are not applicable. -->

**Contributing to Twilio**

> All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.
- [ ] I acknowledge that all my contributions will be made under the project's license.

## Pull Request Details

### JIRA link(s):

- [CLIENT-0000](https://issues.corp.twilio.com/browse/CLIENT-0000)

### Description

A description of what this PR does.

## Burndown

### Before review
* [ ] Updated CHANGELOG.md if necessary
* [ ] Added unit tests if necessary
* [ ] Updated affected documentation
* [ ] Verified locally with `npm run build:release`
* [ ] Manually sanity tested running locally
* [ ] Ready for review

### Before merge
* [ ] Got one or more +1s
* [ ] Squashed erroneous commits if necessary
* [ ] Re-tested if necessary
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.sw*
.idea
.nyc_output/
config.yaml
coverage
dist
es5
extension/token.js
node_modules
package-lock.json
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.idea
.nyc_output
BUILD.md
build.yaml
config.example.yaml
config.yaml
coverage
docs
extension
lib
node_modules
scripts
server.js
tests
17 changes: 17 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extension": [
".js",
".ts"
],
"include": [
"lib/**/*"
],
"exclude": [
"**/*.d.ts"
],
"reporter": [
"html",
"lcov",
"text"
]
}
54 changes: 54 additions & 0 deletions .release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"type": "JavaScript",
"travis": "pro",
"slug": "twilio/twilio-client.js",
"env": {
"GH_REF": "github.com/twilio/twilio-client.js.git"
},
"plans": {
"release": {
"env": {
"GIT_USER_NAME": "twilio-ci",
"GIT_USER_EMAIL": "[email protected]"
},
"commands": [
"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",
"npm run build:release",
"git add package.json",
"git add -f dist es5",
"git commit -m \"${RELEASE_VERSION}\"",
"git tag ${RELEASE_VERSION}",
"git remote set-url origin \"https://${GH_TOKEN}@${GH_REF}\"",
"git rebase HEAD ${BRANCH}",
"git push origin ${BRANCH} --tags",
"git subtree add --prefix docs origin gh-pages",
"npm run docs:ts",
"git stage docs -f",
"git commit -m \"${RELEASE_VERSION}\"",
"git subtree push --prefix docs origin gh-pages",
"git reset --hard origin/${BRANCH}"
]
},
"development": {
"commands": [
"node ./node_modules/.bin/release --bump ${RELEASE_VERSION} ${DEVELOPMENT_VERSION}",
"git rm -rf dist es5",
"npm run clean",
"npm run docs:clean",
"git add package.json",
"git commit -m \"${DEVELOPMENT_VERSION}\"",
"git push origin ${BRANCH}"
]
},
"publish": {
"commands": [
"git checkout ${RELEASE_VERSION}",
"echo \"//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}\" >~/.npmrc",
"npm publish"
]
}
}
}
65 changes: 65 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# NOTE(mroberts): https://github.com/travis-ci/travis-ci/issues/4704
filter_secrets: false
language: node_js
node_js:
- 8

# https://github.com/travis-ci/travis-ci/issues/8836#issuecomment-356362524
sudo: required

addons:
apt:
packages:
- pulseaudio

env:
global:
- DBUS_SESSION_BUS_ADDRESS=/dev/null
- DISPLAY=:99.0

matrix:
include:
- os: linux
env: BROWSER=chrome BVER=stable

- os: linux
env: BROWSER=chrome BVER=beta

- os: linux
env: BROWSER=chrome BVER=unstable

- os: linux
env: BROWSER=firefox BVER=stable

- os: linux
env: BROWSER=firefox BVER=beta

- os: linux
env: BROWSER=firefox BVER=unstable

allow_failures:
- env: BROWSER=chrome BVER=unstable
- env: BROWSER=firefox BVER=stable
- env: BROWSER=firefox BVER=beta
- env: BROWSER=firefox BVER=unstable
- env: BROWSER=safari BVER=unstable

before_script:
- |
set -e
cd node_modules/travis-multirunner
if [ "${TRAVIS_OS_NAME}" == 'linux' ]; then
BROWSER=chrome ./setup.sh
BROWSER=firefox ./setup.sh
export CHROME_BIN=$(pwd)/browsers/bin/chrome-$BVER
export FIREFOX_BIN=$(pwd)/browsers/bin/firefox-$BVER
else
BROWSER=safari ./setup.sh
fi
cd ../..
if [ "${TRAVIS_OS_NAME}" == 'linux' ]; then
sh -e /etc/init.d/xvfb start
pulseaudio --start
fi
script: npm run build:release
76 changes: 76 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
How to build
=========

To build JavaScript SDK, you can simply run:

$ npm run build

The build will be in `dist/`. You can serve it by

$ npm start

Building and running the extension
---------------------

To build the extension, run `npm run extension`. This will copy your `config.yaml` into
a browserified `token.js` file.

Then, to run the extension, load `chrome://extension`, hit "Load unpacked extension..." and
select the `/extension` folder.

Running Selenium
----------------

Selenium needs valid credentials to run, so first you'll want to copy over
the example config file and update it with your credentials:

$ cp config.example.yaml config.yaml
$ vim config.yaml

Next, make sure you've built any changes you've made, as selenium uses the dist folder:

$ npm run build

Then, the suite can be run via the command:

$ npm run test:selenium

Generating Coverage report
--------------------------

The Coverage report is generated by NYC and Mocha. Follow the instructions:

$ npm run coverage

The output will be in coverage. Open the index.html file in browser.

Contributing
------------

Long story short: use spaces to indent, indent with 2 spaces.

1. Use this modeline in vim: et ts=2 sw=2 sta.
1. JavaScript indenting in vim is pretty bad, but there is a vim script that helps:
http://www.vim.org/scripts/script.php?script_id=3081.

Deployment
---

Make sure to increase patch version number in `package.json`.

Twilio client is hosted on CDN. Please check out [https://code.hq.twilio.com/client/sdk-release-tool](https://code.hq.twilio.com/client/sdk-release-tool). To upload to CDN:

./upload twilio-client-js.json 1.4.{patch} ../twiliojs

To pin it, please use:

./pin twilio-client-js.json 1.4.{patch}

Verify by using:

./list twilio-client-js.json

More Information
---

Please see [https://code.hq.twilio.com/client/twiliojs/wiki](https://code.hq.twilio.com/client/twiliojs/wiki).
Loading

0 comments on commit cbc566c

Please sign in to comment.