diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16ac812b..2f777de2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['16', '18'] + node-version: ['18', '20'] name: Test (node ${{ matrix.node-version }}.x) steps: - uses: actions/checkout@v4 diff --git a/.prettierignore b/.prettierignore index e2d42ced..18a0f547 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ packages/example -packages/query/src/loader/*/parser/ \ No newline at end of file +packages/query/src/loader/*/parser/ +packages/runtime/lib/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e4cce6e..173a5f1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ The `packages/example` project is an end-to-end test suite for pgTyped. It conta The packages `npm test` runs the following command: ```bash -docker-compose run build && docker-compose run test && docker-compose run test-cjs +docker compose run build && docker compose run test && docker compose run test-cjs ``` As you can see it runs the `build` target, then runs the `test` target twice, once with the `esm` module format and once with the `cjs` module format: diff --git a/package-lock.json b/package-lock.json index 45c2a298..fc779891 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,9 @@ "tslint-config-prettier": "1.18.0", "tslint-plugin-prettier": "2.3.0", "typescript": "5.0.4" + }, + "engines": { + "node": ">=18" } }, "node_modules/@ampproject/remapping": { @@ -11923,7 +11926,7 @@ "@pgtyped/wire": "^2.3.0", "camel-case": "^5.0.0", "chalk": "^4.0.0", - "chokidar": "^4.0.1", + "chokidar": "^4.0.0", "debug": "^4.1.1", "fp-ts": "^2.5.3", "fs-extra": "^11.0.0", @@ -14241,7 +14244,7 @@ "@types/yargs": "17.0.33", "camel-case": "^5.0.0", "chalk": "^4.0.0", - "chokidar": "4.0.1", + "chokidar": "^4.0.0", "debug": "^4.1.1", "fp-ts": "^2.5.3", "fs-extra": "^11.0.0", diff --git a/package.json b/package.json index 93a60e7e..1be3e8aa 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,8 @@ }, "dependencies": { "io-ts": "^2.1.2" + }, + "engines": { + "node": ">=18" } } diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index a0e5cd99..d04bec8d 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -5,7 +5,7 @@ import { AsyncQueue } from '@pgtyped/wire'; import chokidar from 'chokidar'; import nun from 'nunjucks'; -import PiscinaPool from 'piscina'; +import { Piscina as PiscinaPool } from 'piscina'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; import { parseConfig, ParsedConfig, TransformConfig } from './config.js'; @@ -149,7 +149,7 @@ if (isWatchMode && fileOverride) { } try { - chokidar.watch(configPath).on('change', () => { + chokidar.watch(configPath, {}).on('change', () => { console.log('Config file changed. Exiting.'); process.exit(); }); diff --git a/packages/cli/src/typedSqlTagTransformer.ts b/packages/cli/src/typedSqlTagTransformer.ts index d6a13d75..b78e6971 100644 --- a/packages/cli/src/typedSqlTagTransformer.ts +++ b/packages/cli/src/typedSqlTagTransformer.ts @@ -49,7 +49,7 @@ export class TypedSqlTagTransformer { chokidar .watch(this.includePattern, { persistent: true, - ignored: [this.localFileName], + ignored: this.localFileName, }) .on('add', cb) .on('change', cb) diff --git a/packages/example/README.md b/packages/example/README.md index db958c81..120b4002 100644 --- a/packages/example/README.md +++ b/packages/example/README.md @@ -15,7 +15,7 @@ Try starting PgTyped and editing them to see live query type generation. 2. `cd pgtyped/packages/example` 3. `npm install` 4. `npm run build` -5. `docker-compose run watch` +5. `docker compose run watch` 6. Try editing queries in the SQL and TS files and see how PgTyped handles it. The dockerized setup isn't required and is included for convenience. diff --git a/packages/example/package.json b/packages/example/package.json index 06e1b688..1bc1f6fb 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -15,7 +15,7 @@ "node": ">=14.16" }, "scripts": { - "test": "docker-compose run build && docker-compose run test && docker-compose run test-cjs", + "test": "docker compose run build && docker compose run test && docker compose run test-cjs", "typegen": "pgtyped -c config.json", "build": "echo 'No build step required. Use npm test instead'", "watch": "echo 'No build step required. Use npm test instead'", diff --git a/tsconfig.json b/tsconfig.json index 2f6fd295..6233fbd4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -44,7 +44,7 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ /* Source Map Options */ @@ -56,5 +56,6 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "resolveJsonModule": true /* Include modules imported with '.json' extension */, } }