File tree Expand file tree Collapse file tree 4 files changed +27
-22
lines changed
packages/common/src/templates Expand file tree Collapse file tree 4 files changed +27
-22
lines changed Original file line number Diff line number Diff line change
1
+ import Template , { ViewConfig } from '../template' ;
2
+
3
+ export class ReactTemplate extends Template {
4
+ getViews ( ) : ViewConfig [ ] {
5
+ const REACT_VIEWS : ViewConfig [ ] = [
6
+ {
7
+ views : [ { id : 'codesandbox.browser' } , { id : 'codesandbox.tests' } ] ,
8
+ } ,
9
+ {
10
+ open : true ,
11
+ views : [
12
+ { id : 'codesandbox.console' } ,
13
+ { id : 'codesandbox.problems' } ,
14
+ { id : 'codesandbox.react-devtools' } ,
15
+ ] ,
16
+ } ,
17
+ ] ;
18
+
19
+ return REACT_VIEWS ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change 1
- import configurations from './configuration' ;
2
-
3
- import Template from './template' ;
4
1
import { decorateSelector } from '../utils/decorate-selector' ;
2
+ import { ReactTemplate } from './helpers/react-template' ;
3
+
4
+ import configurations from './configuration' ;
5
5
6
- export default new Template (
6
+ export default new ReactTemplate (
7
7
'create-react-app-typescript' ,
8
8
'React + TS' ,
9
9
'https://github.com/wmonk/create-react-app-typescript' ,
Original file line number Diff line number Diff line change 1
- import Template from './template' ;
2
1
import { decorateSelector } from '../utils/decorate-selector' ;
3
2
4
3
import configurations from './configuration' ;
4
+ import { ReactTemplate } from './helpers/react-template' ;
5
5
6
- export default new Template (
6
+ export default new ReactTemplate (
7
7
'create-react-app' ,
8
8
'React' ,
9
9
'https://github.com/facebookincubator/create-react-app' ,
Original file line number Diff line number Diff line change @@ -69,12 +69,6 @@ const CLIENT_VIEWS: ViewConfig[] = [
69
69
} ,
70
70
] ;
71
71
72
- // React sandboxes have an additional devtool on top of CLIENT_VIEWS
73
- const REACT_CLIENT_VIEWS : ViewConfig [ ] = JSON . parse (
74
- JSON . stringify ( CLIENT_VIEWS )
75
- ) ;
76
- REACT_CLIENT_VIEWS [ 1 ] . views . push ( { id : 'codesandbox.react-devtools' } ) ;
77
-
78
72
const SERVER_VIEWS : ViewConfig [ ] = [
79
73
{
80
74
views : [ { id : 'codesandbox.browser' } ] ,
@@ -206,16 +200,6 @@ export default class Template {
206
200
if ( this . isServer ) {
207
201
return SERVER_VIEWS ;
208
202
}
209
-
210
- const dependencies =
211
- configurationFiles . package &&
212
- configurationFiles . package . parsed &&
213
- configurationFiles . package . parsed . dependencies ;
214
-
215
- if ( dependencies && dependencies . react ) {
216
- return REACT_CLIENT_VIEWS ;
217
- }
218
-
219
203
return CLIENT_VIEWS ;
220
204
}
221
205
You can’t perform that action at this time.
0 commit comments