Skip to content

Split package in json-api-nestjs #101

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 22 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e3ec380
chore: bump version
klerick Feb 27, 2025
f202ebc
feat(json-api-nestjs): remove module and refactoring
klerick Feb 27, 2025
f25d319
feat(json-api-nestjs-typeorm): Adapter for typerorm
klerick Feb 27, 2025
cd56636
feat(json-api-nestjs-microorm): Adapter for microorm
klerick Feb 27, 2025
1a1c859
feat(json-api-nestjs-shared): Use shared type from separate package
klerick Feb 27, 2025
7054e93
feat(json-api-server): Use new signature
klerick Feb 27, 2025
95eac72
test(json-api-server-e2e): Fix change test for new signature
klerick Feb 27, 2025
4359ac7
feat(json-api-nestjs-shared): Use new structure
klerick Mar 4, 2025
2425fb6
refactor(json-api-nestjs-sdk): Use new structur
klerick Mar 4, 2025
61f45e6
fix(json-api-nestjs): fix type in some place
klerick Mar 4, 2025
edc3a60
chore: Fix dep and tests
klerick Mar 4, 2025
1309457
ci: New CI/CD process
klerick Mar 5, 2025
985a4af
chore: bump nx version
klerick Mar 10, 2025
780bbf9
fix(json-api-nestjs-typeorm, json-api-nestjs-microorm): Fix mysql lik…
klerick Mar 11, 2025
5ca7132
refactor(json-api-nestjs-typeorm): remove unused code
klerick Mar 12, 2025
e52cc92
fix(json-api-nestjs): Use correct options for check is debug or not
klerick Mar 12, 2025
9a0f190
fix(json-api-nestjs): Some fix for swagger
klerick Mar 12, 2025
62011c8
docs: Add link to new package fron main readme
klerick Mar 12, 2025
0d3c852
refactor(microorm-database): remove unused code
klerick Mar 12, 2025
1e836d1
docs(json-api-nestjs-microorm): Change readme
klerick Mar 12, 2025
93c2d53
docs(json-api-nestjs): Change readme
klerick Mar 12, 2025
5ecb11e
ci: change yaml
klerick Mar 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 4 additions & 6 deletions .env
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
DB_HOST=localhost
DB_LOGGING=1
DB_NAME="json-api-db"

DB_USERNAME="postgres"
DB_PASSWORD="postgres"
#DB_NAME="json-api-db"
DB_NAME="postgres"
DB_PORT=5432
DB_TYPE=postgres

#DB_USERNAME="root"
#DB_PASSWORD="password"
#DB_NAME="example_new"
#DB_PASSWORD="mysql"
#DB_PORT=3306
#DB_TYPE=mysql


ORM_TYPE=microorm
#ORM_TYPE=typeorm
#ORM_TYPE=microorm
ORM_TYPE=typeorm
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
]
}
},
{
"files": ["*.test-d.ts"],
"rules": {
"@typescript-eslint/ban-ts-comment": "off"
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
Expand Down
58 changes: 30 additions & 28 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
name: 'My composite action'
description: 'Checks out the repository and install'
name: Main action for Node.js
description: Setup Node.js

inputs:
node-version:
description: Node.js version
required: false
default: 20.x

runs:
using: 'composite'
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20
node-version: ${{ inputs.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Restore cached npm dependencies
id: cache-dependencies-restore
uses: actions/cache/restore@v4
cache: npm

- name: Get npm cache directory
id: npm-cache-dir
shell: pwsh
run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT}

- name: Cache NPM dependencies
uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: |
node_modules
~/.cache/Cypress # needed for the Cypress binary
key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package-lock.json') }}
- name: Npm install
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
run: npm ci
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install Dependencies
shell: bash
- name: Cache npm dependencies
id: cache-dependencies-save
uses: actions/cache/save@v4
with:
path: |
node_modules
~/.cache/Cypress # needed for the Cypress binary
key: ${{ steps.cache-dependencies-restore.outputs.cache-primary-key }}
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: "master"
run: npm ci
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: ⚙️ Build

on:
workflow_call:
inputs:
mainBranch:
description: Type for main nx affect
required: false
default: "master"
type: string
secrets:
NX_CLOUD_ACCESS_TOKEN:
required: true
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: "master"

- name: Setup Node.js
uses: ./.github/actions

- name: Determine base for NX affected (if not master)
if: ${{ inputs.mainBranch != 'master' }}
shell: bash
run: |
LAST_TAG=$(git describe --tags --abbrev=0)
LAST_TAG_HASH=$(git rev-parse "$LAST_TAG")
CURRENT_COMMIT=$(git rev-parse HEAD)
echo "Using last tag hash as NX_BASE: $LAST_TAG_HASH"
echo "Using current commit as NX_HEAD: $CURRENT_COMMIT"
echo "NX_BASE=$LAST_TAG_HASH" >> $GITHUB_ENV
echo "NX_HEAD=$CURRENT_COMMIT" >> $GITHUB_ENV

- name: Determine base for NX affected (if master)
if: ${{ inputs.mainBranch == 'master' }}
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: ${{ inputs.mainBranch }}

- name: Build Libraries
run: npx nx affected --target=build --parallel=3 --exclude='*,!tag:type:publish'
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
name: CI
name: Create Releases
on:
pull_request:
branches:
- master
types:
- opened
- synchronize
workflow_dispatch:
inputs:
projects:
description: 'Package Bump'
required: true
default: 'json-api-nestjs,json-api-nestjs-sdk,nestjs-json-rpc,nestjs-json-rpc-sdk'
first-release:
description: 'Is first release?'
required: false
type: boolean
default: false
dry-run:
description: 'Is dry run?'
required: false
type: boolean
default: false
jobs:
run-test:
name: Try build and run unit test
build-and-test:
name: "Build and test"
runs-on: ubuntu-latest
permissions:
contents: "read"
actions: "read"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Npm install
uses: ./.github/actions
- name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
- name: Get git hash
run: |
COMMIT=$(git show-ref --tags --hash | tail -n 1)
echo "NX_BASE=$(echo ${COMMIT})" >> $GITHUB_ENV
- name: Set GIST_SECRET to env
run: |
echo "GIST_SECRET=${{ secrets.GIST_SECRET }}" >> $GITHUB_ENV
echo "GIST_ID=${{ secrets.GIST_ID }}" >> $GITHUB_ENV
- name: Restore cached .nx
id: cache-nx-restore
uses: actions/cache/restore@v4
with:
path: |
.nx
key: ${{ runner.os }}-nx-${{ steps.branch-names.outputs.current_branch }}
- run: git branch --track main origin/master
key: ${{ runner.os }}-nx-master
- name: Test
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
Expand All @@ -35,6 +52,8 @@ jobs:
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
run: npx nx affected -t build --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,microorm-database,typeorm-database,@nestjs-json-api/source,type-for-rpc'
- name: Upload test coverage badge
run: npx nx affected -t upload-badge --exclude='json-api-front,json-api-server,shared-utils,json-api-server-e2e,json-shared-type,microorm-database,typeorm-database,@nestjs-json-api/source,type-for-rpc'
- name: Save cached .nx
id: cache-dependencies-save
uses: actions/cache/save@v4
Expand All @@ -46,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
name: Try run e2e test
needs:
- run-test
- build-and-test
services:
# Label used to access the service container
postgres:
Expand All @@ -71,25 +90,49 @@ jobs:
fetch-depth: 0
- name: Npm install
uses: ./.github/actions
- name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
- name: Restore cached .nx
id: cache-nx-restore
uses: actions/cache/restore@v4
with:
path: |
.nx
key: ${{ runner.os }}-nx-${{ steps.branch-names.outputs.current_branch }}
key: ${{ runner.os }}-nx-master
- run: git branch --track main origin/master
- run: npm run typeorm migration:run
- run: npm run seed:run
- run: npx nx affected -t e2e --parallel=1
- run: npx nx affected -t e2e-micro --parallel=1
- name: Save cached .nx
id: cache-dependencies-save
uses: actions/cache/save@v4
with:
path: |
.nx
key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
bump-version:
name: "Bump version"
needs:
- run-e2e-test
runs-on: ubuntu-latest
permissions:
contents: "write"
actions: "read"
id-token: "write"
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Npm install
uses: ./.github/actions
- name: Bump version
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
npx nx release --skip-publish --first-release=${{ github.event.inputs.first-release }} --projects=${{ github.event.inputs.projects }} --dry-run=${{ github.event.inputs.dry-run }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
Loading