Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to TypeScript #87

Merged
merged 51 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
26578dd
feat(ts): start migrating project to TS
jlenon7 Oct 31, 2023
ffe8d9f
test(qb): add missing test cases
jlenon7 Oct 31, 2023
c03b7c2
test(db): add tests for db impl
jlenon7 Nov 1, 2023
0b7e4c0
test(trx): add tests for transaction
jlenon7 Nov 1, 2023
ee8d25f
refactor(con): connect to db sync
jlenon7 Nov 1, 2023
10a4409
test(provider): add test for db provider
jlenon7 Nov 1, 2023
d6999e9
test(provider): add test for db facade
jlenon7 Nov 1, 2023
1858c4b
test(migration): create migration source test file
jlenon7 Nov 1, 2023
8daeeff
fix(git): merge conflicts
jlenon7 Nov 1, 2023
7cddcca
test(migration): add tests for migration source
jlenon7 Nov 2, 2023
1a6ba00
test(pg): start testing pg driver
jlenon7 Nov 2, 2023
41bb91a
test(pg): add more tests for pg driver
jlenon7 Nov 3, 2023
e370eae
test(pg): add more tests for pg driver
jlenon7 Nov 3, 2023
1f8abf7
test(pg): finish tests of pg driver
jlenon7 Nov 4, 2023
a54e44e
refactor(driver): dont change client on closures
jlenon7 Nov 4, 2023
4a9e396
refactor(driver): use function instead of arrow fn
jlenon7 Nov 4, 2023
b1e7e7f
fix(driver): use inherited joinByType method
jlenon7 Nov 4, 2023
87f2afd
feat(driver): implement mysql driver
jlenon7 Nov 4, 2023
7ebb1f0
feat(driver): implement sqlite driver
jlenon7 Nov 5, 2023
01c7fa1
refactor(factory): remove con responsability from factory
jlenon7 Nov 5, 2023
861c54c
refactor(factory): rm close con responsability from driver
jlenon7 Nov 5, 2023
1250e5d
feat(driver): implement mongo driver
jlenon7 Nov 5, 2023
261ba49
test(mongo): add tests for not implemented methods
jlenon7 Nov 6, 2023
e6d4c59
refactor(pk): move pk to driver instance
jlenon7 Nov 6, 2023
c01f7da
feat(database): overload connection with new drivers
jlenon7 Nov 6, 2023
24a2738
feat(orm): start implementing ORM
jlenon7 Nov 13, 2023
5cd3b61
test(qb): start testing model query builder
jlenon7 Nov 14, 2023
f3d271e
test(qb): add findOrFail method
jlenon7 Nov 14, 2023
a02c1e3
test(qb): add findOr method
jlenon7 Nov 14, 2023
7d15c87
feat(model): add more tests for model QB
jlenon7 Nov 17, 2023
5f1f618
feat(model): new methods and better types
jlenon7 Nov 20, 2023
a6eb5c7
feat(model): new where and having methods
jlenon7 Nov 20, 2023
6e1a15a
feat(model): add attributes method and persist option
jlenon7 Nov 24, 2023
f66af00
feat(model): automatically remove soft deleted data
jlenon7 Nov 24, 2023
1368be6
feat(model): add more common static methods to model
jlenon7 Nov 24, 2023
ca33025
feat(model): add has one relation
jlenon7 Nov 27, 2023
885b85b
feat(model): add belongs to relation
jlenon7 Nov 28, 2023
6d7c3d4
feat(model): add has many relation
jlenon7 Nov 28, 2023
1a80aa3
feat(model): add belongs to many relation
jlenon7 Nov 29, 2023
2af5038
feat(factory): add model factory
jlenon7 Nov 30, 2023
cec17de
fix(factory): add returningAs to avoid 'as any'
jlenon7 Nov 30, 2023
afb904f
feat(model): add toJSON method
jlenon7 Nov 30, 2023
072def5
feat(types): add better types for model columns
jlenon7 Dec 3, 2023
7aea9be
feat(model): add load method
jlenon7 Dec 3, 2023
584b004
feat(model): add save method
jlenon7 Dec 7, 2023
dde3473
feat(model): add more methods to model
jlenon7 Dec 7, 2023
2318e72
feat(commands): add make commands
jlenon7 Dec 8, 2023
6ff58dc
fix(seeder): add db to run method signature
jlenon7 Dec 8, 2023
ad3f4a7
feat(commands): add seed and migration commands
jlenon7 Dec 8, 2023
12a0af8
fix(test): add more timeout
jlenon7 Dec 8, 2023
f555828
feat(commands): export commands in pjson
jlenon7 Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '21.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm install

- name: Compile code
run: npm run build

- name: Install production dependencies
run: cd build && npm ci --omit=dev

- name: Automatic GitHub Release
uses: justincy/[email protected]
id: release

- name: Publish to NPM Registry
run: npm publish --access public
run: cd build && npm publish --access public
if: steps.release.outputs.released == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
strategy:
matrix:
node-version:
- 14.15.4
- 16.x
- 21.x
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -45,5 +44,9 @@ jobs:

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test:coverage

- name: Test code compilation
run: npm run build
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ out
.yarn/install-state.gz
.pnp.*

# Compiled code
dist
build
*.js
*.d.ts
*.js.map
!tests/fixtures/**/*.js
!tests/fixtures/**/*.d.ts
!tests/fixtures/**/*.js.map

# IDE
.idea
.fleet
Expand All @@ -131,3 +141,4 @@ out
.docker

test.js
mongo-memory.ts
29 changes: 29 additions & 0 deletions bin/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @athenna/database
*
* (c) João Lenon <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

import { MongoMemory } from '#tests/helpers/MongoMemory'
import { command } from '@athenna/artisan/testing/plugins'
import { Runner, assert, specReporter } from '@athenna/test'
import { DriverFactory } from '#src/factories/DriverFactory'
import { FakeDriverClass } from '#tests/fixtures/drivers/FakeDriverClass'

DriverFactory.drivers.set('fake', { Driver: FakeDriverClass, client: null })

await MongoMemory.start()

await Runner.setTsEnv()
.addPlugin(assert())
.addPlugin(command())
.addReporter(specReporter())
.addPath('tests/unit/**/*.ts')
.setForceExit()
.setCliArgs(process.argv.slice(2))
.setGlobalTimeout(30000)
.run()
.finally(() => MongoMemory.stop())
Loading
Loading