Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dee2bdb
chore(*): run scripts without npx
pawcoding Dec 13, 2025
0dd4456
build(deps): upgrade to astro@v6
pawcoding Dec 13, 2025
0cd6445
refactor(schema): remove `improveTypes` option
pawcoding Dec 13, 2025
9ca5fc7
refactor(*): replace `ZodSchema` with `ZodType`
pawcoding Dec 13, 2025
f63c945
refactor(schema): update schema generation for astro@v6
pawcoding Dec 13, 2025
720c7c2
refactor(*): update deprecated zod usage
pawcoding Dec 13, 2025
8e55b4c
feat(live-loader): stabilize live content loader
pawcoding Dec 13, 2025
bdd690d
docs(README): update compatibility table
pawcoding Dec 13, 2025
12edb3e
build(lint): enable type-checking during linting
pawcoding Dec 14, 2025
a351995
build(deps): update linter + rule set
pawcoding Dec 15, 2025
237fa95
Merge remote-tracking branch 'origin/next' into feat/astro-v6
pawcoding Dec 16, 2025
4c24ac7
ci(release): bump major version for all breaking changes
pawcoding Dec 16, 2025
0bbc314
chore(release): 3.0.0-astro-v6.1 [skip ci]
semantic-release-bot Dec 16, 2025
f33c819
build(deps): update dependencies
pawcoding Jan 17, 2026
a00ecf6
ci(release): update changelog template
pawcoding Jan 17, 2026
3ac914d
chore(release): 3.0.0-astro-v6.2 [skip ci]
semantic-release-bot Jan 17, 2026
974050c
Merge remote-tracking branch 'origin/master' into feat/astro-v6
pawcoding Mar 12, 2026
616f0d2
build(deps): update dependencies
pawcoding Mar 12, 2026
5642911
build(ts): use native typescript preview for faster typechecking
pawcoding Mar 12, 2026
d42b988
build(deps): update dependencies
pawcoding Mar 14, 2026
226f340
chore(release): 3.0.0-astro-v6.3 [skip ci]
semantic-release-bot Mar 14, 2026
c9462fc
test(pocketbase-loader): add e2e test for loader and live loader
Claude Mar 15, 2026
6bcf6e0
Merge pull request #83 from pawcoding/claude/add-e2e-tests-pocketbase…
pawcoding Mar 16, 2026
dab3c82
fix(schema): get type generation working for collections with files a…
pawcoding Mar 16, 2026
31fa35a
test(*): add tests for schema generation for collections with files
pawcoding Mar 16, 2026
3248e2a
chore(release): 3.0.0-astro-v6.4 [skip ci]
semantic-release-bot Mar 16, 2026
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
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test/ # Test files
# Format code (required before commit)
npm run format

# Lint code (oxlint)
# Lint code (oxlint, includes type-checking)
npm run lint:fix

# Type checking (required before commit)
Expand All @@ -67,7 +67,7 @@ npm run test:e2e
Before any commit, the following MUST pass:

1. `npm run format` - Code formatting
2. `npm run lint:fix` - Linting with oxlint
2. `npm run lint:fix` - Linting with oxlint (and type-checking at the same time)
3. `npm run typecheck` - TypeScript type checking

These are enforced by husky pre-commit hooks and lint-staged configuration.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/changelog-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
uses: cycjimmy/semantic-release-action@v5
with:
semantic_version: 25
extra_plugins: |
conventional-changelog-conventionalcommits
@semantic-release/changelog
dry_run: true
ci: false
unset_gha_env: true
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ jobs:
run: npm ci

# Lint code
- name: 🧹 Lint code
- name: 🧹 Lint code (includes type-check)
run: npm run lint

# Check format
- name: 🧹 Check format
run: npm run format:check

# Type check
# Still included for now, since the oxlint built-in typecheck uses TypeScript v7.
# This one uses the TypeScript version actually specified in the project.
- name: 🧪 Type check
run: npm run typecheck
run: npx tsc --noEmit

# Run tests
- name: 🧪 Run unit tests
Expand Down Expand Up @@ -88,6 +90,9 @@ jobs:
uses: cycjimmy/semantic-release-action@v5
with:
semantic_version: 25
extra_plugins: |
conventional-changelog-conventionalcommits
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CUSTOM_TAG: ${{ inputs.tag }}
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,13 @@ jobs:
run: npm ci

# Lint code
- name: 🧹 Lint code
- name: 🧹 Lint code (includes type-check)
run: npm run lint

# Check format
- name: 🧹 Check format
run: npm run format:check

# Type check
- name: 🧪 Type check
run: npm run typecheck

# Run tests
- name: 🧪 Run unit tests
run: npm run test:unit
Expand Down
10 changes: 10 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"builtin": true,
"node": true
},
"options": {
"reportUnusedDisableDirectives": "warn",
"typeAware": true,
"typeCheck": true
},
"rules": {
// Correctness (in addition to the default rules)
"typescript/no-base-to-string": "off",
Expand All @@ -37,6 +42,7 @@
"eslint/no-iterator": "error",
"eslint/no-param-reassign": "warn",
"eslint/no-proto": "error",
"eslint/no-sequences": "error",
"eslint/no-var": "error",
"import/no-commonjs": "error",
"import/no-cycle": "error",
Expand Down Expand Up @@ -194,6 +200,8 @@
"typescript/consistent-type-imports": "error",
"typescript/no-empty-interface": "error",
"typescript/prefer-for-of": "error",
// Too many false positives, disabled for now until oxlint improves the rule
// "typescript/prefer-optional-chain": "warn",
"typescript/prefer-reduce-type-parameter": "warn",
"unicorn/catch-error-name": "warn",
"unicorn/consistent-date-clone": "warn",
Expand Down Expand Up @@ -221,6 +229,7 @@
"typescript/consistent-type-exports": "warn",
"typescript/dot-notation": "warn",
"typescript/no-unnecessary-condition": "warn",
"typescript/no-unnecessary-type-conversion": "warn",
"typescript/no-useless-default-assignment": "warn",
"typescript/prefer-find": "warn",
"typescript/prefer-optional-chain": "warn",
Expand All @@ -234,6 +243,7 @@
"eslint/max-lines": "off",
"eslint/max-lines-per-function": "off",
"eslint/max-nested-callbacks": "off",
"jest/prefer-to-contain": "warn",
"typescript/no-unsafe-argument": "off",
"typescript/no-unsafe-assignment": "off",
"typescript/no-unsafe-call": "off",
Expand Down
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"oxc.typeAware": true,
"oxc.unusedDisableDirectives": "warn",
"oxc.lint.run": "onType",
"oxc.fmt.configPath": ".oxfmtrc.json",
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "oxc.oxc-vscode",
"oxc.enable": true
}
2 changes: 0 additions & 2 deletions .zed/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"run": "onType",
"configPath": null,
"tsConfigPath": null,
"unusedDisableDirectives": "warn",
"typeAware": true,
"flags": {}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Thank you for your interest in contributing to astro-loader-pocketbase! This gui
Before making any changes, familiarize yourself with our code quality requirements:

- **Formatting**: Run `npm run format` to format code with Oxfmt
- **Linting**: Run `npm run lint:fix` to lint code with oxlint
- **Linting**: Run `npm run lint:fix` to lint code with oxlint (and type-check at the same time)
- **Type Checking**: Run `npm run typecheck` to check TypeScript types

These checks are enforced by pre-commit hooks and must pass before any commit.
Expand Down
42 changes: 8 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This package is a simple loader to load data from a PocketBase database into Ast

| Loader | Astro | PocketBase |
| ------ | ----- | ---------- |
| 3.0.0 | 6.0.0 | >= 0.23.0 |
| 2.0.0 | 5.0.0 | >= 0.23.0 |
| 1.0.0 | 5.0.0 | <= 0.22.0 |

Expand Down Expand Up @@ -42,7 +43,7 @@ If you want to update your deployed site with new entries, you need to rebuild i
<sub>When running the dev server, you can trigger a reload by using `s + enter`.</sub>

> [!TIP]
> If you need live data on your production site, you can use the experimental live content loader described below.
> If you need live data on your production site, you can use the live content loader described below.

## Incremental builds

Expand Down Expand Up @@ -201,23 +202,6 @@ When superuser credentials are provided, the loader will **always use the remote
If you don't want to use the automatic type generation, you can also [provide your own schema manually](https://docs.astro.build/en/guides/content-collections/#defining-the-collection-schema).
This manual schema will **always override the automatic type generation**.

### Improved types

By default PocketBase reports `number` and `boolean` fields as not required, even though the API will always return `0` and `false` respectively if no value is set.
This means that the loader will add `undefined` to the type of these fields.
If you want to enforce that these fields are always present, you can set the `improveTypes` option to `true`.

```ts
const blog = defineCollection({
loader: pocketbaseLoader({
...options,
improveTypes: true
})
});
```

This will remove `undefined` from the type of these fields and mark them as required.

## All options

| Option | Type | Required | Description |
Expand All @@ -230,16 +214,9 @@ This will remove `undefined` from the type of these fields and mark them as requ
| `filter` | `string` | | Custom filter to use when fetching entries. Used to filter the entries by specific conditions. |
| `superuserCredentials` | `{ email: string, password: string } \| { impersonateToken: string }` | | The email and password or impersonate token of a superuser of the PocketBase instance. This is used for automatic type generation. |
| `localSchema` | `string` | | The path to a local schema file. This is used for automatic type generation. |
| `jsonSchemas` | `Record<string, z.ZodSchema>` | | A record of Zod schemas to use for type generation of `json` fields. |
| `improveTypes` | `boolean` | | Whether to improve the types of `number` and `boolean` fields, removing `undefined` from them. |

## Experimental live content loader

> [!WARNING]
> Live content collections are still experimental and may change in the future.
> This means that this packages live content loader is also experimental and may include breaking changes with every release.
| `jsonSchemas` | `Record<string, ZodType>` | | A record of Zod schemas to use for type generation of `json` fields. |

For more information on how to enable and use live content collections, please refer to the [Astro documentation](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/).
## Live content loader

### General usage

Expand All @@ -249,7 +226,7 @@ The options for this packages loader are similar to the regular PocketBase loade

```ts
const blogLive = defineLiveCollection({
loader: experimentalPocketbaseLiveLoader({
loader: pocketbaseLiveLoader({
url: "https://<your-pocketbase-url>",
collectionName: "<collection-in-pocketbase>"
})
Expand Down Expand Up @@ -302,7 +279,7 @@ If you also want to use the `lastModified` hint, just tell the loader which fiel

```ts
const blogLive = defineLiveCollection({
loader: experimentalPocketbaseLiveLoader({
loader: pocketbaseLiveLoader({
...options,
updatedField: "<field-in-collection>"
})
Expand All @@ -311,7 +288,7 @@ const blogLive = defineLiveCollection({

### Error handling

The live content loader follows Astro's standard error handling conventions for live collections. For more information on how to handle errors in your components, see the [Astro documentation on error handling](https://docs.astro.build/en/reference/experimental-flags/live-content-collections/#error-handling).
The live content loader follows Astro's standard error handling conventions for live collections. For more information on how to handle errors in your components, see the [Astro documentation on error handling](https://docs.astro.build/en/reference/content-loader-reference/#error-handling-in-live-loaders).

| Error | When it's returned |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -340,10 +317,7 @@ const blogTypes = defineCollection({
});

const blogLive = defineLiveCollection({
loader:
experimentalPocketbaseLiveLoader<CollectionEntry<"blogTypes">["data"]>(
options
)
loader: pocketbaseLiveLoader<CollectionEntry<"blogTypes">["data"]>(options)
});
```

Expand Down
Loading