File tree Expand file tree Collapse file tree 6 files changed +75
-33
lines changed
packages/reactant-template/templates/web/javascript/template Expand file tree Collapse file tree 6 files changed +75
-33
lines changed Original file line number Diff line number Diff line change
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.js
7
+
8
+ # testing
9
+ /coverage
10
+
11
+ # production
12
+ /build
13
+
14
+ # misc
15
+ .DS_Store
16
+ .env.local
17
+ .env.development.local
18
+ .env.test.local
19
+ .env.production.local
20
+
21
+ npm-debug.log*
22
+ yarn-debug.log*
23
+ yarn-error.log*
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { render } from 'reactant-web' ;
3
- import {
4
- ViewModule ,
5
- createApp ,
6
- injectable ,
7
- useConnector ,
8
- action ,
9
- state ,
10
- } from 'reactant' ;
11
-
12
- @injectable ( )
13
- class Counter {
14
- @state
15
- count = 0 ;
16
-
17
- @action
18
- increase ( ) {
19
- this . count += 1 ;
20
- }
21
-
22
- @action
23
- decrease ( ) {
24
- this . count -= 1 ;
25
- }
26
- }
2
+ import { ViewModule , injectable , useConnector } from 'reactant' ;
3
+ import { CounterService } from './counter.service' ;
27
4
28
5
@injectable ( {
29
- deps : [ Counter ] ,
6
+ deps : [ CounterService ] ,
30
7
} )
31
8
class AppView extends ViewModule {
32
9
constructor ( counter ) {
@@ -50,9 +27,4 @@ class AppView extends ViewModule {
50
27
}
51
28
}
52
29
53
- const app = createApp ( {
54
- main : AppView ,
55
- render,
56
- } ) ;
57
-
58
- app . bootstrap ( document . getElementById ( 'app' ) ) ;
30
+ export { AppView } ;
Original file line number Diff line number Diff line change
1
+ import { injectable , action , state } from 'reactant' ;
2
+
3
+ @injectable ( )
4
+ class CounterService {
5
+ @state
6
+ count = 0 ;
7
+
8
+ @action
9
+ increase ( ) {
10
+ this . count += 1 ;
11
+ }
12
+
13
+ @action
14
+ decrease ( ) {
15
+ this . count -= 1 ;
16
+ }
17
+ }
18
+
19
+ export { CounterService } ;
Original file line number Diff line number Diff line change
1
+ import { testBed } from 'reactant' ;
2
+ import { CounterService } from './counter.service' ;
3
+
4
+ describe ( 'CounterService' , ( ) => {
5
+ let module ;
6
+
7
+ beforeEach ( ( ) => {
8
+ module = testBed ( {
9
+ main : CounterService ,
10
+ modules : [ ] ,
11
+ } ) . instance ;
12
+ } ) ;
13
+
14
+ test ( 'should be created' , ( ) => {
15
+ expect ( module instanceof CounterService ) . toBeTruthy ( ) ;
16
+ } ) ;
17
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { render } from 'reactant-web' ;
2
+ import { createApp } from 'reactant' ;
3
+ import { AppView } from './app.view' ;
4
+
5
+ const app = createApp ( {
6
+ modules : [ ] ,
7
+ main : AppView ,
8
+ render,
9
+ } ) ;
10
+
11
+ app . bootstrap ( document . getElementById ( 'app' ) ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const path = require('path');
3
3
const CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ;
4
4
5
5
module . exports = {
6
- entry : './src/index.jsx ' ,
6
+ entry : './src/index.js ' ,
7
7
output : {
8
8
path : path . resolve ( __dirname , 'dist' ) ,
9
9
filename : 'bundle.js' ,
You can’t perform that action at this time.
0 commit comments