Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4b389fb
fix: rest api should return error reason (#507)
ymc9 Jun 21, 2023
c41980d
feat: trpc plugin, generate client helpers to provide prisima-like ty…
ymc9 Jun 24, 2023
304979f
fix: trpc plugin, generate schema for supporting unchecked input in m…
ymc9 Jun 24, 2023
0ea071b
fix: incorrect policy code generated when the rule only contains a si…
ymc9 Jun 24, 2023
3b07a1e
fix: resolve to the correct enum in field attribute when there's ambi…
ymc9 Jun 25, 2023
5f3669e
fix: support for custom prisma client output path (#514)
ymc9 Jun 25, 2023
3abb0c0
chore: remove deprecated react plugin (#515)
ymc9 Jun 25, 2023
a5bf94f
chore: add restart dev server prompt (#517)
ymc9 Jun 26, 2023
6397925
Doc:Update README.md (#518)
jiashengguo Jun 26, 2023
2280f83
feature: a better "zod" plugin (#521)
ymc9 Jun 30, 2023
f04b7b0
chore: remove the deprecated "next" package (#523)
ymc9 Jun 30, 2023
3aa0f51
chore: bump version (#524)
ymc9 Jun 30, 2023
2a4b5cc
fix: add enum import to zod generation (#528)
ymc9 Jul 1, 2023
551b33d
fix: Validation errors when using true or false as prefix of id (#530)
jiashengguo Jul 1, 2023
53621c8
changes: enable total count meta on get (#529)
chemitaxis Jul 1, 2023
4097915
fix: trpc client helper bugs (#532)
ymc9 Jul 1, 2023
bc8e0c0
chore: try updating svlete version (#534)
ymc9 Jul 2, 2023
0519421
fix: automatically enable "@core/zod" plugin when there're validation…
ymc9 Jul 2, 2023
b804625
chore: add test for total count in rest api (#537)
ymc9 Jul 3, 2023
a5f1c51
chore: add contribution guide (#539)
ymc9 Jul 3, 2023
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
39 changes: 32 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,52 @@ on:

jobs:
build-test:
runs-on: buildjet-4vcpu-ubuntu-2204
runs-on: buildjet-8vcpu-ubuntu-2204

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: ^7.15.0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: buildjet/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: DEFAULT_NPM_TAG=latest pnpm run build
- run: pnpm lint

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: buildjet/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: DEFAULT_NPM_TAG=latest pnpm run build

- name: Lint
run: pnpm lint

# install again for internal dependencies
- run: pnpm install --frozen-lockfile
- run: pnpm run test
- name: Install internal dependencies
run: pnpm install --frozen-lockfile

- name: Test
run: pnpm run test-ci
100 changes: 100 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Contributing to ZenStack

I want to think you first for considering contributing to ZenStack 🙏🏻. It's people like you who make ZenStack a better toolkit that benefits more and more developers! This document will help you get started, and please join our [Discord](https://discord.gg/Ykhr738dUe) if you have any questions.

## Prerequisites

- [Node.js](https://nodejs.org/): v18 or above
- [pnpm](https://pnpm.io/): latest version

## Get started

1. Make a fork of the repository

Make sure all branches are included.

1. Clone your fork

1. Switch to the "dev" branch

```bash
git checkout dev
```

1. Install dependencies

```bash
pnpm install
```

1. Build the project

ZenStack uses [pnpm workspace](https://pnpm.io/workspaces) to manage packages in the monorepo. To build the project, run the following command in the root directory:

```bash
pnpm build
```

1. Run tests

```bash
pnpm test
```

## Development workflow

ZenStack adopts a very simple development workflow:

1. Changes should be made in branches created off the "dev" branch.

1. After coding and testing, create a PR to merge the changes into the "dev" branch.

1. After code review is done, the PR is squashed and merged into the "dev" branch.

1. Periodically, the "dev" branch is merged back to the "main" branch to create a new release.

## Project structure

ZenStack is a monorepo consisting of multiple NPM packages managed by [pnpm workspace](https://pnpm.io/workspaces). The packages reside in the "packages" folder:

### `language`

The ZModel language's definition, including its syntax definition and parser/linker implementation. The compiler is implemented with the [Langium](https://github.com/langium/langium) toolkit.

### `schema`

The `zenstack` CLI and ZModel VSCode extension implementation. The package also contains several built-in plugins: `@core/prisma`, `@core/model-meta`, `@core/access-policy`, and `core/zod`.

### `runtime`

Runtime enhancements to PrismaClient, including infrastructure for creating transparent proxies and concrete implementations for the `withPolicy`, `withPassword`, and `withOmit` proxies.

### `server`

The `server` package contains two main parts:

1. Framework-agnostic API handlers: defining input/output format and API routes in a framework-independent way. Currently supports "rpc" and "rest" styles.

1. Framework-specific adapters: translating framework-dependent request and response formats.

### `sdk`

Contains utilities for building ZenStack plugins.

### `plugins`

Plugins for generating different artifacts from the ZModel schema.

## Testing changed packages locally

You can use one of the two ways to test changed packages locally:

- Copy built packages to overwrite the installed ones

After making changes, run `pnpm build` and then copy the generated artifacts from the `dist` folder to the `node_modules` folder of your test project to overwrite the installed code.

- Publish packages to a local registry

You can run a local NPM registry (like [Verdaccio](https://verdaccio.org/)) and publish the changed packages to it. There's a preconfigured `pnpm publish-preview` command that publishes all locally built packages to a local Verdaccio registry (http://localhost:4873).

The easiest way to install Verdaccio locally is to use [Docker](https://verdaccio.org/docs/docker/).
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<div align="center">
<a href="https://zenstack.dev">
<img src="https://user-images.githubusercontent.com/104139426/214809937-4ed30485-a683-4fea-b737-928c48e86fd7.png" style="max-width: 512px; width: 100%; height: auto; margin-bottom: 1rem;"
>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/zenstackhq/zenstack-docs/main/static/img/logo-dark.png">
<img src="https://raw.githubusercontent.com/zenstackhq/zenstack-docs/main/static/img/logo.png" height="128">
</picture>
</a>
<div></div>
<h1>ZenStack</h1>
<a href="https://www.npmjs.com/package/zenstack">
<img src="https://img.shields.io/npm/v/zenstack">
</a>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "zenstack-monorepo",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "",
"scripts": {
"build": "pnpm -r build",
"test": "pnpm -r run test --silent",
"test-ci": "pnpm -r run test --silent",
"lint": "pnpm -r lint",
"publish-all": "pnpm --filter \"./packages/**\" -r publish --access public",
"publish-preview": "pnpm --filter \"./packages/**\" -r publish --registry http://localhost:4873"
Expand Down
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/language",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"displayName": "ZenStack modeling language compiler",
"description": "ZenStack modeling language compiler",
"homepage": "https://zenstack.dev",
Expand Down
Loading