Skip to content

Commit

Permalink
Jsdoc ify the library (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
FroggyPanda authored Mar 18, 2024
2 parents a9ee4b0 + 3b0970b commit 07ca3dd
Show file tree
Hide file tree
Showing 23 changed files with 638 additions and 905 deletions.
26 changes: 26 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
env: {
browser: false,
node: true,
es2021: true,
},
extends: 'eslint:recommended',
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js}'],
parserOptions: {
sourceType: 'script',
},
},
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'no-console': 'error',
},
};
23 changes: 19 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: CI
name: main
on:
push:
branches:
- '**'
pull_request:

jobs:
build:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -17,5 +18,19 @@ jobs:
node-version: 16.x
cache: 'pnpm'

- run: pnpm install
- run: pnpm run build
- run: pnpm install --frozen-lockfile
- run: pnpm run format
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- run: pnpm run lint
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!src/**/*
!README.md
!package.json
16 changes: 8 additions & 8 deletions example/afterSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type Json =
| { [key: string]: Json | undefined }
| Json[];

export interface Database {
export type Database = {
public: {
Tables: {
todos: {
Expand Down Expand Up @@ -37,7 +37,7 @@ export interface Database {
columns: ['user_id'];
referencedRelation: 'users';
referencedColumns: ['id'];
}
},
];
};
};
Expand All @@ -54,10 +54,10 @@ export interface Database {
[_ in never]: never;
};
};
}
};

//Schema: public
//Tables
export type Todo = Database['public']['Tables']['todos']['Row'];
export type InsertTodo = Database['public']['Tables']['todos']['Insert'];
export type UpdateTodo = Database['public']['Tables']['todos']['Update'];
// Schema: public
// Tables
export type Todos = Database['public']['Tables']['todos']['Row'];
export type InsertTodos = Database['public']['Tables']['todos']['Insert'];
export type UpdateTodos = Database['public']['Tables']['todos']['Update'];
74 changes: 37 additions & 37 deletions example/beforeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,54 @@ export type Json =
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]
| Json[];

export type Database = {
public: {
Tables: {
todos: {
Row: {
id: number
inserted_at: string
is_complete: boolean | null
task: string | null
user_id: string
}
id: number;
inserted_at: string;
is_complete: boolean | null;
task: string | null;
user_id: string;
};
Insert: {
id?: number
inserted_at?: string
is_complete?: boolean | null
task?: string | null
user_id: string
}
id?: number;
inserted_at?: string;
is_complete?: boolean | null;
task?: string | null;
user_id: string;
};
Update: {
id?: number
inserted_at?: string
is_complete?: boolean | null
task?: string | null
user_id?: string
}
id?: number;
inserted_at?: string;
is_complete?: boolean | null;
task?: string | null;
user_id?: string;
};
Relationships: [
{
foreignKeyName: "todos_user_id_fkey"
columns: ["user_id"]
referencedRelation: "users"
referencedColumns: ["id"]
}
]
}
}
foreignKeyName: 'todos_user_id_fkey';
columns: ['user_id'];
referencedRelation: 'users';
referencedColumns: ['id'];
},
];
};
};
Views: {
[_ in never]: never
}
[_ in never]: never;
};
Functions: {
[_ in never]: never
}
[_ in never]: never;
};
Enums: {
[_ in never]: never
}
[_ in never]: never;
};
CompositeTypes: {
[_ in never]: never
}
}
}
[_ in never]: never;
};
};
};
23 changes: 9 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
"repository": "FroggyPanda/better-supabase-types",
"bugs": "https://github.com/FroggyPanda/better-supabase-types/issues",
"author": "FroggyPanda",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"main": "src/index.js",
"bin": "src/index.js",
"private": false,
"version": "2.7.4",
"version": "2.7.5",
"license": "MIT",
"type": "module",
"scripts": {
"build": "tsup ./src/index.ts --format cjs,esm --dts",
"lint": "tsc"
},
"bin": {
"better-supabase-types": "./dist/index.js"
"lint": "prettier \"src/**/**.js\" --check && eslint \"src/**/**.js\" && tsc",
"format": "prettier \"src/**/**.js\" --write"
},
"dependencies": {
"chalk": "^4.1.2",
Expand All @@ -29,10 +26,8 @@
"@types/node": "^18.15.13",
"@types/pluralize": "^0.0.29",
"@types/yargs": "^17.0.24",
"nodemon": "^2.0.22",
"ts-node": "^10.9.1",
"tsup": "^6.7.0",
"typescript": "^5.0.4"
"eslint": "^8.56.0",
"typescript": "^5.3.3"
},
"keywords": [
"supabase",
Expand All @@ -41,4 +36,4 @@
"developer-tools",
"automatic"
]
}
}
Loading

0 comments on commit 07ca3dd

Please sign in to comment.