Skip to content

Commit 7339921

Browse files
authored
fix: add missing sqlstring deps (#10)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Introduced a new “Local Development” section with clear instructions for starting a MySQL service, running tests, and stopping the service. - Updated the contributors display to use a dynamic image. - **New Features** - Added a streamlined Docker Compose setup for a MySQL service using the latest version. - **Chores** - Enhanced automation workflows to support additional Node.js and MySQL versions. - Adjusted dependency management and configuration handling to improve overall reliability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent a40233b commit 7339921

File tree

6 files changed

+51
-93
lines changed

6 files changed

+51
-93
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: CI
33
on:
44
push:
55
branches: [ master ]
6-
76
pull_request:
87
branches: [ master ]
98

@@ -13,5 +12,7 @@ jobs:
1312
uses: node-modules/github-actions/.github/workflows/node-test-mysql.yml@master
1413
with:
1514
os: 'ubuntu-latest'
16-
version: '16, 18, 20'
17-
mysql_version: '5, 8'
15+
version: '16, 18, 20, 22'
16+
mysql_version: '5, 8, 9'
17+
secrets:
18+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -433,19 +433,33 @@ const session = new db.literals.Literal('session()');
433433
+---------------+
434434
```
435435

436+
## For the local dev
437+
438+
Run docker compose to start test mysql service
439+
440+
```bash
441+
docker compose -f docker-compose.yml up -d
442+
# if you run the first time, should wait for ~20s to let mysql service init started
443+
```
444+
445+
Run the unit tests
446+
447+
```bash
448+
npm test
449+
```
450+
451+
Stop test mysql service
452+
453+
```bash
454+
docker compose -f docker-compose.yml down
455+
```
456+
436457
## License
437458

438459
[MIT](LICENSE)
439460

440-
<!-- GITCONTRIBUTOR_START -->
441-
442461
## Contributors
443462

444-
|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars.githubusercontent.com/u/6587734?v=4" width="100px;"/><br/><sub><b>AntiMoron</b></sub>](https://github.com/AntiMoron)<br/>|[<img src="https://avatars.githubusercontent.com/u/9213756?v=4" width="100px;"/><br/><sub><b>gxkl</b></sub>](https://github.com/gxkl)<br/>|[<img src="https://avatars.githubusercontent.com/u/10287125?v=4" width="100px;"/><br/><sub><b>nodejh</b></sub>](https://github.com/nodejh)<br/>|
445-
| :---: | :---: | :---: | :---: | :---: | :---: |
446-
|[<img src="https://avatars.githubusercontent.com/u/4192962?v=4" width="100px;"/><br/><sub><b>fangk</b></sub>](https://github.com/fangk)<br/>|[<img src="https://avatars.githubusercontent.com/u/1619030?v=4" width="100px;"/><br/><sub><b>xujihui1985</b></sub>](https://github.com/xujihui1985)<br/>|[<img src="https://avatars.githubusercontent.com/u/1468366?v=4" width="100px;"/><br/><sub><b>csbun</b></sub>](https://github.com/csbun)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/12378108?v=4" width="100px;"/><br/><sub><b>hoythan</b></sub>](https://github.com/hoythan)<br/>|[<img src="https://avatars.githubusercontent.com/u/35927028?v=4" width="100px;"/><br/><sub><b>deadhorse123</b></sub>](https://github.com/deadhorse123)<br/>|
447-
[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/3438038?v=4" width="100px;"/><br/><sub><b>qile222</b></sub>](https://github.com/qile222)<br/>|[<img src="https://avatars.githubusercontent.com/u/566097?v=4" width="100px;"/><br/><sub><b>RaoHai</b></sub>](https://github.com/RaoHai)<br/>
448-
449-
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Jan 30 2024 21:16:24 GMT+0800`.
463+
[![Contributors](https://contrib.rocks/image?repo=node-modules/rds)](https://github.com/node-modules/rds/graphs/contributors)
450464

451-
<!-- GITCONTRIBUTOR_END -->
465+
Made with [contributors-img](https://contrib.rocks).

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: eggjs_rds_dev_services_mysql
2+
3+
services:
4+
mysql:
5+
image: mysql:9
6+
environment:
7+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-}
8+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
9+
MYSQL_DATABASE: ${MYSQL_DATABASE:-test}
10+
ports:
11+
- 3306:3306
12+
healthcheck:
13+
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
14+
interval: 10s
15+
timeout: 5s
16+
retries: 5
17+
restart: unless-stopped

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"prepublishOnly": "npm run clean && npm run build"
1818
},
1919
"dependencies": {
20-
"mysql2": "^3.9.1"
20+
"mysql2": "^3.9.1",
21+
"sqlstring": "^2.3.3"
2122
},
2223
"devDependencies": {
2324
"@eggjs/tsconfig": "^1.3.2",
@@ -26,7 +27,6 @@
2627
"egg-bin": "^6.1.2",
2728
"eslint": "^8.29.0",
2829
"eslint-config-egg": "^12.1.0",
29-
"git-contributor": "^2.0.0",
3030
"mm": "^3.3.0",
3131
"typescript": "^5.1.3"
3232
},

test/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
2-
host: process.env.TEST_ALI_RDS_HOST || '127.0.0.1',
3-
port: parseInt(process.env.TEST_ALI_RDS_PORT || '3306'),
4-
user: process.env.TEST_ALI_RDS_USER || 'root',
5-
password: process.env.TEST_ALI_RDS_PASSWORD || '',
6-
database: process.env.TEST_ALI_RDS_DATABASE || 'test',
2+
host: process.env.TEST_ALI_RDS_HOST ?? '127.0.0.1',
3+
port: parseInt(process.env.TEST_ALI_RDS_PORT ?? '3306'),
4+
user: process.env.TEST_ALI_RDS_USER ?? 'root',
5+
password: process.env.TEST_ALI_RDS_PASSWORD ?? '',
6+
database: process.env.TEST_ALI_RDS_DATABASE ?? 'test',
77
};

0 commit comments

Comments
 (0)