-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
166 additions
and
695 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,25 +1,27 @@ | ||
name: Node.js CD | ||
name: Node.js Package | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: oven-sh/setup-bun@v1 | ||
- run: bun install --frozen-lockfile | ||
- run: bun test | ||
|
||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy using ssh | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: "212.227.155.91" | ||
username: "root" | ||
password: "!2Zc727cI1" | ||
port: 22 | ||
script: | | ||
cd ~/database | ||
git reset --hard HEAD | ||
git clean -f -d | ||
git pull origin main | ||
git status | ||
bash build.sh | ||
- uses: actions/checkout@v2 | ||
- uses: oven-sh/setup-bun@v1 | ||
- run: bun install --frozen-lockfile | ||
# Publish to NPM | ||
- uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} | ||
registry: "https://npm.pkg.github.com" |
This file contains 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,3 @@ | ||
node_modules | ||
# Keep environment variables out of version control | ||
.env |
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM postgres:latest | ||
ENV POSTGRES_USER main | ||
ENV POSTGRES_PASSWORD ctACGEEnNe5NHL76qXKYiAwyBht4hRKz743EDFcpzDXXtLU4QBRPZAvVdhDQgrQf | ||
ENV POSTGRES_DB main | ||
ENV POSTGRES_USER ${POSTGRES_DATABASE_USER} | ||
ENV POSTGRES_PASSWORD ${POSTGRES_DATABASE_PASSWORD} | ||
ENV POSTGRES_DB ${POSTGRES_DATABASE_NAME} | ||
|
||
COPY scripts /docker-entrypoint-initdb.d/ | ||
COPY ./prisma/migrations/ /docker-entrypoint-initdb.d/ |
This file contains 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,9 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
|
||
export function createContext(ctx: any): Promise<Context>; | ||
|
||
export * from ".prisma/client/index.d"; | ||
|
||
export interface Context { | ||
prisma: PrismaClient; | ||
} |
This file contains 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,8 @@ | ||
version: '3' | ||
services: | ||
database: | ||
build: ../database | ||
ports: | ||
- "5436:5432" | ||
volumes: | ||
- ./data:/var/lib/postgresql/data |
This file contains 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,25 @@ | ||
{ | ||
"name": "@continuum-ai/database", | ||
"version": "0.0.1", | ||
"module": "./src/index.ts", | ||
"types": "./dist/index.d.ts", | ||
"type": "module", | ||
"scripts": { | ||
"db:introspect": "dotenv -- prisma introspect", | ||
"db:generate": "dotenv -- prisma generate" | ||
}, | ||
"postinstall": "tsc && cp src/index.d.ts dist/index.d.ts && bunx prisma generate", | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@prisma/client": "5.6.0", | ||
"bun-types": "latest", | ||
"tsc": "^2.0.4" | ||
}, | ||
"devDependencies": { | ||
"dotenv-cli": "^4.0.0", | ||
"prisma": "5.6.0", | ||
"typescript": "^4.2.3" | ||
} | ||
} |
This file contains 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 @@ | ||
-- CreateTable | ||
CREATE TABLE "Users" ( | ||
"id" SERIAL NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"name" TEXT, | ||
"password" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Users_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Users_email_key" ON "Users"("email"); |
This file contains 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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
This file contains 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,21 @@ | ||
// This is your Prisma schema file, | ||
// learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
binaryTargets = ["native"] | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("POSTGRES_DATABASE_URL") | ||
} | ||
|
||
model Users { | ||
id Int @id @default(autoincrement()) | ||
email String @unique | ||
name String? | ||
password String | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
} |
This file contains 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,9 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
|
||
export function createContext(ctx: any): Promise<Context>; | ||
|
||
export * from ".prisma/client/index.d"; | ||
|
||
export interface Context { | ||
prisma: PrismaClient; | ||
} |
This file contains 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,8 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
import { Context } from "./index.d"; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
export const createContext = async (ctx: any): Promise<Context> => { | ||
return { ...ctx, prisma }; | ||
}; |
This file contains 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,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["ESNext"], | ||
"module": "esnext", | ||
"target": "esnext", | ||
"moduleResolution": "bundler", | ||
"moduleDetection": "force", | ||
"allowImportingTsExtensions": true, | ||
"noEmit": true, | ||
"composite": true, | ||
"strict": true, | ||
"downlevelIteration": true, | ||
"skipLibCheck": true, | ||
"jsx": "react-jsx", | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"allowJs": true, | ||
"types": [ | ||
"bun-types" // add Bun global | ||
] | ||
} | ||
} |