commit
c63ffb7011
13 changed files with 4077 additions and 0 deletions
8
.editorconfig
Normal file
8
.editorconfig
Normal file
|
@ -0,0 +1,8 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_size = 2
|
16
.forgejo/workflows/test.yaml
Normal file
16
.forgejo/workflows/test.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: node:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: "yarn"
|
||||
- run: yarn install
|
||||
- run: yarn lint
|
||||
- run: yarn coverage
|
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/.yarn/** linguist-vendored
|
||||
/.yarn/releases/* binary
|
||||
/.yarn/plugins/**/* binary
|
||||
/.pnp.* binary linguist-generated
|
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# IDEA
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# JS library
|
||||
|
||||
coverage/
|
||||
lib/
|
||||
.parcel-cache/
|
||||
.yarn/
|
||||
.yarnrc*
|
||||
yarn-error.log
|
||||
.pnp*
|
||||
node_modules/
|
5
.prettierrc
Normal file
5
.prettierrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"useTabs": true,
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": false
|
||||
}
|
9
LICENSE
Normal file
9
LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 Zeptotech
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
43
README.md
Normal file
43
README.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
<p align="center">
|
||||
<a href="https://code.zeptotech.net/Sharkitek/Core">
|
||||
<picture>
|
||||
<img alt="Sharkitek logo" width="200" src="https://code.zeptotech.net/Sharkitek/Core/raw/branch/main/logo.svg" />
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
<h1 align="center">
|
||||
Sharkitek SRM
|
||||
</h1>
|
||||
|
||||
<h4 align="center">
|
||||
<a href="https://code.zeptotech.net/Sharkitek/SRM">Documentation</a> |
|
||||
<a href="https://code.zeptotech.net/Sharkitek/SRM">Website</a>
|
||||
</h4>
|
||||
|
||||
<p align="center">
|
||||
TypeScript ORM for Sharkitek models
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img alt="Tests status" src="https://code.zeptotech.net/Sharkitek/SRM/badges/workflows/test.yaml/badge.svg?branch=main" />
|
||||
<a href="https://bundlephobia.com/package/@sharkitek/srm" target="_blank">
|
||||
<img alt="Bundle size" src="https://badgen.net/bundlephobia/minzip/@sharkitek/srm" />
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/@sharkitek/srm" target="_blank">
|
||||
<img alt="Latest release" src="https://badgen.net/npm/v/@sharkitek/srm" />
|
||||
</a>
|
||||
<a href="https://bundlephobia.com/package/@sharkitek/srm" target="_blank">
|
||||
<img alt="Bundle size" src="https://badgen.net/bundlephobia/dependency-count/@sharkitek/srm" />
|
||||
</a>
|
||||
<img alt="Latest release" src="https://badgen.net/npm/types/@sharkitek/srm" />
|
||||
</p>
|
||||
|
||||
## Introduction
|
||||
|
||||
Sharkitek is a lightweight Javascript / TypeScript library designed to ease development of models. Sharkitek SRM is an extension of Sharkitek, providing a simple ORM on top of Sharkitek.
|
||||
|
||||
```shell
|
||||
yarn add @sharkitek/srm
|
||||
```
|
||||
|
||||
With Sharkitek SRM, you define the architecture of your models by specifying their properties and their types. You also define how these properties are stored in database, which allows you to query, insert and update records.
|
23
eslint.config.js
Normal file
23
eslint.config.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
import tseslint from "typescript-eslint";
|
||||
import {defineConfig, globalIgnores} from "eslint/config";
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores([".yarn/**", "coverage/**", "lib/**"]),
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
|
||||
plugins: {js},
|
||||
extends: ["js/recommended"],
|
||||
},
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
|
||||
languageOptions: {globals: {...globals.browser, ...globals.node}},
|
||||
},
|
||||
tseslint.configs.recommended,
|
||||
{
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
},
|
||||
},
|
||||
]);
|
53
package.json
Normal file
53
package.json
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"name": "@sharkitek/srm",
|
||||
"version": "4.0.0",
|
||||
"description": "TypeScript ORM for Sharkitek models.",
|
||||
"keywords": [
|
||||
"mapping",
|
||||
"model",
|
||||
"object",
|
||||
"orm",
|
||||
"postgresql",
|
||||
"relational",
|
||||
"sharkitek",
|
||||
"sql"
|
||||
],
|
||||
"repository": "https://code.zeptotech.net/Sharkitek/SRM",
|
||||
"author": {
|
||||
"name": "Madeorsk",
|
||||
"email": "m@deor.sk"
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && vite build",
|
||||
"test": "vitest",
|
||||
"coverage": "vitest run --coverage",
|
||||
"format": "prettier . --write",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "src/library.ts",
|
||||
"types": "lib/index.d.ts",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.30.0",
|
||||
"@types/node": "^24.0.3",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"eslint": "^9.30.0",
|
||||
"globals": "^16.2.0",
|
||||
"prettier": "^3.6.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.35.0",
|
||||
"vite": "^7.0.0",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"packageManager": "yarn@4.9.2"
|
||||
}
|
0
src/library.ts
Normal file
0
src/library.ts
Normal file
27
tsconfig.json
Normal file
27
tsconfig.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"ts-node": {
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"types": ["node"]
|
||||
}
|
||||
},
|
||||
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib/",
|
||||
"incremental": true,
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"resolveJsonModule": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"module": "ES6",
|
||||
"target": "ES6",
|
||||
"moduleResolution": "Bundler",
|
||||
"lib": ["ESNext", "DOM"]
|
||||
}
|
||||
}
|
27
vite.config.ts
Normal file
27
vite.config.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import {defineConfig, UserConfig} from "vite";
|
||||
import dts from "vite-plugin-dts";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
|
||||
export default defineConfig((): UserConfig => {
|
||||
return {
|
||||
build: {
|
||||
outDir: "lib",
|
||||
sourcemap: true,
|
||||
minify: "esbuild",
|
||||
lib: {
|
||||
entry: "src/library.ts",
|
||||
formats: ["es"],
|
||||
fileName: "index",
|
||||
},
|
||||
},
|
||||
|
||||
plugins: [
|
||||
dts({
|
||||
insertTypesEntry: true,
|
||||
rollupTypes: true,
|
||||
exclude: ["node_modules"],
|
||||
}),
|
||||
],
|
||||
};
|
||||
});
|
Loading…
Add table
Reference in a new issue