Skip to content
Closed

Bun #862

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
17 changes: 0 additions & 17 deletions .devcontainer/devcontainer.json

This file was deleted.

1 change: 0 additions & 1 deletion .dvmrc

This file was deleted.

10 changes: 10 additions & 0 deletions .github/actions/install-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Install & Build
description: Install all dependencies and builds the app

runs:
using: composite
steps:
- shell: bash
run: | # shell
bun install --frozen-lockfile
bun run build
7 changes: 3 additions & 4 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ description: Run checks and tests
runs:
using: composite
steps:
- uses: ./.github/actions/install-build
- shell: bash
run: deno check --frozen
run: bun run lint
- shell: bash
run: deno lint
- shell: bash
run: deno task test
run: bun test
Comment thread
johngeorgewright marked this conversation as resolved.
12 changes: 5 additions & 7 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Project Overview

This is a **Deno-first monorepo** for a type-safe targeting and feature flag
This is a **Bun-first monorepo** for a type-safe targeting and feature flag
system. The architecture enables dynamic content delivery based on query
conditions, with packages distributed via JSR (JavaScript Registry).
conditions, with packages distributed via npm.

**Core concept**: Store flat key-value rules with targeting conditions, query at
runtime to get the matching payload. Think feature flags meets content
Expand Down Expand Up @@ -76,9 +76,7 @@ const userSegment = createTargetingDescriptor({
const platformMatch = {
predicate: (query) => (targets) => {
if (!query) return true
return targets.some((t) =>
t.startsWith('!') ? t.slice(1) !== query : t === query
)
return targets.some((t) => (t.startsWith('!') ? t.slice(1) !== query : t === query))
},
queryParser: string(),
requiresQuery: false,
Expand Down Expand Up @@ -157,8 +155,8 @@ Re-export types with `export type *` and utilities appropriately.
- **Automated via Release Please** on pushes to `master`
- Each package has independent versioning
- Tags follow pattern: `@targetd/[package]-v[version]`
- Published to **JSR** (not npm), accessible via `jsr:@targetd/[package]`
- GitHub Actions workflow: test → release-please → publish to JSR
- Published to **npm**, accessible via `npm install @targetd/[package]`
- GitHub Actions workflow: test → release-please → publish to npm

## Common Pitfalls

Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/dependencies.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/get-deno-version.yml

This file was deleted.

11 changes: 10 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ name: Pull Request
on:
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/test.yml
name: Test
runs-on: ubuntu-latest
container:
image: oven/bun:1
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/test
Comment thread Fixed
53 changes: 46 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Github Release
runs-on: ubuntu-latest
concurrency:
group: release
group: release-github
permissions:
contents: write
issues: write
Expand All @@ -23,22 +23,61 @@ jobs:
with:
token: ${{ secrets.PUSH_TOKEN }}

release-jsr:
release-test:
needs: [release-github]
if: needs.release-github.outputs.releases_created == 'true'
runs-on: ubuntu-latest
container:
image: oven/bun:1
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/test

release-npm:
needs: [release-github, release-test]
runs-on: ubuntu-latest
strategy:
matrix:
path_released: ${{ fromJson(needs.release-github.outputs.paths_released) }}
name: Publish ${{ matrix.path_released }} to NPM
environment: npm
concurrency:
group: release-npm-${{ matrix.path_released }}
container:
image: oven/bun:1
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/install-build
- working-directory: ${{ matrix.path_released }}
run: |
bun pm pack --filename=$(pwd)/package.tgz
npm publish $(pwd)/package.tgz
Comment thread
johngeorgewright marked this conversation as resolved.

release-jsr:
needs: [release-github, release-test]
runs-on: ubuntu-latest
strategy:
matrix:
path_released: ${{ fromJson(needs.release-github.outputs.paths_released) }}
name: Publish ${{ matrix.path_released }} to JSR
environment: jsr
concurrency:
group: release-jsr-${{ matrix.path_released }}
container:
image: oven/bun:1
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: denoland/setup-deno@v2
with:
deno-version-file: .dvmrc
- uses: ./.github/actions/test
- uses: ./.github/actions/install-build
- working-directory: ${{ matrix.path_released }}
run: if [ "$(cat deno.json | jq -r '.private // false')" != "true" ]; then deno publish; fi
run: | # shell
PACK="$(pwd)/package.tgz"
bun pm pack --filename=$PACK
tar -xOf $PACK package/package.json > package.json
rm -rf package $PACK
bunx jsr publish
Comment on lines +59 to +83
18 changes: 0 additions & 18 deletions .github/workflows/test.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
dist
*.log
node_modules
package.json
package-lock.json
tsconfig.tsbuildinfo
*.validator.ts
4 changes: 0 additions & 4 deletions .hooks/commit-msg

This file was deleted.

4 changes: 0 additions & 4 deletions .hooks/pre-commit

This file was deleted.

1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bunx commitlint --edit
Comment thread
johngeorgewright marked this conversation as resolved.
Comment thread
johngeorgewright marked this conversation as resolved.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bunx lint-staged
Comment thread
johngeorgewright marked this conversation as resolved.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ Generate JSON Schema from Zod schemas for documentation and validation.

```bash
# Core API
npm install zod && npx jsr add @targetd/api
npm install @targetd/api zod

# With server and client
npx jsr add @targetd/api @targetd/server @targetd/client
npm install @targetd/api @targetd/server @targetd/client zod

# With file loading
npx jsr add @targetd/api @targetd/fs
npm install @targetd/api @targetd/fs zod
```

### Basic Example
Expand Down Expand Up @@ -203,10 +203,7 @@ const allPayloads = await client.getPayloadForEachName({ isPremium: true })
const data = await Data.create()
.usePayload({ newFeature: z.boolean() })
.useTargeting({ userTier: targetEquals(z.string()) })
.addRules('newFeature', [
{ targeting: { userTier: 'beta' }, payload: true },
{ payload: false },
])
.addRules('newFeature', [{ targeting: { userTier: 'beta' }, payload: true }, { payload: false }])
```

### A/B Testing
Expand Down
Loading
Loading