Skip to content

Commit 4977f38

Browse files
committed
Initial commit
0 parents  commit 4977f38

File tree

13 files changed

+2999
-0
lines changed

13 files changed

+2999
-0
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x, 22.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: "npm"
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build
30+
run: npm run build
31+
32+
- name: Test
33+
run: npm test
34+
35+
- name: Verify dual module compatibility
36+
run: |
37+
node -e "require('./dist/index.js')" # Test CJS
38+
node --input-type=module -e "import * as mod from './dist/index.mjs'; console.log(typeof mod.sql === 'function')" # Test ESM

.github/workflows/publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Package to NPM
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Use Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: "18.x"
18+
registry-url: "https://registry.npmjs.org"
19+
cache: "npm"
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Verify package version matches release tag
25+
run: |
26+
PKG_VERSION=$(node -p "require('./package.json').version")
27+
GITHUB_REF_NAME=${GITHUB_REF#refs/tags/}
28+
GITHUB_TAG=${GITHUB_REF_NAME#v}
29+
echo "Package version: $PKG_VERSION"
30+
echo "GitHub tag (without v): $GITHUB_TAG"
31+
if [ "$PKG_VERSION" != "$GITHUB_TAG" ] && [ "$PKG_VERSION" != "${GITHUB_TAG#v}" ]; then
32+
echo "⚠️ WARNING: GitHub release tag ($GITHUB_REF_NAME) doesn't match package.json version ($PKG_VERSION)"
33+
echo "The package will be published with the version from package.json: $PKG_VERSION"
34+
fi
35+
36+
- name: Build
37+
run: npm run build
38+
39+
- name: Test
40+
run: npm test
41+
42+
- name: Verify dual module compatibility
43+
run: |
44+
node -e "require('./dist/index.js')" # Test CJS
45+
node --input-type=module -e "import * as mod from './dist/index.mjs'; console.log(typeof mod.sql === 'function')" # Test ESM
46+
47+
- name: Publish to NPM
48+
run: npm publish
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
.DS_Store
4+
*.log
5+
coverage
6+
.nyc_output
7+
.vscode

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v23.10.0

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2025 typeguard, Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)