Creating the project
This is the same type of stuff as any modern web app project, and in fact is similar to the TypeScript guidelines for React and webpack.
First install nodejs, then make sure you have TypeScript and webpack installed:
$ npm install -g typescript@rc webpack
Note we're using the release candidate, because Immuto requires TypeScript 2.0 which hasn't gone mainstream just yet.
Now create your project directory:
$ mkdir myapp
$ cd myapp
$ npm init
And accept all the defaults. Then add the packages that we need for the app to run:
$ npm install --save react react-dom immuto immuto-react
And then the packages we'll need to develop the app:
$ npm install --save-dev @types/react @types/react-dom typescript@rc webpack ts-loader source-map-loader
Run this command to get a minimal React project in place:
$ node node_modules/immuto-react/templates/get
This creates:
tsconfig.json
- strictest TypeScript rulesindex.tsx
- entry point for appwebpack.config.js
- buildsindex.tsx
tobuilt/bundle.js
with source mapsindex.html
- minimal container page, loadsbuilt/bundle.js
You can now build the app with:
$ webpack
You can keep webpack running all the time by adding the -w
switch, so it rebuilds every time you save a modification.
If you open index.html
in your browser you should see the message:
Hello, world!
Now our aim is to improve on that...