-
-
Notifications
You must be signed in to change notification settings - Fork 0
merge dev to main #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # To get started with Dependabot version updates, you'll need to specify which | ||
| # package ecosystems to update and where the package manifests are located. | ||
| # Please see the documentation for more information: | ||
| # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
| # https://containers.dev/guide/dependabot | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: 'npm' | ||
| directory: '/' | ||
| schedule: | ||
| interval: weekly | ||
| target-branch: dev | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Build and Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - dev | ||
|
|
||
| env: | ||
| TELEMETRY_TRACKING_TOKEN: ${{ secrets.TELEMETRY_TRACKING_TOKEN }} | ||
| DO_NOT_TRACK: "1" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| node-version: [20.x] | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: 10.12.1 | ||
|
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: buildjet/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: "pnpm" | ||
|
|
||
| - 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: | | ||
| pnpm run build | ||
| pnpm tsx scripts/post-build.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: Publish and Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| env: | ||
| TELEMETRY_TRACKING_TOKEN: ${{ secrets.TELEMETRY_TRACKING_TOKEN }} | ||
| DO_NOT_TRACK: "1" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| publish-and-release: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: 10.12.1 | ||
|
|
||
| - name: Use Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
| cache: "pnpm" | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build | ||
| run: | | ||
| pnpm run build | ||
| pnpm tsx scripts/post-build.ts | ||
|
|
||
| - name: Get version from package.json | ||
| id: version | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Publish packages | ||
| run: pnpm run publish-all | ||
jiashengguo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Generate changelog | ||
| id: changelog | ||
| run: | | ||
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | ||
|
|
||
| if [ -z "$PREVIOUS_TAG" ]; then | ||
| CHANGELOG=$(git log --oneline --no-merges --format="* %s" HEAD) | ||
| else | ||
| CHANGELOG=$(git log --oneline --no-merges --format="* %s" ${PREVIOUS_TAG}..HEAD) | ||
| fi | ||
|
|
||
| if [ -z "$CHANGELOG" ]; then | ||
| CHANGELOG="* Automated release" | ||
| fi | ||
|
|
||
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ steps.version.outputs.tag }} | ||
| name: ZenStack Proxy Release ${{ steps.version.outputs.tag }} | ||
| body: | | ||
| ## Changes in this release | ||
|
|
||
| ${{ steps.changelog.outputs.changelog }} | ||
| draft: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| node_modules | ||
| build | ||
| dist | ||
| *.log | ||
| .env | ||
| .DS_Store | ||
| *.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .github/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "trailingComma": "es5", | ||
| "tabWidth": 2, | ||
| "semi": false, | ||
| "singleQuote": true, | ||
| "printWidth": 100, | ||
| "endOfLine": "lf", | ||
| "overrides": [ | ||
| { | ||
| "files": "**/*.json", | ||
| "options": { "parser": "json" } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # ZenStack Proxy CLI | ||
|
|
||
| A CLI tool to run an Express server with ZenStack proxy integration directly from the command line. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @zenstackhq/proxy | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Start the Server | ||
|
|
||
| ```bash | ||
| zenstack-proxy [options] | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| - `-z, --zenstack <path>` Path to ZenStack generated folder | ||
| - `-p, --port <number>` Port number for the server (default: `8008`) | ||
| - `-s, --schema <path>` - Path to ZModel schema file (default: "schema.zmodel") | ||
| - `-d, --datasource-url <url>` Datasource URL (overrides schema configuration) | ||
| - `-l, --log <level...>` Query log levels (e.g., query, info, warn, error) | ||
|
|
||
| ### Examples | ||
|
|
||
| #### Basic Usage | ||
|
|
||
| Start a server with default settings (searches for ZenStack output automatically): | ||
|
|
||
| ```bash | ||
| zenstack-proxy | ||
| ``` | ||
|
|
||
| #### Specify ZenStack schema and generated output | ||
|
|
||
| ```bash | ||
| zenstack-proxy -s ./schema/schema.zmodel -z ./generated/zenstack | ||
| ``` | ||
|
|
||
| #### Custom Port | ||
|
|
||
| ```bash | ||
| zenstack-proxy -p 8888 | ||
| ``` | ||
|
|
||
| ## Server Endpoints | ||
|
|
||
| The server provides the following endpoints: | ||
|
|
||
| ### ZenStack Model API | ||
|
|
||
| - `POST /api/model/:model/:operation` - All ZenStack operations (find, create, update, delete, etc.) | ||
|
|
||
| The ZenStack middleware handles all CRUD operations for your models. | ||
|
|
||
| ### Metadata | ||
|
|
||
| - `GET /api/schema` - Get complete schema metadata (models + enums) | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/usr/bin/env node | ||
| require('../index.js').default() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "name": "@zenstackhq/proxy", | ||
| "version": "0.2.0", | ||
| "description": "A CLI tool to run an Express server that proxies CRUD requests to a ZenStack backend", | ||
| "main": "index.js", | ||
| "publishConfig": { | ||
| "directory": "dist", | ||
| "linkDirectory": true | ||
| }, | ||
| "bin": { | ||
| "zenstack-proxy": "./bin/cli.js" | ||
| }, | ||
| "scripts": { | ||
| "clean": "rimraf dist", | ||
| "build": "pnpm clean && tsc && copyfiles -F \"bin/*\" dist && copyfiles ./README.md ./LICENSE ./package.json dist && pnpm pack dist --pack-destination ../build", | ||
| "prepublishOnly": "npm run build" | ||
| }, | ||
| "keywords": ["zenstack", "proxy", "express", "cli"], | ||
| "author": "", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "@prisma/adapter-better-sqlite3": "^6.2.1", | ||
| "@prisma/adapter-mariadb": "^7.1.0", | ||
| "@prisma/adapter-pg": "^6.18.0", | ||
| "@zenstackhq/server": "^2.0.0", | ||
| "colors": "^1.4.0", | ||
| "commander": "^12.0.0", | ||
| "cors": "^2.8.5", | ||
| "dotenv": "^17.2.3", | ||
| "express": "^4.19.2", | ||
| "mixpanel": "^0.19.1", | ||
| "semver": "^7.7.3", | ||
| "tsx": "^4.20.6" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/cors": "^2.8.17", | ||
| "@types/express": "^5.0.0", | ||
| "@types/node": "^20.0.0", | ||
| "@types/semver": "^7.7.1", | ||
| "copyfiles": "^2.4.1", | ||
| "rimraf": "^4.0.0", | ||
| "typescript": "^5.0.0" | ||
| } | ||
jiashengguo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.