Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zfben committed Feb 1, 2025
0 parents commit 7ade88e
Show file tree
Hide file tree
Showing 23 changed files with 4,333 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM faasjs/vscode

# Add custom commands
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "typed-pg-dev",
"dockerComposeFile": "docker-compose.yaml",
"service": "app",
"workspaceFolder": "/root/app",
"remoteUser": "root",
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind,consistency=cached",
"source=node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh"
},
"extensions": [
"streetsidesoftware.code-spell-checker",
"biomejs.biome"
]
},
"codespaces": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh"
},
"extensions": [
"streetsidesoftware.code-spell-checker",
"biomejs.biome"
]
}
},
"waitFor": "onCreateCommand"
}
20 changes: 20 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3'

services:
app:
build:
context: .
dockerfile: ./Dockerfile
command: sleep infinity
tty: true
volumes:
- ..:/root/app:delegated
- ~/.zsh_history:/root/.zsh_history:delegated
depends_on:
- pg
pg:
image: postgres:alpine
environment:
POSTGRES_USER: development
POSTGRES_DB: development
POSTGRES_HOST_AUTH_METHOD: trust
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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 all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "devcontainers"
directory: /
schedule:
interval: "daily"
56 changes: 56 additions & 0 deletions .github/workflows/devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish devel version

on:
workflow_run:
workflows:
- Unit Test
types:
- completed
branches:
- main
paths:
- src/**

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
publish_npm:
if: github.ref == 'refs/heads/main' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: 22
- name: Install
run: |
npm install
- name: Build
run: |
npm run build
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm run publish:devel
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Add tag
uses: actions/github-script@v7
with:
script: |
const readFileSync = require('fs').readFileSync;
const join = require('path').join;
const packageJson = JSON.parse(readFileSync(join('packages', 'types', 'package.json'), 'utf8'));
const version = packageJson.version;
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v' + version,
sha: context.sha
})
42 changes: 42 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Unit Test

on:
workflow_dispatch:
push:
branches:
- main
paths:
- src/**
- .github/workflows/unit-test.yml
pull_request:
paths:
- src/**

jobs:
unit-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:alpine
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: 22
- name: Install
run: |
npm install
- name: Run Tests
run: npm run ci
env:
PG_CONNECTION: postgresql://postgres:postgres@localhost:5432
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOVTOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
32 changes: 32 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"editor.detectIndentation": false,
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"editor.quickSuggestions": {
"strings": "on"
},
"editor.wordWrap": "on",
"editor.formatOnSave": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.inlayHints.parameterNames.enabled": "all",
"cSpell.words": [
"Antd",
"astro",
"astrojs",
"faas",
"faasjs",
"promakerhub",
"querant's",
"querants",
"Supa",
"supabase",
"tarotjourney",
"vitest",
"zfben"
]
}
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# typed-pg

**This package is still in development and not yet ready for production use.**

A type-safe PostgreSQL query builder for TypeScript with a fluent API.

## Features

- 🎯 Full TypeScript support
- 🔒 Type-safe queries
- ⚡ Built on top of the high-performance `postgres.js` package
- 🔗 Fluent chainable API
- 🛡️ SQL injection prevention
- 📦 Transaction support
- 🎨 Clean and intuitive API

## Installation

```bash
npm install typed-pg
```
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@faasjs/lint/biome"]
}
Loading

0 comments on commit 7ade88e

Please sign in to comment.