Skip to content

Commit d6be503

Browse files
authored
ci: Adding TypeScript build test (#1957)
1 parent 076b8c2 commit d6be503

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

.github/workflows/ci-tsc-build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI - TypeScript Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
tests-tsc-build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
node-version: [18.x]
17+
18+
name: Node.js ${{ matrix.node-version }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Set up Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
27+
- name: Cache dependencies
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.npm
31+
key: npm-${{ hashFiles('package-lock.json') }}
32+
restore-keys: npm-
33+
34+
- name: Install npm dependencies
35+
run: npm ci
36+
37+
- name: Testing TypeScript build
38+
run: npm run test:tsc-build

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint:code": "eslint index.js promise.js \"lib/**/*.js\" \"test/**/*.js\" \"benchmarks/**/*.js\"",
1313
"lint:docs": "eslint Contributing.md \"documentation/**/*.md\" \"examples/*.js\"",
1414
"test": "node ./test/run.js",
15+
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
1516
"coverage-test": "c8 -r cobertura -r lcov -r text node ./test/run.js",
1617
"benchmark": "node ./benchmarks/benchmark.js",
1718
"prettier": "prettier --single-quote --trailing-comma none --write \"{lib,examples,test}/**/*.js\"",

test/tsc-build/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import mysql from '../../index';
2+
import mysqlp from '../../promise';
3+
4+
export { mysql, mysqlp };

test/tsc-build/tsconfig.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"include": ["index.ts"],
3+
"compilerOptions": {
4+
"target": "ES2016",
5+
"module": "CommonJS",
6+
"moduleResolution": "Node",
7+
"isolatedModules": true,
8+
"esModuleInterop": true,
9+
"allowSyntheticDefaultImports": true,
10+
"strict": true,
11+
"alwaysStrict": true,
12+
"noImplicitAny": true,
13+
"strictFunctionTypes": false,
14+
"skipLibCheck": false,
15+
"noEmitOnError": true,
16+
"noEmit": true
17+
}
18+
}

0 commit comments

Comments
 (0)