Skip to content

Commit f82a6e1

Browse files
committed
added react
1 parent c1437e1 commit f82a6e1

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

gulpfile.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let cli = commandLineArgs([
2929
let options = cli.parse();
3030

3131
let sassGlob = './sass/**/*.scss';
32-
let tsGlob = "./src/**/*.ts";
32+
let tsGlob = "./src/**/*.@(ts|tsx)";
3333

3434
let sassOutputGlob = './css/**/*.css';
3535
let tsOutputGlob = './dist/**/*.js';
@@ -46,12 +46,13 @@ gulp.task("browserfiy", ["ts"], function () {
4646
});
4747

4848
gulp.task('ts', function () {
49-
return gulp.src('src/**/*.ts')
49+
return gulp.src(tsGlob)
5050
.pipe(ts({
5151
declaration: false,
5252
module: "commonjs",
5353
target: "es6",
54-
experimentalDecorators: true
54+
experimentalDecorators: true,
55+
jsx: "react"
5556
}))
5657
.js
5758
.pipe(babel({

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<div id="assembler-output"></div>
1414
<div id="assembler-error-output"></div>
1515
<div id="graphics"></div>
16+
<div id="app-container"></div>
1617
</body>
1718
</html>

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"description": "",
55
"main": "gulpfile.js",
66
"dependencies": {
7+
"react": "^0.14.7",
8+
"react-dom": "^0.14.7"
79
},
810
"devDependencies": {
911
"browserify": "^13.0.0",

src/Main.ts renamed to src/Main.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import {Computer} from "./computer";
22
import {Interface} from "./Interface";
33
import {RAM} from "./RAM";
44
import {TextInitializer} from "./TextInitializer";
5+
import * as ReactDom from "react-dom";
6+
import * as React from "react";
7+
import {TestComponent} from "./components/TestComponent";
58

69
const computer = new Computer();
710
const webInterface = new Interface(computer);
@@ -33,4 +36,7 @@ computer.loadProgram([
3336
window.addEventListener("load", () => {
3437
webInterface.bind();
3538
computer.cpu.run();
39+
40+
ReactDom.render(<TestComponent/>, document.getElementById("app-container"));
3641
});
42+

src/components/TestComponent.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as React from "react";
2+
3+
export class TestComponent extends React.Component<any, any> {
4+
public render() {
5+
return <div>Hello World</div>
6+
}
7+
}

tsd.json

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"installed": {
88
"jasmine/jasmine.d.ts": {
99
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
10+
},
11+
"react/react.d.ts": {
12+
"commit": "d22516f9f089de107d7e7d5938566377370631f6"
13+
},
14+
"react/react-dom.d.ts": {
15+
"commit": "d22516f9f089de107d7e7d5938566377370631f6"
1016
}
1117
}
1218
}

0 commit comments

Comments
 (0)