Browse Source

docs: adding PR guidelines for contributors (#2736)

vanilla_orig
Carl Sverre 4 years ago
parent
commit
a13c4f72f5
No account linked to committer's email address

+ 1
- 0
.prettierrc View File

@@ -1,3 +1,4 @@
1 1
 {
2
+  "proseWrap": "never",
2 3
   "trailingComma": "all"
3 4
 }

+ 39
- 2
CONTRIBUTING.md View File

@@ -8,8 +8,7 @@
8 8
 1. Run `npm install` to install dependencies
9 9
 1. Create a branch for your PR with `git checkout -b your-branch-name`
10 10
 
11
-> To keep `master` branch pointing to remote repository and make
12
-> pull requests from branches on your fork. To do this, run:
11
+> To keep `master` branch pointing to remote repository and make pull requests from branches on your fork. To do this, run:
13 12
 >
14 13
 > ```sh
15 14
 > git remote add upstream https://github.com/excalidraw/excalidraw.git
@@ -25,3 +24,41 @@
25 24
 1. Tap on `Fork Sandbox`
26 25
 1. Write your code
27 26
 1. Commit and PR automatically
27
+
28
+## Pull Request Guidelines
29
+
30
+Don't worry if you get any of the below wrong, or if you don't know how. We'll gladly help out.
31
+
32
+### Title
33
+
34
+Make sure the title starts with a semantic prefix:
35
+
36
+- **feat**: A new feature
37
+- **fix**: A bug fix
38
+- **improvement**: An improvement to a current feature
39
+- **docs**: Documentation only changes
40
+- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
41
+- **refactor**: A code change that neither fixes a bug nor adds a feature
42
+- **perf**: A code change that improves performance
43
+- **test**: Adding missing tests or correcting existing tests
44
+- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
45
+- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
46
+- **chore**: Other changes that don't modify src or test files
47
+- **revert**: Reverts a previous commit
48
+
49
+### Changelog
50
+
51
+Add a brief description of your pull request to the changelog located here: [`src/packages/excalidraw/CHANGELOG.md`](src/packages/excalidraw/CHANGELOG.md)
52
+
53
+Notes:
54
+
55
+- Make sure to prepend to the section corresponding with the semantic prefix you selected in the title
56
+- Link to your pull request - this will require updating the CHANGELOG _after_ creating the pull request
57
+
58
+### Testing
59
+
60
+Once you submit your pull request it will automatically be tested. Be sure to check the results of the test and fix any issues that arise.
61
+
62
+It's also a good idea to consider if your change should include additional tests. This is highly recommended for new features or bug-fixes. For example, it's good practice to create a test for each bug you fix which ensures that we don't regress the code in the future.
63
+
64
+Finally - always manually test your changes using the convenient staging environment deployed for each pull request. As much as local development attempts to replicate production, there can still be subtle differences in behavior. For larger features consider testing your change in multiple browsers as well.

+ 4
- 16
README.md View File

@@ -99,11 +99,9 @@ And the main source of inspiration for starting the project is the awesome [Zwib
99 99
 
100 100
 ## Testimonials
101 101
 
102
-<a href="https://twitter.com/Lissy_Sykes/status/1213813117177729026"><img width="398" src="https://user-images.githubusercontent.com/197597/71783813-dbf8a600-2fa0-11ea-9c0d-bb3cc45969e6.png"></a>
103
-<a href="https://twitter.com/dan_abramov/status/1213762494428262400"><img width="398" src="https://user-images.githubusercontent.com/197597/71783990-4d395880-2fa3-11ea-9ad7-186138db5003.png"></a>
102
+<a href="https://twitter.com/Lissy_Sykes/status/1213813117177729026"><img width="398" src="https://user-images.githubusercontent.com/197597/71783813-dbf8a600-2fa0-11ea-9c0d-bb3cc45969e6.png"></a> <a href="https://twitter.com/dan_abramov/status/1213762494428262400"><img width="398" src="https://user-images.githubusercontent.com/197597/71783990-4d395880-2fa3-11ea-9ad7-186138db5003.png"></a>
104 103
 
105
-<a href="https://twitter.com/kyehohenberger/status/1214288572037025792"><img width="423" src="https://user-images.githubusercontent.com/197597/71851802-34f13880-308c-11ea-9416-191099e6349c.png"></a>
106
-<a href="https://twitter.com/lucasazzola/status/1215126440330416128"><img width="429" src="https://user-images.githubusercontent.com/197597/72039003-48e99580-3258-11ea-8daa-85dd055f2a82.png">
104
+<a href="https://twitter.com/kyehohenberger/status/1214288572037025792"><img width="423" src="https://user-images.githubusercontent.com/197597/71851802-34f13880-308c-11ea-9416-191099e6349c.png"></a> <a href="https://twitter.com/lucasazzola/status/1215126440330416128"><img width="429" src="https://user-images.githubusercontent.com/197597/72039003-48e99580-3258-11ea-8daa-85dd055f2a82.png">
107 105
 
108 106
 <a href="https://twitter.com/jordwalke/status/1214858186789806080"><img width="434" src="https://user-images.githubusercontent.com/197597/72036874-07a1b780-3251-11ea-99e8-6bafd93483a0.png"></a>
109 107
 
@@ -111,8 +109,7 @@ And the main source of inspiration for starting the project is the awesome [Zwib
111 109
 
112 110
 ### Code Contributors
113 111
 
114
-This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
115
-<a href="https://github.com/excalidraw/excalidraw/graphs/contributors"><img src="https://opencollective.com/excalidraw/contributors.svg?width=890&button=false" /></a>
112
+This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. <a href="https://github.com/excalidraw/excalidraw/graphs/contributors"><img src="https://opencollective.com/excalidraw/contributors.svg?width=890&button=false" /></a>
116 113
 
117 114
 ### Financial Contributors
118 115
 
@@ -126,13 +123,4 @@ Become a financial contributor and help us sustain our community. [[Contribute](
126 123
 
127 124
 Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/excalidraw/contribute)]
128 125
 
129
-<a href="https://opencollective.com/excalidraw/organization/0/website"><img src="https://opencollective.com/excalidraw/organization/0/avatar.svg"></a>
130
-<a href="https://opencollective.com/excalidraw/organization/1/website"><img src="https://opencollective.com/excalidraw/organization/1/avatar.svg"></a>
131
-<a href="https://opencollective.com/excalidraw/organization/2/website"><img src="https://opencollective.com/excalidraw/organization/2/avatar.svg"></a>
132
-<a href="https://opencollective.com/excalidraw/organization/3/website"><img src="https://opencollective.com/excalidraw/organization/3/avatar.svg"></a>
133
-<a href="https://opencollective.com/excalidraw/organization/4/website"><img src="https://opencollective.com/excalidraw/organization/4/avatar.svg"></a>
134
-<a href="https://opencollective.com/excalidraw/organization/5/website"><img src="https://opencollective.com/excalidraw/organization/5/avatar.svg"></a>
135
-<a href="https://opencollective.com/excalidraw/organization/6/website"><img src="https://opencollective.com/excalidraw/organization/6/avatar.svg"></a>
136
-<a href="https://opencollective.com/excalidraw/organization/7/website"><img src="https://opencollective.com/excalidraw/organization/7/avatar.svg"></a>
137
-<a href="https://opencollective.com/excalidraw/organization/8/website"><img src="https://opencollective.com/excalidraw/organization/8/avatar.svg"></a>
138
-<a href="https://opencollective.com/excalidraw/organization/9/website"><img src="https://opencollective.com/excalidraw/organization/9/avatar.svg"></a>
126
+<a href="https://opencollective.com/excalidraw/organization/0/website"><img src="https://opencollective.com/excalidraw/organization/0/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/1/website"><img src="https://opencollective.com/excalidraw/organization/1/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/2/website"><img src="https://opencollective.com/excalidraw/organization/2/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/3/website"><img src="https://opencollective.com/excalidraw/organization/3/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/4/website"><img src="https://opencollective.com/excalidraw/organization/4/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/5/website"><img src="https://opencollective.com/excalidraw/organization/5/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/6/website"><img src="https://opencollective.com/excalidraw/organization/6/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/7/website"><img src="https://opencollective.com/excalidraw/organization/7/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/8/website"><img src="https://opencollective.com/excalidraw/organization/8/avatar.svg"></a> <a href="https://opencollective.com/excalidraw/organization/9/website"><img src="https://opencollective.com/excalidraw/organization/9/avatar.svg"></a>

+ 2
- 4
src/locales/README.md View File

@@ -3,12 +3,10 @@
3 3
 Please do not contribute changes directly to these files, as we manage them with Crowdin. Instead:
4 4
 
5 5
 - to request a new translation, [open an issue](https://github.com/excalidraw/excalidraw/issues/new/choose).
6
-- to update existing translations, [edit them on Crowdin](https://crowdin.com/translate/excalidraw/10)
7
-  and we should have them included in the app soon!
6
+- to update existing translations, [edit them on Crowdin](https://crowdin.com/translate/excalidraw/10) and we should have them included in the app soon!
8 7
 
9 8
 ## Completion of translation
10 9
 
11
-[percentages.json](./percentages.json) holds a percentage of completion for each language. We generate these
12
-automatically [on build time](./../../.github/workflows/locales-coverage.yml) when a new translation PR appears.
10
+[percentages.json](./percentages.json) holds a percentage of completion for each language. We generate these automatically [on build time](./../../.github/workflows/locales-coverage.yml) when a new translation PR appears.
13 11
 
14 12
 We only make a language available on the app if it exceeds a certain threshold of completion.

+ 36
- 39
src/packages/excalidraw/README.md View File

@@ -125,22 +125,22 @@ export default function App() {
125 125
 
126 126
 ### Props
127 127
 
128
-| Name                                          | Type                                                                                                                                                                                                                                                                                                             | Default              | Description                                                                                                                                                |
129
-| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
130
-| [`width`](#width)                             | Number                                                                                                                                                                                                                                                                                                           | `window.innerWidth`  | The width of Excalidraw component                                                                                                                          |
131
-| [`height`](#height)                           | Number                                                                                                                                                                                                                                                                                                           | `window.innerHeight` | The height of Excalidraw component                                                                                                                         |
132
-| [`offsetLeft`](#offsetLeft)                   | Number                                                                                                                                                                                                                                                                                                           | `0`                  | left position relative to which Excalidraw should be rendered                                                                                              |
133
-| [`offsetTop`](#offsetTop)                     | Number                                                                                                                                                                                                                                                                                                           | `0`                  | top position relative to which Excalidraw should render                                                                                                    |
134
-| [`onChange`](#onChange)                       | Function                                                                                                                                                                                                                                                                                                         |                      | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw elements and the current app state. |
135
-| [`initialData`](#initialData)                 | <pre>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37">AppState<a> } </pre>                                                                | null                 | The initial data with which app loads.                                                                                                                     |
136
-| [`user`](#user)                               | `{ name?: string }`                                                                                                                                                                                                                                                                                              |                      | User details. The name refers to the name of the user to be shown                                                                                          |
137
-| [`excalidrawRef`](#excalidrawRef)             | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) or [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) or <pre>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</pre> |                      | Ref to be passed to Excalidraw                                                                                                                             |
138
-| [`onCollabButtonClick`](#onCollabButtonClick) | Function                                                                                                                                                                                                                                                                                                         |                      | Callback to be triggered when the collab button is clicked                                                                                                 |
139
-| [`isCollaborating`](#isCollaborating)         | `boolean`                                                                                                                                                                                                                                                                                                        |                      | This implies if the app is in collaboration mode                                                                                                           |
140
-| [`onPointerUpdate`](#onPointerUpdate)         | Function                                                                                                                                                                                                                                                                                                         |                      | Callback triggered when mouse pointer is updated.                                                                                                          |
141
-| [`onExportToBackend`](#onExportToBackend)     | Function                                                                                                                                                                                                                                                                                                         |                      | Callback triggered when link button is clicked on export dialog                                                                                            |
142
-| [`langCode`](#langCode)                       | string                                                                                                                                                                                                                                                                                                           | `en`                 | Language code string                                                                                                                                       |
143
-| [`renderFooter `](#renderFooter)              | Function                                                                                                                                                                                                                                                                                                         |                      | Function that renders custom UI footer                                                                                                                     |
128
+| Name | Type | Default | Description |
129
+| --- | --- | --- | --- |
130
+| [`width`](#width) | Number | `window.innerWidth` | The width of Excalidraw component |
131
+| [`height`](#height) | Number | `window.innerHeight` | The height of Excalidraw component |
132
+| [`offsetLeft`](#offsetLeft) | Number | `0` | left position relative to which Excalidraw should be rendered |
133
+| [`offsetTop`](#offsetTop) | Number | `0` | top position relative to which Excalidraw should render |
134
+| [`onChange`](#onChange) | Function |  | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw elements and the current app state. |
135
+| [`initialData`](#initialData) | <pre>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37">AppState<a> } </pre> | null | The initial data with which app loads. |
136
+| [`user`](#user) | `{ name?: string }` |  | User details. The name refers to the name of the user to be shown |
137
+| [`excalidrawRef`](#excalidrawRef) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) or [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) or <pre>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</pre> |  | Ref to be passed to Excalidraw |
138
+| [`onCollabButtonClick`](#onCollabButtonClick) | Function |  | Callback to be triggered when the collab button is clicked |
139
+| [`isCollaborating`](#isCollaborating) | `boolean` |  | This implies if the app is in collaboration mode |
140
+| [`onPointerUpdate`](#onPointerUpdate) | Function |  | Callback triggered when mouse pointer is updated. |
141
+| [`onExportToBackend`](#onExportToBackend) | Function |  | Callback triggered when link button is clicked on export dialog |
142
+| [`langCode`](#langCode) | string | `en` | Language code string |
143
+| [`renderFooter `](#renderFooter) | Function |  | Function that renders custom UI footer |
144 144
 
145 145
 #### `width`
146 146
 
@@ -174,13 +174,12 @@ Here you can try saving the data to your backend or local storage for example.
174 174
 
175 175
 #### `initialData`
176 176
 
177
-This helps to load Excalidraw with `initialData`.
178
-It must be an object or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to an object containing the below optional fields.
177
+This helps to load Excalidraw with `initialData`. It must be an object or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to an object containing the below optional fields.
179 178
 
180
-| name     | type                                                                                                  |
181
-| -------- | ----------------------------------------------------------------------------------------------------- |
179
+| name | type |
180
+| --- | --- |
182 181
 | elements | [ExcalidrawElement []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) |
183
-| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37)                     |
182
+| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37) |
184 183
 
185 184
 ```json
186 185
 {
@@ -219,19 +218,18 @@ This is the user name which shows during collaboration. Defaults to `{name: ''}`
219 218
 
220 219
 #### `excalidrawRef`
221 220
 
222
-You can pass a `ref` when you want to access some excalidraw APIs.
223
-We expose the below APIs:
221
+You can pass a `ref` when you want to access some excalidraw APIs. We expose the below APIs:
224 222
 
225
-| API                              | signature                                                                                                                              | Usage                                                                                                                                                                                                                                            |
226
-| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
227
-| ready                            | `boolean`                                                                                                                              | This is set to true once Excalidraw is rendered                                                                                                                                                                                                  |
228
-| readyPromise                     | [resolvablePromise](https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317)                                            | This promise will be resolved with the api once excalidraw has rendered. This will be helpful when you want do some action on the host app once this promise resolves. For this to work you will have to pass ref as shown [here](#readyPromise) |
229
-| updateScene                      | <pre>(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L189">sceneData</a>)) => void </pre>                  | updates the scene with the sceneData                                                                                                                                                                                                             |
230
-| resetScene                       | `({ resetLoadingState: boolean }) => void`                                                                                             | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false.                                                                                                                               |
231
-| getSceneElementsIncludingDeleted | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement []</a></pre>     | Returns all the elements including the deleted in the scene                                                                                                                                                                                      |
232
-| getSceneElements                 | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement []</a></pre>     | Returns all the elements excluding the deleted in the scene                                                                                                                                                                                      |
233
-| history                          | `{ clear: () => void }`                                                                                                                | This is the history API. `history.clear()` will clear the history                                                                                                                                                                                |
234
-| setScrollToCenter                | <pre> (<a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>) => void </pre> | sets the elements to center                                                                                                                                                                                                                      |
223
+| API | signature | Usage |
224
+| --- | --- | --- |
225
+| ready | `boolean` | This is set to true once Excalidraw is rendered |
226
+| readyPromise | [resolvablePromise](https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317) | This promise will be resolved with the api once excalidraw has rendered. This will be helpful when you want do some action on the host app once this promise resolves. For this to work you will have to pass ref as shown [here](#readyPromise) |
227
+| updateScene | <pre>(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L189">sceneData</a>)) => void </pre> | updates the scene with the sceneData |
228
+| resetScene | `({ resetLoadingState: boolean }) => void` | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false. |
229
+| getSceneElementsIncludingDeleted | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement []</a></pre> | Returns all the elements including the deleted in the scene |
230
+| getSceneElements | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement []</a></pre> | Returns all the elements excluding the deleted in the scene |
231
+| history | `{ clear: () => void }` | This is the history API. `history.clear()` will clear the history |
232
+| setScrollToCenter | <pre> (<a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>) => void </pre> | sets the elements to center |
235 233
 
236 234
 #### `readyPromise`
237 235
 
@@ -275,17 +273,16 @@ This callback is triggered when the shareable-link button is clicked in the expo
275 273
 
276 274
 #### `langCode`
277 275
 
278
-Determines the language of the UI. It should be one of the [available language codes](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L14). Defaults to `en` (English).
279
-We also export default language and supported languages which you can import as shown below.
276
+Determines the language of the UI. It should be one of the [available language codes](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L14). Defaults to `en` (English). We also export default language and supported languages which you can import as shown below.
280 277
 
281 278
 ```js
282 279
 import { defaultLang, languages } from "@excalidraw/excalidraw";
283 280
 ```
284 281
 
285
-| name        | type                                                                               |
286
-| ----------- | ---------------------------------------------------------------------------------- |
287
-| defaultLang | string                                                                             |
288
-| languages   | [Language []](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L8) |
282
+| name | type |
283
+| --- | --- |
284
+| defaultLang | string |
285
+| languages | [Language []](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L8) |
289 286
 
290 287
 #### `renderFooter`
291 288
 

+ 1
- 3
src/packages/utils/CHANGELOG.md View File

@@ -4,6 +4,4 @@
4 4
 
5 5
 First release of `@excalidraw/utils` to provide utilities functions.
6 6
 
7
-- Added `exportToBlob` and `exportToSvg` to export an Excalidraw diagram definition, respectively,
8
-  to a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) and
9
-  to a [SVGElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement) ([#2246](https://github.com/excalidraw/excalidraw/pull/2246))
7
+- Added `exportToBlob` and `exportToSvg` to export an Excalidraw diagram definition, respectively, to a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) and to a [SVGElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement) ([#2246](https://github.com/excalidraw/excalidraw/pull/2246))

+ 1
- 2
src/packages/utils/README.md View File

@@ -24,8 +24,7 @@ Export an Excalidraw diagram to a [SVGElement](https://developer.mozilla.org/en-
24 24
 
25 25
 ## Usage
26 26
 
27
-Excalidraw utils is published as a UMD (Universal Module Definition).
28
-If you are using a Web bundler (for instance, Webpack), you can import it as an ES6 module:
27
+Excalidraw utils is published as a UMD (Universal Module Definition). If you are using a Web bundler (for instance, Webpack), you can import it as an ES6 module:
29 28
 
30 29
 ```js
31 30
 import { exportToSvg, exportToBlob } from "@excalidraw/utils";

Loading…
Cancel
Save