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' ;
41import { decorateSelector } from '../utils/decorate-selector' ;
2+ import { ReactTemplate } from './helpers/react-template' ;
3+
4+ import configurations from './configuration' ;
55
6- export default new Template (
6+ export default new ReactTemplate (
77 'create-react-app-typescript' ,
88 'React + TS' ,
99 'https://github.com/wmonk/create-react-app-typescript' ,
Original file line number Diff line number Diff line change 1- import Template from './template' ;
21import { decorateSelector } from '../utils/decorate-selector' ;
32
43import configurations from './configuration' ;
4+ import { ReactTemplate } from './helpers/react-template' ;
55
6- export default new Template (
6+ export default new ReactTemplate (
77 'create-react-app' ,
88 'React' ,
99 '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[] = [
6969 } ,
7070] ;
7171
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-
7872const SERVER_VIEWS : ViewConfig [ ] = [
7973 {
8074 views : [ { id : 'codesandbox.browser' } ] ,
@@ -206,16 +200,6 @@ export default class Template {
206200 if ( this . isServer ) {
207201 return SERVER_VIEWS ;
208202 }
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-
219203 return CLIENT_VIEWS ;
220204 }
221205
You can’t perform that action at this time.
0 commit comments