Skip to content

Commit

Permalink
Added cra-template-speechly to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
arzga committed Nov 4, 2021
1 parent d1695d0 commit 1de19c3
Show file tree
Hide file tree
Showing 31 changed files with 4,216 additions and 479 deletions.
4,178 changes: 3,699 additions & 479 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions examples/cra-template-speechly/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# cra-template-speechly

[Create React App](https://github.com/facebook/create-react-app) template with [Speechly](https://speechly.com/) support. Use this to start building webs apps with voice control. Comes with the following packages and a simple sample app:

* [Speechly React Client](https://www.npmjs.com/package/@speechly/react-client)
* [Speechly React UI](https://www.npmjs.com/package/@speechly/react-ui)
* [Typescript](https://www.typescriptlang.org/)

## Tested with

* [Node](https://nodejs.org/) v14.16.1

## Usage

To use this template within your project, add `--template speechly` when creating a new app.

For example:

```sh
npx create-react-app my-app --template speechly

# or

yarn create react-app my-app --template speechly
```

### Learn more

* [Speechly](https://speechly.com/) voice input API
* [Speechly React client basic usage](https://docs.speechly.com/client-libraries/usage/?platform=React)
* [Speechly Voice Form Components for React](https://www.npmjs.com/package/@speechly/react-voice-forms)
71 changes: 71 additions & 0 deletions examples/cra-template-speechly/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "cra-template-speechly",
"version": "1.0.1",
"scripts": {
"build": "",
"format": "prettier --write ./template/src/**/*.{ts,tsx,css}",
"lint": "eslint './template/src/**/*.{ts,tsx}'",
"test": "jest",
"type-check": "tsc"
},
"keywords": [
"react",
"create-react-app",
"template",
"typescript",
"voice",
"speech",
"slu",
"spoken language understanding",
"speechly",
"asr",
"nlp",
"natural language processing",
"nlu",
"natural language understanding",
"natural language",
"vui",
"voice ui",
"voice user interface",
"multimodal",
"speech recognition"
],
"description": "Speechly template for Create React App",
"main": "template.json",
"license": "MIT",
"engines": {
"node": ">=8.10"
},
"files": [
"template",
"template.json"
],
"devDependencies": {
"@babel/preset-env": "^7.7.6",
"@babel/preset-react": "^7.7.4",
"@speechly/react-client": "^0.0.21",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.12.28",
"@types/react": ">=16.13.1",
"@types/react-dom": ">=16.13.1",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"eslint": "^6.7.2",
"eslint-config-react-app": "^5.1.0",
"eslint-plugin-flowtype": "^4.5.2",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^2.3.0",
"jest": "^24.9.0",
"prettier": "^2.2.1",
"react": ">=16.13.1",
"react-dom": ">=16.13.1",
"react-scripts": "^4.0.3",
"react-test-renderer": ">=16.13.1",
"typescript": "^4.3.5"
}
}
1 change: 1 addition & 0 deletions examples/cra-template-speechly/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
20 changes: 20 additions & 0 deletions examples/cra-template-speechly/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"package": {
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'"
},
"dependencies": {
"@speechly/react-client": ">=0.0.22",
"@speechly/react-ui": ">=2.1.2",
"@testing-library/react": "^9.3.2",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/user-event": "^7.1.2",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/jest": "^24.0.0",
"source-map-explorer": "^2.5.2",
"typescript": "^4.3.5"
}
}
}
75 changes: 75 additions & 0 deletions examples/cra-template-speechly/template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Speechly](https://speechly.com/).

### Requirements

* [Node](https://nodejs.org/) (tested with v14.16.1)

### Built With

* [Speechly React Client](https://www.npmjs.com/package/@speechly/react-client)
* [Speechly React UI](https://www.npmjs.com/package/@speechly/react-ui)
* [Speechly Voice Forms for React](https://www.npmjs.com/package/@speechly/react-voice-forms)
* [Typescript](https://www.typescriptlang.org/)

Speechly React Client wraps [Speechly Browser Client](https://www.npmjs.com/package/@speechly/react-voice-forms/browser-client) that provides websocket connectivity and audio handling.

## Installation And Running

1. Install NPM packages

```bash
npm install
```

2. Start development server

```bash
npm start
```

Alternatively you can use `pnpm` instead of `npm`.

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

To learn Speechly, check out the [Speechly documentation](https://docs.speechly.com/client-libraries/usage/?platform=React).
Empty file.
23 changes: 23 additions & 0 deletions examples/cra-template-speechly/template/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions examples/cra-template-speechly/template/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="apple-touch-icon" sizes="57x57" href="%PUBLIC_URL%/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="%PUBLIC_URL%/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="%PUBLIC_URL%/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="%PUBLIC_URL%/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="%PUBLIC_URL%/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="%PUBLIC_URL%/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="%PUBLIC_URL%/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="%PUBLIC_URL%/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="%PUBLIC_URL%/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="%PUBLIC_URL%/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Speechly React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
25 changes: 25 additions & 0 deletions examples/cra-template-speechly/template/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "Speechly React App",
"name": "Create Speechly React App Sample",
"icons": [
{
"src": "favicon-16x16.png",
"type": "image/png",
"sizes": "16x16"
},
{
"src": "favicon-32x32.png",
"type": "image/png",
"sizes": "32x32"
},
{
"src": "favicon-96x96.png",
"type": "image/png",
"sizes": "96x96"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions examples/cra-template-speechly/template/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
12 changes: 12 additions & 0 deletions examples/cra-template-speechly/template/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
main {
box-sizing: border-box;
width: 100%;
max-width: 480px;
padding: .5rem;
margin-left: auto;
margin-right: auto;

display: flex;
flex-direction: column;
gap: 1.25rem;
}
19 changes: 19 additions & 0 deletions examples/cra-template-speechly/template/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { PushToTalkButton, BigTranscript, ErrorPanel } from '@speechly/react-ui';
import './App.css';

function App() {
return (
<>
<BigTranscript placement="top" />
<PushToTalkButton placement="bottom" captureKey=" " />
<ErrorPanel placement="bottom" />

<main>
<h1>Speechly React App</h1>
</main>
</>
);
}

export default App;
13 changes: 13 additions & 0 deletions examples/cra-template-speechly/template/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
20 changes: 20 additions & 0 deletions examples/cra-template-speechly/template/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { SpeechProvider } from "@speechly/react-client";
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
<React.StrictMode>
<SpeechProvider appId="YOUR_APP_ID_FROM_SPEECHLY_DASHBOARD">
<App />
</SpeechProvider>
</React.StrictMode>,
document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
Loading

0 comments on commit 1de19c3

Please sign in to comment.