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: CONTRIBUTING.md
+63-3
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ With this in mind feature requests and PRs that greatly expand its scope will li
10
10
11
11
We encourage pull requests concerning:
12
12
13
-
* Bugs in this library
14
-
* New tests for React
15
-
* Documentation
13
+
- Bugs in this library
14
+
- New tests for React
15
+
- Documentation
16
16
17
17
## Development
18
18
@@ -25,6 +25,7 @@ Make changes/updates to the `src/index.ts` file.
25
25
### Verify updates with the examples
26
26
27
27
Build, run, and test examples locally:
28
+
28
29
```sh
29
30
# Go into examples folder
30
31
react-swipeable$ cd examples
@@ -43,6 +44,7 @@ You can now make updates/changes to `src/index.ts` and webpack will rebuild, the
43
44
Our builds run unit tests, lint, prettier, compile/build, and watch package size via [size-limit](https://github.com/ai/size-limit/).
44
45
45
46
All these steps can be verified via a single command.
47
+
46
48
```sh
47
49
# validate all the things
48
50
yarn test
@@ -80,20 +82,74 @@ $ yarn run format
80
82
```
81
83
82
84
If you see this error:
85
+
83
86
```
84
87
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
85
88
```
89
+
86
90
Then run the formatter:
91
+
87
92
```sh
88
93
$ yarn run format
89
94
```
90
95
96
+
### Using changesets
97
+
98
+
Our official release path is to use automation to perform the actual publishing of our packages. The steps are to:
99
+
100
+
1. A human developer adds a changeset. Ideally this is as a part of a PR that will have a version impact on a package.
101
+
2. On merge of a PR our automation system opens a "Version Packages" PR.
102
+
3. On merging the "Version Packages" PR, the automation system publishes the packages.
103
+
104
+
Here are more details:
105
+
106
+
### Add a changeset
107
+
108
+
When you would like to add a changeset (which creates a file indicating the type of change), in your branch/PR issue this command:
109
+
110
+
```sh
111
+
$ yarn changeset
112
+
```
113
+
114
+
to produce an interactive menu. Navigate the packages with arrow keys and hit `<space>` to select 1+ packages. Hit `<return>` when done. Select semver versions for packages and add appropriate messages. From there, you'll be prompted to enter a summary of the change. Some tips for this summary:
115
+
116
+
1. Aim for a single line, 1+ sentences as appropriate.
117
+
2. Include issue links in GH format (e.g. `#123`).
118
+
3. You don't need to reference the current pull request or whatnot, as that will be added later automatically.
119
+
120
+
After this, you'll see a new uncommitted file in `.changesets` like:
121
+
122
+
```sh
123
+
$ git status
124
+
# ....
125
+
Untracked files:
126
+
(use "git add <file>..." to include in what will be committed)
127
+
.changeset/flimsy-pandas-marry.md
128
+
```
129
+
130
+
Changeset will use a randomly generated file name for the markdown description file.
131
+
132
+
Review the file, make any necessary adjustments, and commit it to source. When we eventually do a package release, the changeset notes and version will be incorporated!
133
+
134
+
### Creating versions
135
+
136
+
On a merge of a feature PR, the changesets GitHub action will open a new PR titled `"Version Packages"`. This PR is automatically kept up to date with additional PRs with changesets. So, if you're not ready to publish yet, just keep merging feature PRs and then merge the version packages PR later.
137
+
138
+
### Publishing packages
139
+
140
+
On the merge of a version packages PR, the changesets GitHub action will publish the packages to npm.
141
+
91
142
## Project Maintainers
143
+
144
+
### Manual publish method
145
+
146
+
<detail>
92
147
### Releasing a new version
93
148
1. Publish to npm
94
149
2. Update version in `examples`
95
150
96
151
#### 1. Publish to npm
152
+
97
153
```sh
98
154
# (1) Runs tests, lint, build published dir, updates package.json
99
155
$ npm version [patch|minor|major|<version>]
@@ -108,18 +164,22 @@ $ git push --follow-tags
108
164
#### 2. Update version in the examples
109
165
110
166
After publishing a new version to npm we need to make sure the `examples` get updated.
167
+
111
168
1. Bump the `react-swipeable` version in `examples/package.json` to the new just released version
112
169
2. Run `yarn` to install and update the lock file
113
170
3. Push changes to `main` branch so the codesandbox examples get updated
114
171
4. Build and deploy updated examples to github pages
115
172
173
+
</detail>
174
+
116
175
### Building and deploying examples to github pages
117
176
118
177
The examples build using the most recent version of `react-swipeable`.
119
178
120
179
Make sure you've already completed the above steps for `Update version in the examples` so the `examples` have the most recent version installed.
0 commit comments