Skip to content

Commit 6f82b70

Browse files
authored
Merge pull request #131 from w0o/master
chore: Removed dependency and bundling with bower
2 parents 7b4bedc + c4d0f48 commit 6f82b70

32 files changed

+73
-85
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ node_modules/
22
dist/
33
doc/
44
examples/static/watson-speech.js
5-
examples/static/bower_components/
5+
examples/static/scripts/
66
examples/node_modules/
77
examples/static/webpack-bundle.js

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ doc/
99
*-auth.json
1010
.env
1111
examples/static/webpack-bundle.js
12+
examples/static/scripts/
1213
examples/node_modules/
1314
dist/*.js
1415
dist/*.map
15-
examples/static/bower_components/
1616
gh-pages/
1717
.idea

examples/.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/.cfignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
node_modules/
22
keys/
3-
static/bower_components/

examples/bower.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/package-lock.json

Lines changed: 13 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,27 @@
44
"description": "Examples showing the IBM Watson Speech Javascript SDK in action.",
55
"scripts": {
66
"start": "node server.js",
7-
"postinstall": "bower install",
7+
"postinstall": "./scripts/postinstall.sh",
88
"dev": "../scripts/run-dev.sh && node server.js"
99
},
1010
"cacheDirectories": [
11-
"node_modules",
12-
"static/bower_components"
11+
"node_modules"
1312
],
1413
"dependencies": {
15-
"bower": "^1.8.8",
1614
"defaults": "^1.0.3",
1715
"dotenv": "^6.2.0",
1816
"express": "^4.13.3",
1917
"express-browserify": "^1.0.3",
2018
"express-rate-limit": "^2.6.0",
2119
"express-secure-only": "^0.2.1",
20+
"jquery": "^3.4.1",
2221
"object.assign": "^4.0.4",
2322
"vcap_services": "^0.4.0",
2423
"watson-developer-cloud": "3.18.1",
2524
"watson-speech": "*",
2625
"webpack": "^3.5.5",
2726
"webpack-dev-middleware": "^1.10.0",
28-
"whatwg-fetch": "^2.0.2"
27+
"whatwg-fetch": "^3.0.0"
2928
},
3029
"engines": {
3130
"node": ">=4"

examples/readme.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ Prerequisite
1212

1313
* IBM Watson Speech to Text service credentials - see [Service credentials for Watson services](https://www.ibm.com/watson/developercloud/doc/common/getting-started-credentials.html)
1414
* Node.js OR Python
15-
* [Bower](https://bower.io/) for installing client-side dependencies
1615

1716

1817
Setup - Node.js
1918
---------------
2019

21-
1. `cd` into the `examples/` directory and run `npm install` to grab dependencies (this automatically runs `bower install`)
20+
1. `cd` into the `examples/` directory and run `npm install` to grab dependencies (this automatically runs `postinstall` that also puts the dependencies into place)
2221
2. edit `tts-token.js` and `stt-token.js` to include your service credentials (or create a `.env` file)
2322
3. run `npm start`
2423
4. Open your browser to http://localhost:3000/ to see the examples.
@@ -28,7 +27,7 @@ Setup - Python
2827
--------------
2928

3029
1. `cd` into the `examples/` directory and run `pip install watson_developer_cloud flask python-dotenv pyopenssl` (or `easy_install...`) to install python dependencies.
31-
2. run `bower install` to install client-side dependencies
30+
2. run `./scripts/postinstall.sh` to install client-side dependencies
3231
3. edit `server.py` to include your service credentials (or create a `.env` file)
3332
4. run `python server.py`
3433
5. Open your browser to http://localhost:5000/ to see the examples.
@@ -39,7 +38,7 @@ Notes
3938

4039
* The examples all use [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (a modern promise-based replacement for XMLHttpRequest) to retrieve auth tokens. Most supported browsers include a native fetch implementation, but a pollyfill is included in the top-level module for older browsers.
4140
* The examples use a Node.js server to generate tokens. It doesn't have to be written in Node.js, but *some server-side token generator is required*. The SDK will not accept your service credentials directly, and you can not use them to generate a token client-side. SDKs are available for [Node.js](https://github.com/watson-developer-cloud/node-sdk#authorization), [Java](https://github.com/watson-developer-cloud/java-sdk), [Python](https://github.com/watson-developer-cloud/python-sdk/blob/master/examples/authorization_v1.py), and there is a [REST API](https://www.ibm.com/watson/developercloud/doc/common/getting-started-tokens.html) for use with other languages (or `curl`).
42-
* The Speech SDK may be used in browserify, Webpack, or as a standalone library. Most of the examples use the standalone version either installed via bower or symlinked to the root directory when developing locally.
41+
* The Speech SDK may be used in browserify, Webpack, or as a standalone library. Most of the examples use the standalone version either installed via NPM or symlinked to the root directory when developing locally.
4342

4443

4544
More Examples

examples/scripts/postinstall.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
mkdir -p static/scripts/fetch/dist && cp -r node_modules/whatwg-fetch/dist/* "$_"
4+
mkdir -p static/scripts/jquery/dist && cp -r node_modules/jquery/dist/* "$_"
5+
mkdir -p static/scripts/watson-speech && cp -r node_modules/watson-speech/dist "$_"

examples/static/browserify-app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// global window.fetch pollyfill for IE/Edge & Older Chrome/FireFox
66
require('whatwg-fetch');
7+
require('jquery');
78

89
// keep the bundle slim by only requiring the necessary modules
910
var recognizeMicrophone = require('watson-speech/speech-to-text/recognize-microphone');

0 commit comments

Comments
 (0)