UNPKG

4.83 kBMarkdownView Raw
1# React Transcript Editor
2
3<!-- _One liner_ -->
4A React component to make transcribing audio and video easier and faster.
5
6[![install size](https://packagephobia.now.sh/badge?p=@bbc/react-transcript-editor)](https://packagephobia.now.sh/result?p=@bbc/react-transcript-editor)
7
8_--> Work in progress <--_
9
10<!-- _Screenshot of UI - optional_ -->
11
12## Development env
13
14 <!-- _How to run the development environment_ -->
15
16- npm > `6.1.0`
17- [Node 10 - dubnium](https://scotch.io/tutorials/whats-new-in-node-10-dubnium)
18
19Node version is set in node version manager [`.nvmrc`](https://github.com/creationix/nvm#nvmrc)
20
21<!-- _Coding style convention ref optional, eg which linter to use_ -->
22
23<!-- _Linting, github pre-push hook - optional_ -->
24
25
26## Setup
27
28<!-- _stack - optional_ -->
29<!-- _How to build and run the code/app_ -->
30
31Fork this repository + git clone + cd into folder
32
33## Usage - development
34
35<!-- git clone git@github.com:bbc/react-transcript-editor.git -->
36
37> To start the development server (with entry point `src/index.js`), run
38
39```
40npm start
41```
42
43Visit [http://localhost:3006](http://localhost:3006)
44
45
46## Usage - production
47
48<!-- npm install react-transcript-editor -->
49
50<!-- exampel usage - require etc.. -->
51<!-- https://www.npmjs.com/package/@bbc/react-transcript-editor -->
52
53Available on [npm - `@bbc/react-transcript-editor`](https://www.npmjs.com/package/@bbc/react-transcript-editor)
54
55```
56npm install @bbc/react-transcript-editor
57```
58
59```js
60import { TranscriptEditor } from '@bbc/react-transcript-editor';
61
62<TranscriptEditor
63 transcriptData=// Transcript json
64 mediaUrl=// string url to media file - audio or video
65 isEditable={true}// se to true if you want to be able to edit the text
66 sttJsonType={ 'bbcKaldi' }// the type of STT Json transcript supported.
67/>
68```
69
70## System Architecture
71
72<!-- _High level overview of system architecture_ -->
73
74uses [`create-component-lib`](https://www.npmjs.com/package/create-component-lib) as explaied in this [blog post](https://hackernoon.com/creating-a-library-of-react-components-using-create-react-app-without-ejecting-d182df690c6b) to setup the environment to develop this React.
75
76This uses [Create React App 2.0](https://reactjs.org/blog/2018/10/01/create-react-app-v2.html) so we are using [CSS Modules](https://github.com/css-modules/css-modules) to contain the scope of the css for this component.
77<!--
78Uses CSS grid-layout https://medium.com/samsung-internet-dev/common-responsive-layouts-with-css-grid-and-some-without-245a862f48df -->
79
80> Place everything you want to publish to npm inside `src/lib`.
81
82> Outside `src/lib` (but inside src/), you can create example web pages to test or demonstrate the usage of your components.
83
84## Documentation
85
86There's a [docs](./docs) folder in this repository.
87
88[docs/notes](./docs/notes) contains dev notes on various aspects of the project.
89
90[docs/adr](./docs/adr) contains [Architecture Decision Record](https://github.com/joelparkerhenderson/architecture_decision_record).
91
92> An architectural decision record (ADR) is a document that captures an important architectural decision made along with its context and consequences.
93
94We are using [this template for ADR](https://gist.github.com/iaincollins/92923cc2c309c2751aea6f1b34b31d95)
95
96
97## Build
98
99<!-- _How to run build_ -->
100
101> To transpile `src/lib` and create a build in the dist folder, run:
102
103```
104npm run build:component
105```
106
107## Demo
108
109Demo can be viewed at [https://bbc.github.io/react-transcript-editor](https://bbc.github.io/react-transcript-editor)
110
111<!-- https://github.com/gitname/react-gh-pages
112-->
113
114
115## build - demo
116
117This github repository uses [github pages](https://pages.github.com/) to host a demo of the component, in [docs/demo](./docs/demo)
118
119```
120npm run deploy:ghpages
121```
122
123add to git, and push to origin master to update
124
125<!-- https://help.github.com/articles/user-organization-and-project-pages/#project-pages-sites -->
126
127Alternatively If you simply want to build the demo locally in the `build` folder then just
128
129```
130npm run build:example
131```
132
133## Tests
134
135<!-- _How to carry out tests_ -->
136
137Test coverage using [`jest`](https://jestjs.io/), to run tests
138
139 ```
140 npm run test
141 ```
142
143## Deployment
144
145<!-- _How to deploy the code/app into test/staging/production_ -->
146
147To push to [npm - `@bbc/react-transcript-editor`](https://www.npmjs.com/package/@bbc/react-transcript-editor)
148
149```
150npm publish:public
151```
152
153This runs `npm run build:component` and `npm publish --access public` under the hood
154
155> Note that only `README.md` and the `dist` folders are published to npm.
156
157
158## Contributing
159
160<!-- Contributing guidance, and link to contributing code of conduct -->
161
162## Licence
163
164<!-- mention MIT Licence -->
165
166
167<!-- ## Legal Disclaimer
168
169Despite using React and Draftjs, the BBC is not promoting any FB product or other commercial interest. -->
170
\No newline at end of file