Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc.js

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/code-quality-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Code quality checks

on:
pull_request:

jobs:
ci:
name: Build, lint and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build packages
run: npx turbo run build

- name: Run linting
run: npx turbo run lint

- name: Run tests
run: npx turbo run test
39 changes: 0 additions & 39 deletions .github/workflows/pull-request.yml

This file was deleted.

74 changes: 44 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,63 @@
name: Version and publish
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
name: Publish to npm
release-please:
name: Create release PR
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
paths_released: ${{ steps.release.outputs.paths_released }}
steps:
- uses: actions/checkout@v3
- uses: googleapis/release-please-action@v4
id: release
with:
fetch-depth: 0
token: ${{ secrets.REPO_ADMIN_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version: lts/gallium
publish:
name: Publish to npm
needs: release-please
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Sync packages with cache
uses: actions/cache@v3
- uses: actions/setup-node@v4
with:
path: ./node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-node_modules-
node-version: 22
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install packages
run: yarn install --frozen-lockfile
- name: Install dependencies
run: npm ci

- name: Build packages
run: yarn build

- name: Config git user
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"

- name: Generate .npmrc
run: yarn generate:npmrc:ci
run: npx turbo run build

- name: Bump versions and publish packages
- name: Publish packages
run: |
yarn version:lerna:ci
yarn publish:lerna:ci
for dir in packages/*/; do
if [ -f "$dir/package.json" ]; then
name=$(node -p "require('./$dir/package.json').name")
version=$(node -p "require('./$dir/package.json').version")
published=$(npm view "$name@$version" version 2>/dev/null || echo "")
if [ "$published" != "$version" ]; then
echo "Publishing $name@$version..."
npm publish "$dir" --access public
else
echo "Skipping $name@$version (already published)"
fi
fi
done
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
.DS_Store
.idea
.history
.jest-*
lib
node_modules

.npmrc

/packages/*/dist
/packages/*/esm
/packages/*/node_modules

coverage
.parcel-cache
.turbo
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx turbo run build lint test --affected
4 changes: 4 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"packages/tsconfig": "0.0.0",
"packages/biome-config": "0.0.0"
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"recommendations": [],
"recommendations": ["biomejs.biome"],
"unwantedRecommendations": []
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"activityBar.inactiveForeground": "#cbceda",
"activityBarBadge.background": "#425deb",
"activityBarBadge.foreground": "#f8f8fb"
},
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
91 changes: 46 additions & 45 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,74 @@
# Bothrs Open Source
# Nimble Open Source

## Monorepo

The Bothrs Open Source project is built in a monorepo structure. This allows us to put different packages in the same repository, and have everything managed by a central configuration.
This monorepo contains shared configuration packages for Nimble projects.

We use (Lerna)[https://lerna.js.org/] to manage dependencies and to build, version, publish the monorepo.
We use [Turborepo](https://turbo.build/) for build orchestration, [npm workspaces](https://docs.npmjs.com/cli/using-npm/workspaces) for dependency management, and [Release Please](https://github.com/googleapis/release-please) for automated versioning, changelogs, and publishing.

## Setup the project
Legacy `@bothrs/` packages have been deprecated on npm and their source code is preserved on the `archive/legacy-packages` branch.

To set up the project for the first time, run `yarn install` in the root of the projects. This will install all de dependencies (and dev-dependencies) for the project.
## Packages

When yarn has finished the initial install, all other dependency related commands need to be run with `lerna`.
- `@nimble/tsconfig` — Shared TypeScript configurations
- `@nimble/biome-config` — Shared Biome linting and formatting configuration

- `yarn install` => `lerna bootstrap`
- `yarn add <package>` => `lerna add <package> --scope=<module-name>` (e.g. `lerna add @bothrs/math --scope=@bothrs/react-native-layouts`)
-
## Setup

## Create new package
```bash
npm install
```

Create a new directory in the `./packages` directory.

### Pure TS package

Open your package directory and run 'yarn init' there.

Make sure the following info is correct:

- The version field 0.0.0
- The name field uses the @bothrs namespace. e.g., `@bothrs/<your-package-name>`
- Your package.json has a `build`, `test` and `lint` script.

> Note: If you need an example check out the `@bothrs/airtable` package.
## Development

### React native package
### Building

Open your package directory and run `npx react-native-builder-bob init`.
```bash
npm run build
```

Make sure the following info is correct:
### Creating a new package

- The version field 0.0.0
- The name field uses the @bothrs namespace. e.g., `@bothrs/<your-package-name>`
- You export fields contains the correct files/directories
- Your package.json has a `build`, `test` and `lint` script.
1. Create a new directory in `./packages`
2. Add a `package.json` with the `@nimble/` scope (e.g. `@nimble/my-package`)
3. Set version to `0.0.0`
4. Add `build`, `lint`, and `test` scripts
5. Add `"publishConfig": { "access": "public" }` for npm publishing

> Note: If you need an example check out the `@bothrs/react-native-layout` package.
### Commits

## Development
This project enforces [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) via commitlint + husky. Every commit message must follow the format:

### Commits
```
type(scope): description
```

Make sure to always use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) when working on any package. This is necessary for the CI to be able to version any changes that have been done.
Common types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`

### Deploy
Examples:
- `feat(tsconfig): add Next.js config variant`
- `fix(biome-config): update deprecated rule name`
- `chore: update dependencies`

Once you feature branch has been merged to master, the CI will automatically create a new version based on the conventional commit messages you have used. All packages that have changes will get a new version.
The commit hook will reject non-conforming messages.

Once the versioning is done, the CI will automatically publish the changes to npm.
### Versioning and publishing

This project uses [Release Please](https://github.com/googleapis/release-please) for automated versioning and changelog generation.

## Questions
**How it works:**

If you have any questions or need help please contact:
1. Write your code and commit with conventional commit messages
2. Open a pull request and merge to main
3. Release Please automatically opens a "Release PR" that bumps versions and updates changelogs based on your commit messages
4. When the Release PR is merged, the packages are automatically published to npm

- Bram Vanhoutte ([bram@bothrs.com](mailto:bram@bothrs.com))
- Fabian Meul ([fabian@bothrs.com](mailto:fabian@bothrs.com))
- Jacco Goris ([jacco@bothrs.com](mailto:jacco@bothrs.com))
`feat:` commits trigger a minor version bump, `fix:` commits trigger a patch bump, and `feat!:` or `BREAKING CHANGE:` trigger a major bump.

## Knowledge base

[Conventional commits specification](https://www.conventionalcommits.org/en/v1.0.0/)

[React native Builder Bob](https://www.npmjs.com/package/react-native-builder-bob)
- [Turborepo docs](https://turbo.build/repo/docs)
- [Release Please docs](https://github.com/googleapis/release-please)
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- [Biome docs](https://biomejs.dev/)
- [npm workspaces](https://docs.npmjs.com/cli/using-npm/workspaces)
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
}
1 change: 0 additions & 1 deletion global.d.ts

This file was deleted.

12 changes: 0 additions & 12 deletions jest.config.js

This file was deleted.

13 changes: 0 additions & 13 deletions lerna.json

This file was deleted.

10 changes: 0 additions & 10 deletions nx.json

This file was deleted.

Loading