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
Recently [[https://redux.js.org/][Redux]] support has been removed from this boilerplate. It can still be incorporated, but by default this boilerplate is focused more on React. There are many other options like [[https://mobx.js.org/][Mobx]], [[https://reactjs.org/docs/context.html][context]], and more.
8
+
6
9
** Table of Contents
7
10
- [[#about][About]]
8
11
- [[#prerequisites][Prerequisites]]
@@ -12,57 +15,47 @@
12
15
- [[#project-resources][Project Resources]]
13
16
14
17
** About
15
-
This is a boilerplate project for developing a mid to large scale client-side application(s) using [[https://www.typescriptlang.org/][TypeScript]], [[https://facebook.github.io/react/][React]], and [[http://redux.js.org/][Redux]]. For an example project, visit the [[https://github.com/jupl/astraea/tree/example][example branch]].
18
+
This is a boilerplate project for developing a mid to large scale client-side application(s) using [[https://www.typescriptlang.org/][TypeScript]] and [[https://facebook.github.io/react/][React]]. For an example project, visit the [[https://github.com/jupl/astraea/tree/example][example branch]].
16
19
17
-
^{[[#astraea-typescript--react--redux-boilerplate][Back to top]]}
20
+
^{[[#astraea-typescript--react-boilerplate][Back to top]]}
- Editor with support for TypeScript, [[https://palantir.github.io/tslint/][TSLint]], and [[http://editorconfig.org/][EditorConfig]] (ex. [[https://code.visualstudio.com/][Visual Studio Code]])
24
26
25
-
^{[[#astraea-typescript--react--redux-boilerplate][Back to top]]}
27
+
^{[[#astraea-typescript--react-boilerplate][Back to top]]}
26
28
27
29
** Getting Started
28
30
1. Clone/download this repository.
29
31
2. Install dependencies using npm *or* Yarn:
30
-
- =npm install=
31
-
- =yarn=
32
+
- =npm install=
32
33
3. Start running tasks as described below in the [[#tasks][tasks section]].
33
34
34
-
^{[[#astraea-typescript--react--redux-boilerplate][Back to top]]}
35
+
^{[[#astraea-typescript--react-boilerplate][Back to top]]}
35
36
36
37
** Project structure
37
38
*** Overview
38
39
#+BEGIN_EXAMPLE
39
40
astraea/
41
+
├─ .coverage/ # Code coverage reports
40
42
├─ .storybook/ # Storybook configuration
41
-
├─ coverage/ # Code coverage reports
42
43
├─ dist/assets/ # Result assets from build tasks
44
+
├─ dist/story/ # Result storybook build
45
+
├─ jest/ # Code that runs before tests are run
43
46
├─ src/ # Source code
44
47
│ ├─ app/ # Application domain
45
-
│ │ ├─ components/root/ # Top level application view
46
-
│ │ ├─ actions.test.ts # Test to ensure all actions are valid
47
-
│ │ └─ reducer.ts # Reducer for whole application
48
+
│ │ └─ components/root/ # Top level application view
48
49
│ ├─ assets/ # Static files and entry points to include in builds
49
50
│ │ └─ app.tsx # An application entry point
50
-
│ ├─ common/ # Shared code used throughout project
When TypeScript code is built, any files directly inside the =src/assets/= directory are used to create the output files. The boilerplate currently generates =app.js=, as there is a single entry point inside =src/assets/=. (=src/assets/index.js=) If there are more than one entry points more files generated as well as an additional file =common.js=, which contains shared code across all entry points. =common.js= must be loaded before you load an entry point. You can see what gets generated by running the =build:dev= / =build:prod= task. (see the [[#tasks][tasks section]])
@@ -73,8 +66,7 @@ domain/
73
66
│ ├─ component1/ # See Component sections below
74
67
│ ├─ component2/
75
68
│ └─ componentX/
76
-
├─ actions.ts # Redux actions for domain
77
-
└─ reducer.ts # Domain reducer
69
+
└─ ... # Other domain items (Redux, MobX, context, etc.)
78
70
#+END_EXAMPLE
79
71
Rather than group items by things like components/reducers/actions/etc., items are grouped by domain which can be a saner option as the project grows. Examples of domains can be things like resources (ex. =blog/=, =users/=) or other things. (ex. =ui/=) Domains may include things like components, actions, reducer, etc. but they don't have to include all of them. In fact, you can think of =app/= and =common/= as domains. Other files may be present as well.
80
72
*** Components
@@ -84,7 +76,7 @@ component/
84
76
└─ template.tsx
85
77
#+END_EXAMPLE
86
78
React components are grouped in a directory.
87
-
- =template.tsx= defines the React component without any knowledge of Redux specifics or other things like React DnD. (sometimes referred as /dumb/ component)
79
+
- =template.tsx= defines the React component without any knowledge of outside logic (ex: Redux) specifics or other things like React DnD. (sometimes referred as /dumb/ component)
88
80
- =index.ts= is the entry point of the component when used by others.
89
81
- If template does not require data/action bindings then it can just pass through the template. (see =src/app/components/root/index.ts=)
90
82
- If template requires data/action bindings then it is done here. (sometimes refereed as /smart/ component)
@@ -94,13 +86,12 @@ Tests for components/domains/logic/etc. If code needs to be run before tests are
Defines a story to display in React Storybook. Typically this file is in a component. (ex. =index.stories.tsx=) [[https://getstorybook.io/docs/react-storybook/basics/writing-stories][This guide]] provides information on how to write stories.
100
91
**** =__snapshots__=
101
92
Generated files/directories when using Jest's [[https://facebook.github.io/jest/docs/tutorial-react.html#snapshot-testing][snapshot feature]]. These files should be left to Jest and not touched manually.
102
93
103
-
^{[[#astraea-typescript--react--redux-boilerplate][Back to top]]}
94
+
^{[[#astraea-typescript--react-boilerplate][Back to top]]}
104
95
105
96
** Tasks
106
97
Tasks can be executed in the following manner:
@@ -120,19 +111,18 @@ Alias for =server:hot=.
120
111
*** =server:hot=
121
112
Start a local development server with hot reloading. To override the port change the environment variable =PORT=. The following is provided:
122
113
- [[https://webpack.js.org/concepts/hot-module-replacement][Hot reloading]] (including [[https://github.com/gaearon/react-hot-loader][React Hot Loader]])
123
-
- [[http://zalmoxisus.github.io/redux-devtools-extension/][Redux DevTools Extension]] (if unavailable [[https://github.com/evgenyrodionov/redux-logger][Logger for Redux]] is used)
124
114
*** =server:story=
125
115
Start a local server for React Storybook on port 9001. For more information visit the [[https://getstorybook.io/docs][documentation for React Storybook]].
126
116
*** =build:dev= / =build:prod=
127
117
Build application and include assets into a packaged build in the =dist/assets/= directory. The build for =build:dev= is not minifed and includes source maps, making it ideal for development. The build for =build:prod= is minified (with dead code elimination) and does not include source maps, making it ideal for production.
128
118
*** =build:story=
129
-
Generate a static build of React Storybook in the =story/= disrectory.
119
+
Generate a static build of React Storybook in the =dist/story/= disrectory.
Execute tests once or continuously on file changes. In addition, code coverage can be determined. For more information visit the [[https://facebook.github.io/jest/docs/configuration.html][documentation for Jest]].
132
122
*** =lint= / =lint:fix=
133
123
Check codebase against linting rules. Optionally, some errors can be fixed automatically.
134
124
135
-
^{[[#astraea-typescript--react--redux-boilerplate][Back to top]]}
125
+
^{[[#astraea-typescript--react-boilerplate][Back to top]]}
136
126
137
127
** Project Resources
138
128
- Language
@@ -141,17 +131,14 @@ Check codebase against linting rules. Optionally, some errors can be fixed autom
0 commit comments