Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit ab094e9

Browse files
chore: modernize
1 parent 43c4ce6 commit ab094e9

File tree

10 files changed

+542
-561
lines changed

10 files changed

+542
-561
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: yarn --frozen-lockfile
2424

2525
- name: build
26-
run: yarn dev-lib build
26+
run: yarn build
2727

2828
- name: release
2929
env:

.husky/commit-msg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/bin/sh
21
[ -n "$CI" ] && exit 0
3-
. "$(dirname "$0")/_/husky.sh"
42

5-
node_modules/.bin/commitlint-def $1
6-
# exit 1 # uncomment to debug
3+
dev-lib commitlint $1

.husky/pre-commit

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/bin/sh
21
[ -n "$CI" ] && exit 0
3-
. "$(dirname "$0")/_/husky.sh"
42

5-
node_modules/.bin/lint-staged-def
3+
dev-lib lint-staged

biome.jsonc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3+
"extends": ["node_modules/@naturalcycles/dev-lib/cfg/biome.jsonc"]
4+
}

eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// prettier-ignore
2+
module.exports = [
3+
...require('@naturalcycles/dev-lib/cfg/eslint.config'),
4+
]

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"name": "@naturalcycles/mysql-lib",
33
"scripts": {
4-
"prepare": "husky"
4+
"prepare": "husky",
5+
"build": "dev-lib build",
6+
"test": "dev-lib test",
7+
"lint": "dev-lib lint",
8+
"bt": "dev-lib bt",
9+
"lbt": "dev-lib lbt"
510
},
611
"dependencies": {
712
"@naturalcycles/db-lib": "^9.1.0",
@@ -12,7 +17,7 @@
1217
},
1318
"devDependencies": {
1419
"@naturalcycles/dev-lib": "^15.18.0",
15-
"@types/node": "^20.2.3",
20+
"@types/node": "^22.7.4",
1621
"dotenv": "^16.0.0",
1722
"jest": "^29.0.0"
1823
},
@@ -34,7 +39,7 @@
3439
"url": "https://github.com/NaturalCycles/mysql-lib"
3540
},
3641
"engines": {
37-
"node": ">=18.12.0"
42+
"node": ">=20.13.0"
3843
},
3944
"version": "3.8.1",
4045
"description": "MySQL client implementing CommonDB interface",

prettier.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@naturalcycles/dev-lib/cfg/prettier.config')

src/mysql.db.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Readable } from 'node:stream'
22
import { promisify } from 'node:util'
33
import {
4-
DBPatch,
54
BaseCommonDB,
65
CommonDB,
76
CommonDBCreateOptions,
7+
commonDBFullSupport,
88
CommonDBOptions,
99
CommonDBSaveOptions,
10-
DBQuery,
11-
RunQueryResult,
1210
CommonDBSupport,
13-
commonDBFullSupport,
1411
CommonDBType,
12+
DBPatch,
13+
DBQuery,
14+
RunQueryResult,
1515
} from '@naturalcycles/db-lib'
1616
import {
1717
_assert,
@@ -253,7 +253,7 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
253253
.map(s => s.trim())
254254
.filter(Boolean)
255255

256-
for await (const sql of queries) {
256+
for (const sql of queries) {
257257
await this.runSQL({ sql })
258258
}
259259
}
@@ -310,7 +310,7 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
310310
// Insert rows one-by-one, to get their auto-generated id
311311

312312
let i = -1
313-
for await (const row of rows) {
313+
for (const row of rows) {
314314
i++
315315
if (row.id) {
316316
// Update already existing
@@ -331,7 +331,7 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
331331

332332
if (opt.saveMethod === 'update') {
333333
// TODO: This fails if a combination of entities with id and without id are parsed
334-
for await (const row of rows) {
334+
for (const row of rows) {
335335
// Update already existing
336336
_assert(row.id, 'id is required for updating')
337337
const query = new DBQuery(table).filterEq('id', row.id)
@@ -344,7 +344,7 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
344344
// inserts are split into multiple sentenses to respect the max_packet_size (1Mb usually)
345345
const sqls = insertSQL(table, rows, verb, this.cfg.logger)
346346

347-
for await (const sql of sqls) {
347+
for (const sql of sqls) {
348348
await this.runSQL({ sql })
349349
}
350350
}

src/schema/mysql.schema.util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function jsonSchemaToMySQLDDL(
3939
return `id VARCHAR(255) NOT NULL`
4040
}
4141

42-
let type
42+
let type: string
4343

4444
if (s.type === 'string') {
4545
// can specify isoDate later

0 commit comments

Comments
 (0)