You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-28Lines changed: 50 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,43 +1,70 @@
1
1
# React / TypeScript / JSPM starter-kit
2
-
Modern, future-proof JavaScript Project Starter-Kit to build modular web apps with React & TypeScript using ES Modules powered by JSPM/SystemJS
2
+
Modern, clean & future-proof JavaScript Project boilerplate to build modular web apps utilizing power of ES2016, async/await, ES Modules with React & TypeScript powered by JSPM/SystemJS.
3
3
4
4
## Features
5
-
- just core stuff and dev server setup with hot-reload - the rest is up to you
6
-
- fully automated - just npm install, npm start to run dev server and you're ready to code
7
-
- React-TypeScript usage example code
8
-
- React & ReactDOM typings
9
-
- typescript nightly version (@next) for coolest new features, default tsconfig for ES2015
10
-
- development server with browser-sync (live-reload & css inject)
11
-
- JSPM 0.17.X with hot-module reload enabled and example code (chokidar-socket-emitter/systemjs-hot-reloader)
12
-
- bundling for production in `~/dist/` folder - test productions available on `http://localhost/dist/`
5
+
- clean with bare minimum dep to make React & TypeScript & dev server with hot-reload running - the rest is up to you
6
+
- easy start - just npm install && npm start to run dev server and you're ready to start coding
7
+
- simple and clean dev server with hot-module-reload for JSPM - [jspm-hmr](https://www.npmjs.com/package/jspm-hmr)
8
+
- added static dev-bundle (with external deps) setup for quick full-page reload, this is most important as this will make JSPM very fast
9
+
- Typescript custom ambient definitions for external libraries - best-practices & example
10
+
- React with TypeScript - best-practices & example code & typings
11
+
- (async/await best practices with example code in progress)
12
+
- typescript nightly builds (@next) for coolest new features, tsconfig setup for ES2016 support
13
+
- JSPM 0.17.X - most recent beta version up stay up-to-date with best-practices
14
+
- bundling for production in `~/dist/` folder - open production build on dev server `http://localhost/dist/`
13
15
- importing and bundling CSS dependencies using JSPM `plugin-css`
14
-
- npm run scripts to automate bundling & dev server startup
16
+
- usefull npm run scripts to automate many development workflow tasks
17
+
- github hooks using husky (in progress)
18
+
- nice css loader while waiting for React to "kick in"
19
+
- using regenerator to transpile generators/async/await to ES5 (soon with TypeScript 2.0 release it will be not needed)
20
+
21
+
---
22
+
23
+
## Making JSPM loading fast - Static Bundle for External Deps
24
+
Important point to keep in mind when running dev server with JSPM is to create a static bundle of external dependencies. As they only change when updated through NPM, it is best to bundle them all together and load as one package instead of separately making hundreds of requests slowing down page reload.
25
+
That way your only your modules from src are still loaded separately making possible to hot-reload them instantly without rebundling, and do full-page reload if necessary very quickly. This is the best of two development approaches (hot-reload vs. bundling) mixed together.
26
+
27
+
Test:
28
+
1. run `npm run unbundle` -> open network tab, reload page and check output
29
+
2. run `npm run bundle-dev` -> open network tab, reload page and check output
30
+
3. compare results
15
31
16
32
---
17
33
18
34
## Usage
19
35
20
36
#### NPM Commands
21
37
22
-
`npm start` - start local development server with hot-reload **(WARNING: currently working only for windows)**
23
-
*other platforms please npm run server & hot-reloader processes seperately, plan to fix it in the future*
38
+
`npm start` - start local dev server with hot-module-reload for JSPM [jspm-hmr](https://www.npmjs.com/package/jspm-hmr)
39
+
40
+
`npm run bundle-dev` - inject static dev-bundle to JSPM config for quick full-page reload
41
+
42
+
`npm run unbundle` - un-inject static dev-bundle from JSPM config
24
43
25
-
`npm run server` - start local development server (browser-sync - w/o hot-reload)
44
+
`npm run build` - build production app bundle (only your app source) - optimized minified version w/o source-maps (dist/ folder)
26
45
27
-
`npm run hot-reloader` - start hot-reloader (chokidar-socket-emitter)
28
-
29
-
`npm run build-test` - build production bundle - debug version with source-maps
30
-
31
-
`npm run build-prod` - build production bundle - optimized minified version w/o source-maps
46
+
`npm run build-debug` - same as build but debug version with source-maps
47
+
48
+
`npm run build-deps` - build production dependency bundle (only external dependencies) (dist/ folder)
49
+
50
+
#### Dev Workflow
51
+
1.`npm run bundle-dev` - _**OPTIONAL:** run only when your dependencies has changed_
52
+
2.`npm start`
53
+
54
+
#### Build for Production Workflow
55
+
1.`npm run build`
56
+
2.`npm run build-deps` - _**OPTIONAL:** run only when your dependencies has changed_
57
+
3. open `http://localhost/dist/` to check
58
+
4. deploy 'dist' contents on your server
32
59
33
60
---
34
61
35
62
## Installation
36
63
37
64
#### Prerequisites
38
65
- node.js and git
39
-
- install jspm package globally to have jspm command available: `npm install jspm -g` (otherwise you would have to use a local version from `~/node_modules/`)
40
-
66
+
- install JSPM with global flag to have jspm command available: `npm install jspm -g` (otherwise you'll have to use a local version from `~/node_modules/`)
67
+
41
68
42
69
#### 1. Create new project folder
43
70
mkdir my-project && cd my-project
@@ -49,21 +76,16 @@ Modern, future-proof JavaScript Project Starter-Kit to build modular web apps wi
49
76
npm install
50
77
51
78
#### 4. Run development server and start developing
0 commit comments