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
+36-15Lines changed: 36 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,19 +18,39 @@ Table of Contents
18
18
19
19
20
20
## Innovations
21
-
-__TYPESCRIPT RAPID-SPEED NO-TRANSPILATION WORKFLOW - loading TS files in the browser (on-the-fly), not emitting intermediate JS files, it's OK to use only TS files for speed, also when writing your tests, so it means no transpilation step & no bundling step required during development___(bundling step is only necessary to create app.js & vendor.js bundles for production)_
22
-
- RELIABLE-HOT-RELOAD - dev server with hot-reload using [jspm-hmr](https://www.npmjs.com/package/jspm-hmr) - highly reliable and scalable for speed with increasing modules count (more in [Pros & Cons](#pros--cons)...)
23
-
- TYPESCRIPT-TESTING - complete testing solution with Tape (blue-tape) - write and run tests only in TS - no transpilation required!
24
-
- NO-IDE-NO-PROBLEM - you can code in Notepad and run `tsc -p src --watch` in command line for fast incremental CLI type-checking or run `tsc -p src` for project-wide type-check, there is no JS emit so it never breaks reliable hot-reload :)
Fast development experience by loading TS files directly in the browser (with typescript-plugin), type-checking concurrently in IDE or in CLI with watch mode, no intermediate JS files transpilation, gives you speed as there is no transpilation or bundling step required _(bundling & transpilation expected only to create app.js & vendor.js bundles for production)_
24
+
(animated gif placeholder...)
25
+
26
+
### WRITE TESTS IN TYPESCRIPT
27
+
Write tests in TypeScript - no transpilation required, running directly from TS source files in a command line (`npm test`).
28
+
Test harness using (Tape)[https://github.com/substack/tape] also with Promise support from (blue-tape)[https://github.com/spion/blue-tape]
29
+
(animated gif placeholder...)
30
+
31
+
### RELIABLE-HOT-RELOAD
32
+
Local HTTP dev server with hot-reload out-of-the-box - highly reliable and scalable for speed with increasing modules count (explained in [Pros & Cons](#pros--cons)...)
33
+
(animated gif placeholder...)
34
+
35
+
### NO-IDE-NO-PROBLEM
36
+
If you are coding in a NO-IDE environment (notepad/vim) or expecting to have a common way across a team to target a specific version of typescript compiler even while using different Editors/IDEs, you can utilize __CLI type-checking workflow__ using `tsc -p src --watch` command for fast incremental type-checking or `tsc -p src` command for project-wide type-check, there is no JS emit so it will not clutter your project or disrupt different build processes based on various IDE plugins or gulp/grunt based tasks.
37
+
(animated gif placeholder...)
38
+
39
+
### TYPED-CSS-MODULES
40
+
My concept to achieve locally scoped CSS styles with some enhancements using (csjs)[https://github.com/rtsao/csjs#faq]
41
+
Full CSS support with all features like pseudo-classes & media queries, encapsulated in TypeScript (ES6 modules) can be easily imported by your UI components.
42
+
BONUS: statically typed class names helping with auto-completion, simple type-checking, easy refactoring and doc comments.
43
+
EXAMPLE: (about-container component)[src/containers/about-container/index.tsx] and it's (about-styles css-module)[src/containers/about-container/about-styles.tsx]
44
+
(animated gif placeholder...)
25
45
26
46
## Features
47
+
27
48
- PRODUCTION-WORKFLOW - npm scripts for production bundling & deployment, github-hooks, linter, test runner etc.
28
49
- TYPESAFE-API-CALLS - type checking contracts of REST API calls - forget constantly checking for API docs and let your IDE guide you
29
50
- GREAT-TOOLING - type cheking for JavaScript and DOM API with autocompletion and docs right in your editor - no more silly typos and runtime exceptions
30
51
- REACT-ROUTER - included `react-router-redux` to store your routing in state for Time-Travel capabilities
31
52
- REDUX-DEV-TOOLS - installed Redux DevTools capabilities with [chrome-extension](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd)
32
53
- IMMUTABLE-STORE - using `seamless-immutable` for simplicity and backwards-compatibility with vanilla JS (no hassle with `toJS()`, `get()`, `getIn()` in your containers and components)
33
-
- CSS-MODULES - simplest and reliable approach for local CSS styles using csjs - https://github.com/rtsao/csjs#faq
34
54
- BEM & ITCSS - using BEM with Inverted Triangle conventions to give meaning and context to CSS classes
35
55
36
56
#### React Best Practices & Optimizations
@@ -48,11 +68,11 @@ Table of Contents
48
68
---
49
69
50
70
## Roadmap
71
+
51
72
- Redux async flow with redux-saga - https://github.com/yelouafi/redux-saga/
52
73
- Testing async flow in redux sagas
53
74
- REDUX INNOVATION - using TS 2.0 "Tagged Union Types" - for solid Redux integration
- CSS Modules using csjs - https://github.com/rtsao/csjs#faq
56
76
- Reactive Programming with RxJS
57
77
- Testing with Enzyme (JSDOM)
58
78
- Testing Component markup (shallowRender)
@@ -62,6 +82,7 @@ Table of Contents
62
82
---
63
83
64
84
## JSPM / System.js / Rollup
85
+
65
86
- JSPM 0.17.X - production ready set-up with best-practices from real-world projects
66
87
- optimized loading speed by utilizing `vendor` dev-bundle (read below)
67
88
- using Rollup for bundling and tree-shaking optimizations
@@ -84,18 +105,18 @@ Check yourself using this easy test procedure:
84
105
85
106
## Pros / Cons
86
107
87
-
- If you are using TypeScript compiler built-in in the editor/IDE you can experience some quirks and limitations. You should always use a local npm TypeScript installation. For the best IDE experience I suggest to use Atom Editor with atom-typescript plugin (include single file compilation feature) or any other Editor with `npm run tsc:watch` starter-kit CLI Command for fast incremental type-checking.
108
+
- If you are depending on TypeScript compiler built-in into the editor/IDE you're using, you can experience some issues and limitations because of older compiler version over which you don't have control. Instead you should depend on a local npm TypeScript installation included in project. Visual Studio Code and alm.tools allows the possibility to use local TS npm package.
109
+
In case you want to stick to using IDE with "baked-in TS" you could turn off it's compilation process and check your types in command line with either `npm run tsc` or `npm run tsc:watch` commands for one-time or continuous-incremental type-checking.
88
110
89
-
-You should never emit intermediate JS files during development workflow, because you'll lose Hot-Reload capability (new files emitted after each change) and experience much slower workflow without any advantages.
111
+
-During development there is no need to emit intermediate JS files, this workflow will load your TS files directly in-browser, otherwise you'll lose Hot-Reload capability (new files emitted after each change) and experience much slower workflow without any advantages.
90
112
91
-
-I've seen most boilerplates adding Babel transpilation into their devworkflow with TypeScript, which introduces additional and unnecessary costly full build step, my solution only adds async/generators transform (not a full transpilation) only when generating app bundle for production (not in development workflow so it stays fast)
92
-
__It's worth to know that Babel is similarly using regenerator internally for async/generators transform https://babeljs.io/docs/usage/caveats/__
113
+
-A lot of boilerplates add Babel transpilation step into their dev-workflow with TypeScript, which introduces additional costly build step which slows you down, this workflow only adds async/generators transform (Babel internally doing the same!) only during creation of production bundle (not during development, so it is fast)
114
+
__It's worth to know that Babel is similarly using regenerator internally for async/generators transform__ (https://babeljs.io/docs/usage/caveats/)
93
115
94
-
-Comparing to Webpack HotModuleReload: SystemJS hot-reloading works differently from Webpack HMR, it loads module files separately so there is no need for bundling step. Then it deletes the module from module registry and re-imports it with the modules that depend on it ensuring to always load latest changes.
95
-
Because of this approach it is highly scalable with increasing modules count in your project and is more reliable in contrary to Webpack/React-Hot-Reloader - __Webpack is breaking it's HMR flow occasionally thus requiring you to do a full page reload__.
116
+
-SystemJS vs Webpack Hot-Module-Reload: SystemJS hot-reloading works differently from Webpack HMR, it loads each src file separately so there is no need for bundling step. During hot-reload it delete updated module from the System registry and re-imports it and other modules that import this module, ensuring to always have the latest changes.
117
+
This approach gives you great scalability with increasing modules count as you reload only concerned modules and it is also very reliable because of it's simple concept.
96
118
97
-
- Ttemporarily using regenerator transform to transpile async/generators to ES5 only in production build step (it's necessary for compatibility with older browsers without generators support, you can opt-out if not necessary)
98
-
__Soon with release of TypeScript 2.1 proper transpilation will be provided eliminating this step__
119
+
- If you are using async/generator functions for production and want to transpile to ES5 for old browsers support, you can use `npm run regenerator` command. (I'm working to provide alternative solution which will use typescript@next nightly release.)
99
120
100
121
---
101
122
@@ -203,7 +224,7 @@ __Soon with release of TypeScript 2.1 proper transpilation will be provided elim
203
224
204
225
`npm run lint` - run linter
205
226
206
-
`npm run test` - run test suites
227
+
`npm run test`or `npm test`- run test suites
207
228
208
229
`npm run precommit` - pre commit git hook - runs linter
0 commit comments