Skip to content

Commit

Permalink
Support for node 18. Fixes #140 #141
Browse files Browse the repository at this point in the history
  • Loading branch information
rmp135 committed Apr 5, 2024
1 parent b5ef187 commit 099806c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ on:
jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test

3 changes: 2 additions & 1 deletion src/ConfigTasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from 'path'
import { Config } from './Typings.js'
import { fileURLToPath } from 'url'

/**
* Applies configuration defaults to a given configuration object.
Expand All @@ -24,7 +25,7 @@ export function applyConfigDefaults(config: Config): Config {
schemaAsNamespace: false,
typeOverrides: {},
typeMap: {},
template: path.join(import.meta.dirname, './template.handlebars'),
template: path.join(path.dirname(fileURLToPath(import.meta.url)), './template.handlebars'),
custom: {}
}
return Object.assign(defaultConfig, config)
Expand Down
4 changes: 2 additions & 2 deletions src/EnumTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import * as SchemaTasks from './SchemaTasks.js'
export async function getAllEnums(db: Knex, config: Config): Promise<Enum[]> {
const adapter = AdapterFactory.buildAdapter(db.client.dialect)
return (await adapter.getAllEnums(db, config))
.toSorted((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.name.localeCompare(b.name))
.map(e => ({
name: e.name,
schema: SchemaTasks.generateSchemaName(e.schema),
convertedName: generateEnumName(e.name, config),
values: Object.keys(e.values).toSorted((a, b) => a.localeCompare(b)).map(ee => ({
values: Object.keys(e.values).sort((a, b) => a.localeCompare(b)).map(ee => ({
originalKey: ee,
convertedKey: generateEnumKey(ee, config),
value: e.values[ee]
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"src/**/*.spec.*"
],
"compilerOptions": {
"target": "ESNext",
"target": "ES2022",
"declaration": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
Expand Down

0 comments on commit 099806c

Please sign in to comment.