More idiomatic project setup

This commit is contained in:
Michel Weststrate 2015-12-14 13:08:26 +01:00
parent 625fd8dd06
commit 58cdd3038f
7 changed files with 22 additions and 17 deletions

3
.gitignore vendored
View file

@ -1,4 +1,3 @@
node_modules/ node_modules/
typings/ typings/
public/js/app/*.js public/js/bundle.js
temp/

View file

@ -1,6 +1,7 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015 Benny van Reeven Copyright (c) 2015 Michel Weststrate
Forked from: https://github.com/bvanreeven/react-typescript
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -2,19 +2,20 @@
Minimal boilerplate for a single-page app using Mobservable, Mobservable-React, React, TypeScript 1.6 with TSX, and Visual Studio Code. Minimal boilerplate for a single-page app using Mobservable, Mobservable-React, React, TypeScript 1.6 with TSX, and Visual Studio Code.
Usage: Initial install:
* Install Node.js * Install Node.js
* `npm install -g tsd` * `npm install -g tsd`
* `npm install` * `npm install`
* `tsd install` * `tsd install`
Build:
* `npm run build` * `npm run build`
To view the app: To view the app:
* `npm install -g http-server` * `npm start`
* `http-server`
* Open [http://localhost:8080/](http://localhost:8080/) in your browser of choice.
## Credits ## Credits

View file

@ -8,19 +8,21 @@
}, },
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"mobservable": "^1.0.0", "mobservable": "^1.1.4",
"mobservable-react": "^2.0.0", "mobservable-react": "^2.1.0",
"mobservable-react-devtools": "^2.0.4",
"react": "^0.14", "react": "^0.14",
"react-dom": "^0.14" "react-dom": "^0.14"
}, },
"devDependencies": { "devDependencies": {
"browserify": "^11.1.0", "browserify": "^11.1.0",
"mkdirp": "^0.5.1", "http-server": "^0.8.5",
"tsify": "^0.13.1",
"typescript": "^1.6.2" "typescript": "^1.6.2"
}, },
"scripts": { "scripts": {
"build": "mkdirp public/js/app && tsc && browserify ./temp/app.js -o public/js/app/bundle.js", "build": "browserify src/index.tsx -p tsify > public/js/bundle.js",
"start": "http-server" "start": "cd public && http-server -o index.html"
}, },
"author": "Michel Weststrate", "author": "Michel Weststrate",
"license": "MIT" "license": "MIT"

View file

@ -3,17 +3,17 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>My First React App</title> <title>Mobservable-React-Typescript boilerplate project</title>
<link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/bootstrap.css">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>My First React App</h1> <h1>Mobservable-React-Typescript boilerplate project</h1>
<div id="app"></div> <div id="app"></div>
</div> </div>
<script src="js/app/bundle.js"></script> <script src="js/bundle.js"></script>
</body> </body>
</html> </html>

View file

@ -5,6 +5,8 @@ import ReactDOM = require('react-dom');
import {observable} from 'mobservable'; import {observable} from 'mobservable';
import {observer} from 'mobservable-react'; import {observer} from 'mobservable-react';
import "mobservable-react-devtools";
class DemoProps { class DemoProps {
public name: string; public name: string;
} }

View file

@ -8,9 +8,9 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"noLib": false, "noLib": false,
"jsx": "react", "jsx": "react",
"outDir": "./temp" "outDir": "dist"
}, },
"files": [ "files": [
"app/app.tsx" "src/index.tsx"
] ]
} }