Skip to content

Commit 40c2cbd

Browse files
committed
Scaffold out package
0 parents  commit 40c2cbd

20 files changed

+1285
-0
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
6+
[*.{ts,tsx,js,json}]
7+
indent_style = space
8+
indent_size = 4

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Setup CI
2+
description: Sets up the CI environment with things we always need
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup Bun package manager
8+
uses: oven-sh/setup-bun@v1
9+
with:
10+
bun-version: 1.2.21
11+
12+
- name: Install dependencies
13+
run: |
14+
if ! bun install --frozen-lockfile 2>&1 | tee output.txt; then
15+
if grep -q "error: lockfile had changes, but lockfile is frozen" output.txt; then
16+
echo "::group::Lockfile diff"
17+
git diff bun.lock
18+
echo "::endgroup::"
19+
fi
20+
rm output.txt
21+
exit 1
22+
fi
23+
rm output.txt
24+
shell: bash
25+
26+
- name: Check for bun.lock changes
27+
run: git diff --exit-code -- bun.lock
28+
shell: bash

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize]
9+
10+
env:
11+
DO_NOT_TRACK: 1
12+
13+
jobs:
14+
build:
15+
name: Build and Test
16+
timeout-minutes: 15
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest]
21+
22+
steps:
23+
- name: Check out code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup CI
27+
uses: ./.github/actions/ci-setup
28+
29+
- name: Check TypeScript
30+
run: bun run check-typescript
31+
32+
- name: Check Biome
33+
run: bun run check-biome
34+
35+
- name: Check Syncpack
36+
run: bun run check-syncpack
37+
38+
- name: Check CSpell
39+
run: bun run check-cspell
40+

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
env:
11+
DO_NOT_TRACK: 1
12+
13+
jobs:
14+
release:
15+
name: Release
16+
if: github.repository == 'attio/react-native-bottom-sheet-toolbox'
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 20
19+
permissions:
20+
contents: write
21+
issues: write
22+
pull-requests: write
23+
steps:
24+
- name: Check out code (full history)
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 22.16.0
33+
34+
- name: Setup CI
35+
uses: ./.github/actions/ci-setup
36+
37+
- name: Create Release Pull Request or Publish to npm
38+
uses: changesets/action@v1
39+
with:
40+
publish: bun run changeset-publish
41+
version: bun run changeset-version
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
lib
3+
out-tsc

.syncpackrc.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"$schema": "node_modules/syncpack/schema.json",
3+
"indent": " ",
4+
"sortAz": [
5+
"bin",
6+
"contributors",
7+
"scripts",
8+
"keywords",
9+
"dependencies",
10+
"peerDependencies",
11+
"resolutions"
12+
],
13+
"sortFirst": [
14+
"private",
15+
"name",
16+
"description",
17+
"version",
18+
"author",
19+
"license",
20+
"keywords",
21+
"bugs",
22+
"homepage",
23+
"repository",
24+
"type",
25+
"main",
26+
"source",
27+
"react-native",
28+
"types",
29+
"files",
30+
"module",
31+
"exports",
32+
"imports",
33+
"engines",
34+
"packageManager",
35+
"scripts",
36+
"dependencies",
37+
"devDependencies",
38+
"peerDependencies",
39+
"trustedDependencies",
40+
"resolutions",
41+
"workspaces"
42+
],
43+
"sortPackages": true,
44+
"source": ["package.json"],
45+
"versionGroups": [
46+
{
47+
"dependencies": ["$LOCAL"],
48+
"dependencyTypes": ["dev"],
49+
"pinVersion": "workspace:^"
50+
}
51+
]
52+
}

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["streetsidesoftware.code-spell-checker", "biomejs.biome"]
3+
}

.vscode/settings.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"typescript.enablePromptUseWorkspaceTsdk": true,
4+
"typescript.tsserver.maxTsServerMemory": 4096,
5+
"[json]": {
6+
"editor.defaultFormatter": "biomejs.biome"
7+
},
8+
"[jsonc]": {
9+
"editor.defaultFormatter": "biomejs.biome"
10+
},
11+
"[javascript]": {
12+
"editor.defaultFormatter": "biomejs.biome"
13+
},
14+
"[typescript]": {
15+
"editor.defaultFormatter": "biomejs.biome"
16+
},
17+
"[typescriptreact]": {
18+
"editor.defaultFormatter": "biomejs.biome"
19+
},
20+
"editor.codeActionsOnSave": {
21+
"source.organizeImports.biome": "explicit",
22+
"source.fixAll.biome": "explicit"
23+
},
24+
"biome.suggestInstallingGlobally": false,
25+
"biome.requireConfiguration": true,
26+
"files.eol": "\n"
27+
}

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# React Data List
2+
3+
A library for composing data arrays using React components.
4+
5+
## Why?
6+
7+
Universal List is an API for composing together lists.
8+
9+
In React Native world, virtualized lists are modelled with a flat array of data, along with a render function that describes how to render items. Most of our screens tend to be represented virtualized lists. It's a pillar to how we build.
10+
11+
However, building this data array can be really difficult. The straightforward approach is to simply have a dataFetchable that's the result of a single useNexusSelector call. However quickly becomes a problem when you want to have granular control over loading states (e.g. if we fail to load a single notification then don't poison the entire fetchable) or especially when you want to compose familiar data & render logic across screens (e.g. task picker items on the record detail page). When you need to solve both of those problems you quickly end up in a real mess with data selectors that are hundreds of lines long and not approachable.
12+
13+
Universal List allows you to model the creation of this data array in React JSX, encouraging the use of Suspense and Error Boundaries to achieve the behaviors you want. Nexus has first-class support for these wider React concepts, so the ergonomics are quite nice.
14+
15+
## How does it work?
16+
17+
There are two main concepts: **row** and **renderer**.
18+
A **row** syncs some data and a render function to the list. The universal list then processes this into an aggregated data array, render function and other typical list functions. These then get passed into a renderer which takes the Universal List format and translates it into inputs for some list component, like FlashList. We refer to the item data that a row syncs as its **descriptor**
19+
20+
## Release Process
21+
22+
This repo uses **Changesets** for versioning and **GitHub Actions** for automated publishing.
23+
24+
### 1. Create Changesets for Changes
25+
26+
```bash
27+
# Generate a changeset for your changes
28+
bunx changeset
29+
```
30+
31+
- Select which packages are affected by your changes
32+
- Choose the appropriate semantic version bump (patch, minor, major)
33+
- Write a descriptive summary of the changes
34+
- Commit the generated changeset file in `.changeset/`
35+
36+
### 2. Automated Version Management
37+
38+
When you push to the `master` branch, the GitHub Action will:
39+
40+
- **Create a Release PR**: If there are pending changesets, it creates a "Version Packages" PR with updated version numbers, CHANGELOGs, and consumed changeset files
41+
42+
### 3. Release Publication
43+
44+
When the "Version Packages" PR is merged:
45+
46+
- **Automated Build**: Builds only packages using `bun run build-release`
47+
- **Automated Publishing**: Publishes updated packages to NPM via `changeset publish`
48+
- **Git Tagging**: Creates appropriate git tags for the released versions
49+
50+
### Manual Release (if needed)
51+
52+
```bash
53+
# 1. Create changesets for changes
54+
bunx changeset
55+
56+
# 2. Version packages (updates versions + CHANGELOGs)
57+
bun run changeset-version
58+
59+
# 3. Build and publish
60+
bun run changeset-publish
61+
```

0 commit comments

Comments
 (0)