Skip to content

Commit 50ee29c

Browse files
chore: workflow cleanup and release process adjustments (#2663)
### 🎯 Goal - [x] created a dedicated action for setting up Node environment with own cacheing mechanism (like in `stream-chat`), this action is now used by all existing workflows - [x] adjusted `pr-title.yml` to use existing `@commitlint/cli` package (used in `commit-msg` Husky hook) - [x] adjusted how the next version is acquired - [npm publish](https://docs.npmjs.com/cli/v10/using-npm/scripts#npm-publish) runs `prepack` hook during which the next version is already defined within `package.json#version` so we can grab it from there when running build which now runs only once during the release process - [x] changed `__STREAM_CHAT_REACT_VERSION__` to `process.env.STREAM_CHAT_REACT_VERSION` which can be populated through ESBuild's `define` property, dropping `esbuild-plugin-replace`, `bundle-esm.mjs` uses this new string to replace too - [x] removed `docs_release` from the `release.yml` (not needed anymore) - [x] upgraded `actions/{cache,checkout,setup-node}` to v4 - [x] remove `docusaurus` and `docs` folders
1 parent c7ca963 commit 50ee29c

File tree

762 files changed

+393
-62001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

762 files changed

+393
-62001
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Create a report to help us improve
44
title: 'bug:'
55
labels: 'bug, status: unconfirmed'
66
assignees: ''
7-
87
---
98

109
**Describe the bug**
@@ -14,6 +13,7 @@ A clear and concise description of what the bug is.
1413
**To Reproduce**
1514

1615
Steps to reproduce the behavior:
16+
1717
1. Go to '...'
1818
2. Click on '....'
1919
3. Scroll down to '....'
@@ -28,6 +28,7 @@ A clear and concise description of what you expected to happen.
2828
If applicable, add screenshots to help explain your problem.
2929

3030
**Package version**
31+
3132
- stream-chat-react:
3233
- stream-chat-css:
3334
- stream-chat-js:

.github/ISSUE_TEMPLATE/feature_request.md

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Describe a new feature
44
title: ''
55
labels: feature
66
assignees: ''
7-
87
---
98

109
**Motivation**

.github/actions/setup-node/action.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Setup
2+
description: Sets up Node and installs dependencies
3+
4+
inputs:
5+
node-version:
6+
description: 'Specify Node version'
7+
required: false
8+
default: '22'
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Setup Node
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: ${{ inputs.node-version }}
17+
18+
- name: Set NODE_VERSION env
19+
shell: bash
20+
run: echo "NODE_VERSION=$(node --version)" >> $GITHUB_ENV
21+
22+
- name: Cache dependencies
23+
uses: actions/cache@v4
24+
with:
25+
path: ./node_modules
26+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('./yarn.lock') }}
27+
28+
- name: Install dependencies
29+
run: yarn install --frozen-lockfile
30+
shell: bash

.github/workflows/ci.yml

+13-34
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,37 @@
11
name: Test
22

33
on: [push]
4-
env:
5-
NODE_OPTIONS: --max_old_space_size=4096
64

75
jobs:
86
tsc:
97
runs-on: ubuntu-latest
10-
name: Typescript
8+
name: TypeScript
119
steps:
12-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1311

14-
- name: 💾 Cache Dependencies
15-
uses: actions/cache@v3
16-
with:
17-
path: ./node_modules
18-
key: ${{ runner.os }}-${{ matrix.node }}-modules-${{ hashFiles('**/yarn.lock') }}
19-
20-
- name: 🔨 Install Dependencies
21-
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
12+
- uses: ./.github/actions/setup-node
2213

2314
- name: 🧪 tsc
24-
run: yarn types --noEmit
15+
run: yarn types
2516

2617
test:
2718
runs-on: ubuntu-latest
28-
strategy:
29-
matrix:
30-
node: [22]
31-
name: Test with Node ${{ matrix.node }}
19+
name: Lint & test with Node
3220
steps:
33-
- uses: actions/checkout@v3
34-
- uses: actions/setup-node@v3
35-
with:
36-
node-version: ${{ matrix.node }}
37-
38-
- name: 💾 Cache Dependencies
39-
uses: actions/cache@v3
40-
with:
41-
path: ./node_modules
42-
key: ${{ runner.os }}-${{ matrix.node }}-modules-${{ hashFiles('**/yarn.lock') }}
43-
44-
- name: 🔨 Install Dependencies & Build
45-
run: |
46-
yarn install --frozen-lockfile --ignore-engines
47-
yarn build
21+
- uses: actions/checkout@v4
22+
23+
- uses: ./.github/actions/setup-node
24+
25+
- name: Build SDK
26+
run: yarn build
4827

49-
- name: 🧪 Lint and Test with ${{ matrix.node }}
28+
- name: 🧪 Lint and test with Node ${{ env.NODE_VERSION }}
5029
env:
5130
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5231
run: |
5332
yarn lint
5433
yarn coverage
5534
yarn validate-translations
5635
57-
- name: 🧪 Validate CommonJS bundle with ${{ matrix.node }}
36+
- name: 🧪 Validate CommonJS bundle with Node ${{ env.NODE_VERSION }}
5837
run: yarn validate-cjs

.github/workflows/pr-check.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ on:
55
types: [opened, edited, synchronize, reopened]
66

77
jobs:
8-
lint:
8+
pr-title:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: aslafy-z/conventional-pr-title-action@v3
12-
env:
13-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
- uses: actions/checkout@v4
12+
13+
- uses: ./.github/actions/setup-node
14+
15+
- name: commitlint
16+
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --verbose

.github/workflows/release.yml

+7-58
Original file line numberDiff line numberDiff line change
@@ -2,81 +2,30 @@ name: Release
22
on:
33
workflow_dispatch:
44
inputs:
5-
docs_only:
6-
description: Skip package release and publish documentation only
7-
default: false
8-
type: boolean
9-
skip_docs:
10-
description: Skip publishing the documentation
11-
default: false
12-
type: boolean
135
dry_run:
14-
description: Run package release in "dry run" mode (does not publish either)
6+
description: Run package release in "dry run" mode (does not publish)
157
default: false
168
type: boolean
17-
docs_env:
18-
description: Pick environment to publish documentation to
19-
required: true
20-
type: choice
21-
default: staging
22-
options:
23-
- production
24-
- staging
259

2610
jobs:
2711
package_release:
2812
name: Release from "${{ github.ref_name }}" branch
2913
runs-on: ubuntu-latest
3014
# GH does not allow to limit branches in the workflow_dispatch settings so this here is a safety measure
31-
if: ${{ !inputs.docs_only && (startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'master')) }}
32-
env:
33-
NODE_OPTIONS: --max_old_space_size=4096
15+
if: ${{ inputs.dry_run || startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'master') }}
3416
steps:
3517
- name: Checkout
36-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
3719
with:
3820
fetch-depth: 0
39-
- name: Setup Node.js
40-
uses: actions/setup-node@v3
41-
with:
42-
node-version: 20
43-
- name: Install dependencies & Build
44-
run: |
45-
yarn install --frozen-lockfile
46-
yarn run build
47-
- name: Validate CommonJS bundle
48-
run: yarn validate-cjs
21+
22+
- uses: ./.github/actions/setup-node
23+
4924
- name: Release
5025
env:
5126
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
GITHUB_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}
5428
HUSKY: 0
5529
run: >
5630
yarn semantic-release
5731
${{ inputs.dry_run && '--dry-run' || '' }}
58-
59-
docs_release:
60-
name: Publish documentation from "${{ github.ref_name }}" branch to ${{ inputs.docs_env }}
61-
runs-on: ubuntu-latest
62-
# skip during dry runs, publish to production only from master or branches with names starting with "release", publish to staging from anywhere
63-
if: ${{ !inputs.dry_run && !inputs.skip_docs && (((github.ref_name == 'master' || startsWith(github.ref_name, 'release')) && inputs.docs_env == 'production') || inputs.docs_env == 'staging') }}
64-
outputs:
65-
target-version: $${{ steps.target-version.outputs }}
66-
steps:
67-
- name: Checkout
68-
uses: actions/checkout@v3
69-
- name: Setup Node.js
70-
uses: actions/setup-node@v3
71-
with:
72-
node-version: 20
73-
- name: Install dependencies
74-
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
75-
- name: Merge shared "@stream-io/stream-chat-css" docs
76-
run: yarn docs:copy-css-docs
77-
- name: Push to stream-chat-docusaurus
78-
uses: GetStream/push-stream-chat-docusaurus-action@main
79-
with:
80-
target-branch: ${{ inputs.docs_env }}
81-
env:
82-
DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}

.github/workflows/size.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- uses: preactjs/compressed-size-action@v2
1919
with:
2020
repo-token: '${{ secrets.GITHUB_TOKEN }}'

.ladle/config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// https://www.ladle.dev/docs/config
22
export default {
33
envPrefix: 'E2E_',
4-
}
4+
};

.lintstagedrc.fix.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"src/**/*.{js,ts,tsx,md}": "eslint --fix",
3-
"{src/**/*.{js,ts,tsx,md,json}, .eslintrc.json, .prettierrc, babel.config.js}": "prettier --write"
3+
"**/*.{js,mjs,ts,mts,jsx,tsx,md,json,yml}": "prettier --write"
44
}

.lintstagedrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"src/**/*.{js,ts,tsx,md}": "eslint --max-warnings 0",
3-
"{src/**/*.{js,ts,tsx,md,json}, .eslintrc.json, .prettierrc, babel.config.js}": "prettier --list-different",
3+
"**/*.{js,mjs,ts,mts,jsx,tsx,md,json,yml}": "prettier --list-different",
44
"src/i18n/*.json": "yarn run validate-translations"
55
}

.prettierignore

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
node_modules
2-
/.cache/
3-
/public/static/styles.js
4-
examples/*/src/serviceWorker.js
5-
src/stream-emoji.json
6-
/dist/
7-
/lib/
8-
/bin/
9-
/include/
10-
/build/
11-
build
12-
*.md
13-
src/components/docs/
1+
node_modules/
2+
CHANGELOG.md
3+
examples/**/serviceWorker.ts
4+
./dist/

.releaserc.json

-6
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@
7171
}
7272
}
7373
],
74-
[
75-
"@semantic-release/exec",
76-
{
77-
"prepareCmd": "NEXT_VERSION=${nextRelease.version} npm run build"
78-
}
79-
],
8074
[
8175
"@semantic-release/changelog",
8276
{

CONTRIBUTING.md

+19-10
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,46 @@ As a contributor, here are the guidelines we would like you to follow:
88
- [Submission Guidelines](#submission-guidelines)
99
- [Signing the CLA](#contributor-licence-agreement)
1010

11-
1211
## <a name="asking-questions"></a>Are you looking for answers?
12+
1313
There are many ways you can get your questions answered. It can be hard to decide, where to begin if you are just starting out. We suggest you take a look at the resources in the following order:
1414

1515
### 1. Stream chat API documentation
16-
Package `stream-chat-react` has a peer dependency [stream-chat-js](https://github.com/GetStream/stream-chat-js) - a client library for interacting with the Stream Chat API (see the [API docs](https://getstream.io/chat/docs/javascript/?language=javascript)).
16+
17+
Package `stream-chat-react` has a peer dependency [stream-chat-js](https://github.com/GetStream/stream-chat-js) - a client library for interacting with the Stream Chat API (see the [API docs](https://getstream.io/chat/docs/javascript/?language=javascript)).
1718

1819
### 2. Documentation for stream-chat-react
20+
1921
The [stream-chat-react](https://getstream.io/chat/docs/sdk/react/) documentation is held separately from the Stream Chat API docs. Besides documenting the component API, it provides examples of their use in various scenarios.
2022

2123
### 3. Read the source code
24+
2225
When you plan on contributing to the repository try to get acquainted with the existing code base. The best way to learn :)
2326

2427
### 4. Take a look at our tutorials
2528

26-
2729
### Get help from our Customer Success team
28-
If what you are looking for is technical support embedding Stream in your application, we suggest emailing our Customer Success team at support@getstream.io with your application key and the SDK versions you're using. The Issue section of this GitHub repo is now reserved only for bug reports, feature improvements and suggestions.
2930

31+
If what you are looking for is technical support embedding Stream in your application, we suggest emailing our Customer Success team at support@getstream.io with your application key and the SDK versions you're using. The Issue section of this GitHub repo is now reserved only for bug reports, feature improvements and suggestions.
3032

3133
## <a name="filing-an-issue"></a>Filing an issue
32-
Spotting imperfections and not keeping them to yourself is the first step to make this library better. We are very grateful for reports concerning imperfections in the source code or the [documentation]((https://getstream.io/chat/docs/sdk/react/)). Before filing an issue, please, review the list of [open issues](https://github.com/GetStream/stream-chat-react/issues) first.
34+
35+
Spotting imperfections and not keeping them to yourself is the first step to make this library better. We are very grateful for reports concerning imperfections in the source code or the [documentation](<(https://getstream.io/chat/docs/sdk/react/)>). Before filing an issue, please, review the list of [open issues](https://github.com/GetStream/stream-chat-react/issues) first.
3336

3437
### Reporting bugs
35-
You can report a source code bug by using the [Bug Report template](https://github.com/GetStream/stream-chat-react/issues/new/choose). Make sure you include "steps to reproduce" section. Bug that cannot be reproduced cannot be solved.
3638

37-
Do not be afraid to report imperfections in our [documentation]((https://getstream.io/chat/docs/sdk/react/)) as well. In such case, please attach the `docs` tag to the issue.
39+
You can report a source code bug by using the [Bug Report template](https://github.com/GetStream/stream-chat-react/issues/new/choose). Make sure you include "steps to reproduce" section. Bug that cannot be reproduced cannot be solved.
3840

41+
Do not be afraid to report imperfections in our [documentation](<(https://getstream.io/chat/docs/sdk/react/)>) as well. In such case, please attach the `docs` tag to the issue.
3942

4043
### Requesting a feature
44+
4145
You can request a feature by submitting a [Feature request issue](https://github.com/GetStream/stream-chat-react/issues/new?assignees=&labels=feature&template=feature_request.md&title=) in our repository. If you would like to implement the proposal, please state it in the issue. It will allow us to discuss the proposal and better coordinate the efforts. You can even ping us - mention `@GetStream/stream-react-developers ` in the issue.
4246

4347
## <a name="contribution-standards"></a> Contributing to the repo
4448

4549
### Set up for success
50+
4651
It is always good to get acquainted with the specifics of the package. For example the `stream-chat-react` package has its peer dependencies (`stream-chat-js`, `stream-chat-css`), which you may need to tweak at the same time, while developing the feature for `stream-chat-react`. To get more into those specifics, please read [development guide](./developers/DEVELOPMENT.md).
4752

4853
### Good first issue
@@ -51,28 +56,32 @@ It is always good to get acquainted with the specifics of the package. For examp
5156
Any contributions to the library should follow Stream's coding rules.
5257

5358
#### 1. Code should be tested
59+
5460
All the code submitted should be covered by unit tests. Mocking utilities are provided in `src/mock-builders`. Optimally a suite of E2E tests should be included as well.
5561

5662
#### 2. API Changes should be documented
63+
5764
Changes to components interface exposed to the library integrators should be documented. We keep the documentation `docusaurus/docs/React` folder. Please see the [dedicated documentation guide](./developers/DOCUMENTATION.md) for more information on how to maintain our documentation.
5865

5966
#### 3. Code should be DRY & correctly formatted
67+
6068
If you find yourself copying source code from one place to another, please extract it into a separate component or function.
6169

6270
#### 4. Keep an eye on performance
71+
6372
Keep in mind that the chat application may need to work with thousands of messages.
6473

6574
#### 5. Follow commit formatting rules
66-
We follow [Angular's Commit Message Format rules](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format) with [possible deviations](./developers/COMMIT.md). The same rules are used by our release automation tool. Therefore, every commit message should strictly comply with these rules.
6775

76+
We follow [Angular's Commit Message Format rules](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format) with [possible deviations](./developers/COMMIT.md). The same rules are used by our release automation tool. Therefore, every commit message should strictly comply with these rules.
6877

6978
## <a name="submission-guidelines"></a> Submitting your work
79+
7080
1. Make sure you have signed our Contributor License agreement
7181
2. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the repo and create a dedicated git branch locally
7282
3. Follow the [coding rules](#coding-rules)
7383
4. Create a descriptive PR ([see more on PR requirements](./developers/PR_REVIEW.md))
7484

75-
7685
## <a name="contributor-licence-agreement"></a> Contributor License Agreement
77-
Before we can merge your contribution into our repository, we would like to ask you to sign the [Contributor License Agreement](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform).
7886

87+
Before we can merge your contribution into our repository, we would like to ask you to sign the [Contributor License Agreement](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform).

0 commit comments

Comments
 (0)