Skip to content

Commit cf7cbad

Browse files
timmydozaAaron Alaniz
andauthored
Initial PR (#1)
* Initial commit * Initial commit * Move helpers folder * Revert "Move helpers folder" This reverts commit d37d82b. * Update package name * Add error codes to function * Fix bugs * Update some copy * Update function responses * Update function responses * Fix json response in function * Apply PR feedback * Rename token server again * Rename destroy to delete-app * Add delete-app * More changes * Fix asset issue * Copy update * Add getPin test * Add default Circle CI node config * Trigger build * Add deps to fix cli errors with brew * Fix Object.assign issues * Delete refresh command * Remove code for refreshing passcodes * Deploy-app will redeploy app if one already exists * Remove unused variable * Update package-lock * Install jest * Add some tests for helpers * Add tests for video-token-server * Add e2e tests * Fix some things * Add --override flag to deploy-app command * AHOYAPPS-426 Add command documentation (#4) * Add command documentation * Add override example * Fix typo * Fix copy * Add prettier and husky * Run prettier * Remove static class properties * Add more unit tests * Add e2e test * Add eslint * Fix tests * Fix tests * Update command usage * Add error messages to token server * Completely redo e2e tests * Update some tests * Update error codes * Remove newlines * Update lint script * Rename commands * Add function to validate app-directory * Add tests for app-directory validation * Remove .only from test * Fix e2e test * Add readme (#5) * Get started on readme * Make override flag optional * Update readme sections * Update readme with new commands * Add VS code rulers * Address feedback Co-authored-by: Aaron Alaniz <aalaniz@twilio.com> * Use readdirSync in verifyAppDirectory Co-authored-by: Aaron Alaniz <aalaniz@twilio.com>
1 parent 64f0ba9 commit cf7cbad

File tree

23 files changed

+18272
-104
lines changed

23 files changed

+18272
-104
lines changed

.circleci/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2.1
2+
orbs:
3+
node: circleci/node@1.1.6
4+
jobs:
5+
build-and-test:
6+
executor:
7+
name: node/default
8+
steps:
9+
- checkout
10+
- node/with-cache:
11+
steps:
12+
- run: npm install
13+
- run: npm test -- -i --verbose
14+
workflows:
15+
build-and-test:
16+
jobs:
17+
- build-and-test

.gitignore

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,2 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
22-
coverage
23-
*.lcov
24-
25-
# nyc test coverage
26-
.nyc_output
27-
28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
33-
34-
# node-waf configuration
35-
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
39-
40-
# Dependency directories
411
node_modules/
42-
jspm_packages/
43-
44-
# TypeScript v1 declaration files
45-
typings/
46-
47-
# TypeScript cache
48-
*.tsbuildinfo
49-
50-
# Optional npm cache directory
51-
.npm
52-
53-
# Optional eslint cache
54-
.eslintcache
55-
56-
# Microbundle cache
57-
.rpt2_cache/
58-
.rts2_cache_cjs/
59-
.rts2_cache_es/
60-
.rts2_cache_umd/
61-
62-
# Optional REPL history
63-
.node_repl_history
64-
65-
# Output of 'npm pack'
66-
*.tgz
67-
68-
# Yarn Integrity file
69-
.yarn-integrity
70-
71-
# dotenv environment variables file
72-
.env
73-
.env.test
74-
75-
# parcel-bundler cache (https://parceljs.org/)
76-
.cache
77-
78-
# Next.js build output
79-
.next
80-
81-
# Nuxt.js build / generate output
82-
.nuxt
83-
dist
84-
85-
# Gatsby files
86-
.cache/
87-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
92-
.vuepress/dist
93-
94-
# Serverless directories
95-
.serverless/
96-
97-
# FuseBox cache
98-
.fusebox/
99-
100-
# DynamoDB Local files
101-
.dynamodb/
102-
103-
# TernJS port file
104-
.tern-port
2+
npm-debug.log*

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
trailingComma: "es5"
2+
singleQuote: true
3+
printWidth: 120

.vscode/launch.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Mocha Tests",
11+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
12+
"args": [
13+
"-u",
14+
"bdd",
15+
"--timeout",
16+
"999999",
17+
"--colors",
18+
"--recursive",
19+
"${workspaceFolder}/test"
20+
],
21+
"internalConsoleOptions": "openOnSessionStart",
22+
"skipFiles": [
23+
"<node_internals>/**"
24+
]
25+
},
26+
]
27+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.rulers": [80]
3+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2020 Twilio Inc.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# @twilio-labs/plugin-rtc
2+
3+
[![CircleCI](https://circleci.com/gh/twilio-labs/plugin-rtc/tree/master.svg?style=svg&circle-token=df6c2750596f1000c1cf13e45dc314e00f0a2204)](https://circleci.com/gh/twilio-labs/plugin-rtc/tree/master)
4+
5+
This plugin adds functionality to the [Twilio CLI](https://github.com/twilio/twilio-cli) which supports developing and deploying real-time communication apps.
6+
7+
* [Getting Started](#getting-started)
8+
* [Supported Apps](#supported-apps)
9+
* [Commands](#commands)
10+
11+
# Getting Started
12+
13+
## Install the Twilio CLI
14+
15+
Via `npm` or `yarn`:
16+
17+
```sh-session
18+
$ npm install -g twilio-cli
19+
$ yarn global add twilio-cli
20+
```
21+
22+
Via `homebrew`:
23+
24+
```sh-session
25+
$ brew tap twilio/brew && brew install twilio
26+
```
27+
28+
See the [Twilio CLI documentation](https://www.twilio.com/docs/twilio-cli/quickstart) for more information.
29+
30+
## Install the plugin
31+
32+
```sh-session
33+
$ twilio plugins:install @twilio-labs/plugin-rtc
34+
```
35+
36+
# Supported Apps
37+
38+
This plugin currently supports the following applications:
39+
40+
## Twilio Video App
41+
A mobile and web collaboration application built with Programmable Video. Visit the projects below for instructions on how to use this plugin to build and deploy the Twilio Video app.
42+
43+
* [React App](https://github.com/twilio/twilio-video-app-react)
44+
* [iOS App](https://github.com/twilio/twilio-video-app-ios)
45+
* [Android App](https://github.com/twilio/twilio-video-app-android)
46+
47+
48+
# Commands
49+
<!-- commands -->
50+
* [`twilio rtc:apps:video:delete`](#twilio-rtcappsvideodelete)
51+
* [`twilio rtc:apps:video:deploy --authentication <auth>`](#twilio-rtcappsvideodeploy---authentication-auth)
52+
* [`twilio rtc:apps:video:view`](#twilio-rtcappsvideoview)
53+
54+
## `twilio rtc:apps:video:delete`
55+
56+
Delete a Programmable Video app
57+
58+
```
59+
USAGE
60+
$ twilio rtc:apps:video:delete
61+
62+
OPTIONS
63+
-l=(debug|info|warn|error|none) [default: info] Level of logging messages.
64+
-o=(columns|json|tsv) [default: columns] Format of command output.
65+
-p, --profile=profile Shorthand identifier for your profile.
66+
67+
EXAMPLE
68+
$ twilio rtc:apps:video:delete
69+
Removed app with Passcode: 1111111111
70+
```
71+
72+
## `twilio rtc:apps:video:deploy --authentication <auth>`
73+
74+
Deploy a Programmable Video app
75+
76+
```
77+
USAGE
78+
$ twilio rtc:apps:video:deploy --authentication <auth>
79+
80+
OPTIONS
81+
-l=(debug|info|warn|error|none) [default: info] Level of logging messages.
82+
-o=(columns|json|tsv) [default: columns] Format of command output.
83+
-p, --profile=profile Shorthand identifier for your profile.
84+
--app-directory=app-directory Name of app directory to use
85+
--authentication=(passcode) (required) Type of authentication to use
86+
--override Override an existing App deployment
87+
88+
DESCRIPTION
89+
This command publishes two components as a Twilio Function: an application token
90+
server and an optional React application.
91+
92+
Token Server
93+
The token server provides Programmable Video access tokens and authorizes
94+
requests with the specified authentication mechanism.
95+
96+
React Application
97+
The commands includes support for publishing a Programmable Video React
98+
Application. For more details using this plugin with the Programmable Video
99+
React application, please visit the project's home page.
100+
https://github.com/twilio/twilio-video-app-react
101+
102+
EXAMPLES
103+
# Deploy an application token server with passcode authentication
104+
$ twilio rtc:apps:video:deploy --authentication passcode
105+
deploying app... done
106+
Passcode: 1111111111
107+
108+
# Deploy an application token server with the React app
109+
$ twilio rtc:apps:video:deploy --authentication passcode --app-directory /path/to/app
110+
deploying app... done
111+
Web App URL: https://video-app-1111-dev.twil.io?passcode=1111111111
112+
Passcode: 1111111111
113+
114+
# Override an existing app with a fresh deployment
115+
# Please note that this will remove a previously deployed web application if no
116+
# app directory is provided
117+
$ twilio rtc:apps:video:deploy --authentication passcode --override
118+
Removed app with Passcode: 1111111111
119+
deploying app... done
120+
Passcode: 2222222222
121+
Expires: Mon Mar 09 2020 16:36:23 GMT-0600
122+
```
123+
124+
## `twilio rtc:apps:video:view`
125+
126+
View a Programmable Video app
127+
128+
```
129+
USAGE
130+
$ twilio rtc:apps:video:view
131+
132+
OPTIONS
133+
-l=(debug|info|warn|error|none) [default: info] Level of logging messages.
134+
-o=(columns|json|tsv) [default: columns] Format of command output.
135+
-p, --profile=profile Shorthand identifier for your profile.
136+
137+
EXAMPLE
138+
$ twilio rtc:apps:video:view
139+
Web App URL: https://video-app-1111-dev.twil.io?passcode=1111111111
140+
Passcode: 1111111111
141+
```
142+
<!-- commandsstop -->

bin/run

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env node
2+
// Load up the command module *first* so that we're the parent rather than
3+
// some other dependency.
4+
const command = require('@oclif/command');
5+
6+
require('@twilio/cli-core').configureEnv();
7+
command.run()
8+
.then(require('@oclif/command/flush'))
9+
.catch(require('@oclif/errors/handle'));

bin/run.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*

jest.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// Automatically clear mock calls and instances between every test
6+
clearMocks: true,
7+
8+
// The directory where Jest should output its coverage files
9+
coverageDirectory: 'coverage',
10+
11+
// The paths to modules that run some code to configure or set up the testing environment before each test
12+
setupFiles: ['./test/setupTests.js'],
13+
14+
// The test environment that will be used for testing
15+
testEnvironment: 'node'
16+
};

0 commit comments

Comments
 (0)