Skip to content

Commit 29a33e5

Browse files
committed
feat: init
0 parents  commit 29a33e5

File tree

126 files changed

+19047
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+19047
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.vscode/
2+
node_modules/
3+
dist/
4+
npm-debug.log
5+
6+
dist
7+
apps/apps/core/dist

.env.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
POSTGRES_PASSWORD=password
2+
POSTGRES_USER=postgres
3+
4+
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:5432/nest-drizzle

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DATABASE_URL=postgresql://postgres:password@127.0.0.1:5432/nest-drizzle-test

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.paw filter=lfs diff=lfs merge=lfs -text
2+

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js Build CI
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
services:
17+
postgres:
18+
image: postgres
19+
20+
env:
21+
POSTGRES_PASSWORD: postgres
22+
POSTGRES_USER: postgres
23+
POSTGRES_DB: postgres
24+
25+
options: >-
26+
--health-cmd pg_isready
27+
--health-interval 10s
28+
--health-timeout 5s
29+
--health-retries 5
30+
ports:
31+
- 5432:5432
32+
33+
strategy:
34+
matrix:
35+
node-version: [20.x]
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: pnpm/action-setup@v4.0.0
40+
41+
- name: Use Node.js ${{ matrix.node-version }}
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
cache: pnpm
46+
47+
- name: Install Dependencies
48+
run: |
49+
pnpm i
50+
- name: Build project
51+
run: |
52+
npm run build

.github/workflows/docker.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Docker meta
17+
id: meta
18+
uses: docker/metadata-action@v5
19+
with:
20+
# list of Docker images to use as base name for tags
21+
images: |
22+
nest/nest-http
23+
# generate Docker tags based on the following events/attributes
24+
tags: |
25+
type=ref,event=branch
26+
type=semver,pattern={{version}}
27+
type=semver,pattern={{major}}.{{minor}}
28+
type=semver,pattern={{major}}
29+
type=sha
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
- name: Login to DockerHub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
- name: Build and export to Docker
40+
uses: docker/build-push-action@v5
41+
with:
42+
context: .
43+
load: true
44+
tags: ${{ steps.meta.outputs.tags }},nest/nest-http:latest
45+
labels: ${{ steps.meta.outputs.labels }}
46+
- name: Test
47+
run: |
48+
bash ./scripts/workflow/test-docker.sh
49+
- name: Build and push
50+
id: docker_build
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
# push: ${{ startsWith(github.ref, 'refs/tags/v') }}
55+
push: false
56+
tags: ${{ steps.meta.outputs.tags }},nest/nest-http:latest
57+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Release
7+
8+
jobs:
9+
build:
10+
name: Upload Release Asset
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest]
14+
runs-on: ${{ matrix.os }}
15+
outputs:
16+
release_url: ${{ steps.create_release.outputs.upload_url }}
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 20.x
24+
- name: Start MongoDB
25+
uses: supercharge/mongodb-github-action@v1.10.0
26+
with:
27+
mongodb-version: 4.4
28+
- name: Start Redis
29+
uses: supercharge/redis-github-action@1.7.0
30+
with:
31+
redis-version: 6
32+
- uses: pnpm/action-setup@v4.0.0
33+
with:
34+
run_install: true
35+
- name: Test
36+
run: |
37+
npm run lint
38+
npm run test
39+
npm run test:e2e
40+
41+
- name: Build project
42+
run: |
43+
pnpm run bundle
44+
- name: Test Bundle Server
45+
run: |
46+
bash scripts/workflow/test-server.sh
47+
# - name: Zip Assets
48+
# run: |
49+
# sh scripts/zip-asset.sh
50+
- name: Create Release
51+
id: create_release
52+
uses: actions/create-release@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
tag_name: ${{ github.ref }}
57+
release_name: Release ${{ github.ref }}
58+
draft: false
59+
prerelease: false
60+
- name: Upload Release Asset
61+
id: upload-release-asset
62+
uses: actions/upload-release-asset@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
upload_url: ${{ steps.create_release.outputs.upload_url }}
67+
asset_path: ./release.zip
68+
asset_name: release-${{ matrix.os }}.zip
69+
asset_content_type: application/zip
70+
# deploy:
71+
# name: Deploy To Remote Server
72+
# runs-on: ubuntu-latest
73+
# needs: [build]
74+
# steps:
75+
# - name: Exec deploy script with SSH
76+
# uses: appleboy/ssh-action@master
77+
# env:
78+
# JWTSECRET: ${{ secrets.JWTSECRET }}
79+
# with:
80+
# command_timeout: 10m
81+
# host: ${{ secrets.HOST }}
82+
# username: ${{ secrets.USER }}
83+
# password: ${{ secrets.PASSWORD }}
84+
# envs: JWTSECRET
85+
# script_stop: true
86+
# script: |
87+
# whoami
88+
# cd
89+
# source ~/.zshrc
90+
# cd mx
91+
# ls -a
92+
# node server-deploy.js --jwtSecret=$JWTSECRET
93+
94+
build_other_platform:
95+
name: Build Other Platform
96+
strategy:
97+
matrix:
98+
os: [macos-latest]
99+
runs-on: ${{ matrix.os }}
100+
needs: [build]
101+
steps:
102+
- name: Checkout code
103+
uses: actions/checkout@v4
104+
- name: Cache pnpm modules
105+
uses: actions/cache@v3
106+
env:
107+
cache-name: cache-pnpm-modules
108+
with:
109+
path: ~/.pnpm-store
110+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
111+
restore-keys: |
112+
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
113+
- uses: pnpm/action-setup@v4.0.0
114+
with:
115+
run_install: true
116+
- name: Build project
117+
run: |
118+
pnpm run bundle
119+
- name: Zip Assets
120+
run: |
121+
sh scripts/zip-asset.sh
122+
- name: Upload Release Asset
123+
id: upload-release-asset
124+
uses: actions/upload-release-asset@v1
125+
env:
126+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
with:
128+
upload_url: ${{ needs.build.outputs.release_url }}
129+
asset_path: ./release.zip
130+
asset_name: release-${{ matrix.os }}.zip
131+
asset_content_type: application/zip

.github/workflows/test.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js Test CI
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
services:
17+
postgres:
18+
image: postgres
19+
20+
env:
21+
POSTGRES_PASSWORD: postgres
22+
POSTGRES_USER: postgres
23+
POSTGRES_DB: postgres
24+
25+
options: >-
26+
--health-cmd pg_isready
27+
--health-interval 10s
28+
--health-timeout 5s
29+
--health-retries 5
30+
ports:
31+
- 5432:5432
32+
33+
strategy:
34+
matrix:
35+
node-version: [20.x]
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Start Redis
40+
uses: supercharge/redis-github-action@1.7.0
41+
with:
42+
redis-version: 6
43+
44+
- uses: pnpm/action-setup@v4.0.0
45+
46+
- name: Use Node.js ${{ matrix.node-version }}
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: ${{ matrix.node-version }}
50+
cache: pnpm
51+
52+
- name: Install dependencies
53+
run: pnpm i
54+
- name: Run Test
55+
run: |
56+
pnpm run lint
57+
pnpm run test
58+
env:
59+
CI: true
60+
DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres?schema=public'

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# OS
14+
.DS_Store
15+
16+
# Tests
17+
/coverage
18+
/.nyc_output
19+
20+
# IDEs and editors
21+
/.idea
22+
.project
23+
.classpath
24+
.c9/
25+
*.launch
26+
.settings/
27+
*.sublime-workspace
28+
29+
# IDE - VSCode
30+
.vscode/*
31+
!.vscode/settings.json
32+
!.vscode/tasks.json
33+
!.vscode/launch.json
34+
!.vscode/extensions.json
35+
36+
patch/dist
37+
tmp
38+
out
39+
release.zip
40+
41+
run
42+
43+
apps/core/dist
44+
45+
drizzle/*.js
46+
packages/*/dist
47+
.vite

.husky/post-checkout

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
3+
git lfs post-checkout "$@"

0 commit comments

Comments
 (0)