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
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,18 @@ description: null
5
5
date: 2021-12-30
6
6
authors:
7
7
- tieubao
8
-
hide_title: true
9
8
tags:
10
9
- playbook
10
+
hide_title: true
11
11
---
12
12
13
-
# Dwarves Playbook
14
-
15
13
Dwarves Foundation is an innovation service firm. We have been building an organization with high standard software practices and business growth capabilities, helping tech startups, entrepreneurs and makers deliver their innovative software product since 2013.
16
14
17
15
We stand for the craftsmanship in software development. More than telling people how to do things, as a team, we take responsibility for collaboratively creating the product of innovation with the client. We value the long-term partnership, and we brought the economic impact through massive product distribution and brought to the market by the clients.
18
16
19
17
This repo is our playbook which contains our practices in software development and also how we collaborate to make them succeed.
Copy file name to clipboardExpand all lines: design/prototype.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Design some demo screens and send to the client to verify style, color palette,
63
63
64
64
Design systems enable teams to build better products faster by making design reusable, reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications.
Copy file name to clipboardExpand all lines: engineering/12-factor-app.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ You can read more about the philosophy of the 12-factor app <https://12factor.ne
14
14
15
15
> One codebase tracked in revision control, many deploys
16
16
17
-
**A twelve-factor app is always tracked in a version control system.** We use [git](playbook/engineering/git.md) to track any changes in the code of a repo.
17
+
**A twelve-factor app is always tracked in a version control system.** We use [git](git.md) to track any changes in the code of a repo.
18
18
19
19
There is only one codebase per app, but there will be many deploys of the app. We usually have one deploy for the following environment: local, development, staging and production.
Copy file name to clipboardExpand all lines: engineering/frontend/code-style.md
+46-49Lines changed: 46 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,33 +8,29 @@ date: null
8
8
9
9
While the vast majority of base code style is enforced by [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/), please also where possible, stick to the contribution guidelines below. These rules should be kept in mind when reviewing Pull Requests:
10
10
11
-
-Code should be functional in style rather than Object Orientated or Imperative unless there are no clean alternatives.
11
+
Code should be functional in style rather than Object Orientated or Imperative unless there are no clean alternatives.
12
12
13
-
- Use pure functions where possible to make them testable and modular.
14
-
- Avoid mutating variables and the `let` keyword.
15
-
- Prefer functional & immutable array methods .ie `map`/`filter`/`reduce`/`some`/`every` over any types of mutable `for` loop.
16
-
- Prefer "return early" coding style, more about it [here](https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88).
17
-
- Avoid classes and stateful modules where possible.
18
-
- Don't Repeat Yourself. Make extensive use of the constants and utils files for re-usable strings and methods.
19
-
- Don't obsess over performance of code, obsess over making it clear.
20
-
- The above rules can be relaxed for test scripts.
13
+
- Use pure functions where possible to make them testable and modular.
14
+
- Avoid mutating variables and the `let` keyword.
15
+
- Prefer functional & immutable array methods .ie `map`/`filter`/`reduce`/`some`/`every` over any types of mutable `for` loop.
16
+
- Prefer "return early" coding style, more about it [here](https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88).
17
+
- Avoid classes and stateful modules where possible.
18
+
- Don't Repeat Yourself. Make extensive use of the constants and utils files for re-usable strings and methods.
19
+
- Don't obsess over performance of code, obsess over making it clear.
20
+
- The above rules can be relaxed for test scripts.
21
21
22
-
-React components should be simple and composable and cater to real life UI design problems:
22
+
React components should be simple and composable and cater to real life UI design problems:
23
23
24
-
-**Simplicity**: Strive to keep the component API fairly simple and show real-world scenarios of using the component.
25
-
-**Representational**: React components should be templates, free of logic, and purely presentational. It aims to make our components shareable and easy to test.
24
+
-**Simplicity**: Strive to keep the component API fairly simple and show real-world scenarios of using the component.
25
+
-**Representational**: React components should be templates, free of logic, and purely presentational. It aims to make our components shareable and easy to test.
26
+
-**Composition**: Break down components into smaller parts with minimal props to keep complexity low, and compose them together. This will ensure that the styles and functionality are flexible and extensible.
27
+
-**Accessibility**: When creating a component, keep accessibility top of mind. This includes keyboard navigation, focus management, color contrast, voice over, and the correct aria-\* attributes.
28
+
-**Naming Props**: We all know naming is the hardest thing in this industry. Generally, ensure a prop name is indicative of what it does. Boolean props should be named using auxiliary verbs such as `does`, `has`, `is` and `should`. For example, Button uses `isDisabled`, `isLoading`, etc.
26
29
27
-
-**Composition**: Break down components into smaller parts with minimal props to keep complexity low, and compose them together. This will ensure that the styles and functionality are flexible and extensible.
30
+
When doing styling, strive to use `tailwindcss` classes for consistency and painless maintenance.
28
31
29
-
-**Accessibility**: When creating a component, keep accessibility top of mind. This includes keyboard navigation, focus management, color contrast, voice over, and the correct aria-\* attributes.
30
-
31
-
-**Naming Props**: We all know naming is the hardest thing in this industry. Generally, ensure a prop name is indicative of what it does. Boolean props should be named using auxiliary verbs such as `does`, `has`, `is` and `should`. For example, Button uses `isDisabled`, `isLoading`, etc.
32
-
33
-
- When doing styling, strive to use `tailwindcss` classes for consistency and painless maintenance.
34
-
35
-
- Avoid hard coding colors. All colors from the design guideline should be pre-defined in [`tailwind.js`](../tailwind.config.js). Please use them with respect.
36
-
37
-
- Try to avoid injecting styles via `style` attribute because it's impossible to build responsiveness with inline styles. Strive to only use Tailwind classes for sizing, spacing, and building grid layouts.
32
+
- Avoid hard coding colors. All colors from the design guideline should be pre-defined in `tailwind.js`
33
+
- Try to avoid injecting styles via `style` attribute because it's impossible to build responsiveness with inline styles. Strive to only use Tailwind classes for sizing, spacing, and building grid layouts.
38
34
39
35
```jsx
40
36
// Don't
@@ -50,41 +46,42 @@ While the vast majority of base code style is enforced by [ESLint](https://eslin
50
46
</div>
51
47
```
52
48
53
-
- Maintain the separation of concerns in the folder, for example:
49
+
Maintain the separation of concerns in the folder, for example:
50
+
51
+
-`constants/` contains shared variables used across the app.
52
+
-`components/` contains shared ui components used across the app.
53
+
-`utils/` contains shared functions used across the app.
54
+
-`hooks/` contains shared hooks used across the app.
55
+
-`types/` contains common `TypeScript` types or interfaces.
54
56
55
-
-`constants/` contains shared variables used across the app.
56
-
-`components/` contains shared ui components used across the app.
57
-
-`utils/` contains shared functions used across the app.
58
-
-`hooks/` contains shared hooks used across the app.
59
-
-`types/` contains common `TypeScript` types or interfaces.
57
+
When adding third party libraries to the project consider carefully the following;
60
58
61
-
- When adding third party libraries to the project consider carefully the following;
59
+
- Is this a trivial package we can easily write in-house? If so, take the time to roll your own.
60
+
- Is this library well supported, under active development and widely used in the community? If not, do not use it.
61
+
- Do we use a similar but different library for the same task elsewhere in the company? If so, use this library for developer familiarity and consistency.
62
+
- Will this library impact significantly performance or bundle size eg `Lodash` or `Moment`? If so, consider carefully if it is necessary or if there is a better alternative.
62
63
63
-
- Is this a trivial package we can easily write in-house? If so, take the time to roll your own.
64
-
- Is this library well supported, under active development and widely used in the community? If not, do not use it.
65
-
- Do we use a similar but different library for the same task elsewhere in the company? If so, use this library for developer familiarity and consistency.
66
-
- Will this library impact significantly performance or bundle size eg `Lodash` or `Moment`? If so, consider carefully if it is necessary or if there is a better alternative.
64
+
TypeScript helps write code better but should be used with care to not lose its strengths:
67
65
68
-
- TypeScript helps write code better but should be used with care to not lose its strengths:
66
+
- Avoid using `any` when possible. Using`any` is sometimes valid, but should rearely be used, even if to make quicker progress. Even`Unknown` is better than using `any`if you aren't sure of an input parameter.
67
+
- Pay attention when using the non-null assertion operator `!`. Only use if you know that a variable cannot be null right now rather than blindly using it to pass the validation step.
69
68
70
-
- Avoid using `any` when possible. Using`any` is sometimes valid, but should rearely be used, even if to make quicker progress. Even`Unknown` is better than using `any`if you aren't sure of an input parameter.
71
-
- Pay attention when using the non-null assertion operator `!`. Only use if you know that a variable cannot be null right now rather than blindly using it to pass the validation step.
69
+
File naming should be `PascalCase` for all React components files and `kebab-case` for the rest.
72
70
73
-
- File naming should be `PascalCase` for all React components files and `kebab-case` for the rest.
71
+
Exports from files can be either as variable or default exports, but please stick to naming the object before using `export default` to avoid anonymous module names in stack traces and React dev tools.
74
72
75
-
- Exports from files can be either as variable or default exports, but please stick to naming the object before using `export default` to avoid anonymous module names in stack traces and React dev tools.
73
+
Your app should be fast but also remember "Premature optimization is the root of all evil". **If you think it’s slow, prove it with a benchmark.**, the profiler of [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) (Chrome extension) is your friend! Once you find the root cause, try to follow the suggestions to fix it:
76
74
77
-
- Your app should be fast but also remember "Premature optimization is the root of all evil". **If you think it’s slow, prove it with a benchmark.**, the profiler of [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) (Chrome extension) is your friend! Once you find the root cause, try to follow the suggestions to fix it:
78
-
- Use `useMemo` mostly just for expensive calculations.
79
-
- Use `React.memo`, `useMemo`, and `useCallback` for reducing re-renders, they shouldn't have many dependencies and the dependencies should be mostly primitive types.
80
-
- Make sure your `React.memo`, `useCallback` or `useMemo` is doing what you think it's doing (is it really preventing rerendering?).
81
-
- Stop punching yourself every time you blink (fix slow renders before fixing rerenders).
82
-
- Putting your state as close as possible to where it's being used will not only make your code so much easier to read but It would also make your app faster (state colocation).
83
-
-`Context` should be logically separated, do not add to many values in one context provider. If any of the values of your context changes, all components consuming that context also rerenders even if those components don't use the specific value that was actually changed.
84
-
- You can optimize `context` by separating the `state` and the `dispatch` function.
85
-
- Know the terms [`lazy loading`](https://nextjs.org/docs/advanced-features/dynamic-import) and [`bundle/code splitting`](https://reactjs.org/docs/code-splitting.html)
86
-
- Window large lists (with [`tannerlinsley/react-virtual`](https://github.com/tannerlinsley/react-virtual) or similar).
87
-
- A smaller bundle size usually also means a faster app. You can visualize the code bundles you've generated with [`@next/bundle-analyzer`](https://www.npmjs.com/package/@next/bundle-analyzer).
75
+
- Use `useMemo` mostly just for expensive calculations.
76
+
- Use `React.memo`, `useMemo`, and `useCallback` for reducing re-renders, they shouldn't have many dependencies and the dependencies should be mostly primitive types.
77
+
- Make sure your `React.memo`, `useCallback` or `useMemo` is doing what you think it's doing (is it really preventing rerendering?).
78
+
- Stop punching yourself every time you blink (fix slow renders before fixing rerenders).
79
+
- Putting your state as close as possible to where it's being used will not only make your code so much easier to read but It would also make your app faster (state colocation).
80
+
-`Context` should be logically separated, do not add to many values in one context provider. If any of the values of your context changes, all components consuming that context also rerenders even if those components don't use the specific value that was actually changed.
81
+
- You can optimize `context` by separating the `state` and the `dispatch` function.
82
+
- Know the terms [`lazy loading`](https://nextjs.org/docs/advanced-features/dynamic-import) and [`bundle/code splitting`](https://reactjs.org/docs/code-splitting.html)
83
+
- Window large lists (with [`tannerlinsley/react-virtual`](https://github.com/tannerlinsley/react-virtual) or similar).
84
+
- A smaller bundle size usually also means a faster app. You can visualize the code bundles you've generated with [`@next/bundle-analyzer`](https://www.npmjs.com/package/@next/bundle-analyzer).
Copy file name to clipboardExpand all lines: engineering/git.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,15 @@ date: null
8
8
9
9
It's like a time machine. We can save and reload anytime we want to, like in the old day of Game Boy Advance. We can work in parallel universes of our source code, experimenting without fear of losing work, and rolling back if something goes wrong.
10
10
11
-
[We use git](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github). Git is one of the most popular distributed source version control. We use [Github](github.com/dwarvesf/) to open source our works, playbook, and practices. We also have a [self-host Gitlab](git.d.foundation) to store all of our source code.
11
+
[We use git](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github). Git is one of the most popular distributed source version control. We use [Github](https://github.com/dwarvesf/) to open source our works, playbook, and practices. We also have a `self-host cgit` to store all of our source code.
12
12
13
13
## Commit Message Guidelines
14
14
15
15
Hour commit conventions are based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#specification)
Copy file name to clipboardExpand all lines: operations/adjust-the-way-we-work-in-basecamp-style.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Basecamp, for example.
17
17
18
18
Our path with Basecamp didn't cross by accident. Years ago, we embarked on the Slack community and had it applied for internal communication. And project management on another tool, where documents & files are in G-suite. Every day is a short strip from one place to another. Then get back. Then do it again tomorrow.
As much as we enjoyed the fast replies and high-engaging interaction amongst the member, it's challenging to focus on the work. Every smallest message can become a team gossip/ discussion, not to mention the biggest distracting part - memes. That shit is unstoppable.
23
23
@@ -98,7 +98,7 @@ When you've had enough with the scrolling, a shortcut is a savior. Basecamp take
98
98
99
99
Basecamp is formal enough to keep people concentrated on what they do, but still it gives them the chance to be creative.
Another thing that drives us toward is how Basecamp makes things transparent. The 'Activity' tab reveals everything we need to know, whenever we need it. That somehow helps us focus on what matters, and reduce the risk of FOMO.
Copy file name to clipboardExpand all lines: operations/checklists/onboarding-checklist.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ tags:
13
13
14
14
Through this process, the employee gradually form their own perspective and their fit with the Dwarves. This is the stage when they decide whether or not to commit to our company.
0 commit comments