Skip to content

Commit

Permalink
Moved shim to separate bundle to remove automatic dependency to mongo…
Browse files Browse the repository at this point in the history
…db package

Now to import Mongo client you'll need to do it through '@event-driven-io/Pongo/shim'
  • Loading branch information
oskardudycz committed Aug 8, 2024
1 parent c94f3f8 commit b39aafc
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@event-driven-io/pongo-core",
"version": "0.9.0",
"version": "0.11.0",
"description": "Pongo - Mongo with strong consistency on top of Postgres",
"type": "module",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/dumbo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@event-driven-io/dumbo",
"version": "0.7.0",
"version": "0.7.1",
"description": "Dumbo - tools for dealing with PostgreSQL",
"type": "module",
"scripts": {
Expand Down
14 changes: 12 additions & 2 deletions src/packages/pongo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@event-driven-io/pongo",
"version": "0.10.0",
"version": "0.11.0",
"description": "Pongo - Mongo with strong consistency on top of Postgres",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -38,6 +38,16 @@
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./shim": {
"import": {
"types": "./dist/shim/index.d.ts",
"default": "./dist/shim/index.js"
},
"require": {
"types": "./dist/shim/index.d.cts",
"default": "./dist/shim/index.cjs"
}
}
},
"main": "./dist/index.cjs",
Expand All @@ -47,7 +57,7 @@
"dist"
],
"peerDependencies": {
"@event-driven-io/dumbo": "0.7.0",
"@event-driven-io/dumbo": "0.7.1",
"@types/mongodb": "^4.0.7",
"@types/pg": "^8.11.6",
"@types/pg-format": "^1.0.5",
Expand Down
2 changes: 1 addition & 1 deletion src/packages/pongo/src/e2e/compatibilityTest.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from 'mongodb';
import { after, before, describe, it } from 'node:test';
import { v4 as uuid } from 'uuid';
import { MongoClient, type Db } from '../';
import { MongoClient, type Db } from '../shim';

type History = { street: string };
type Address = {
Expand Down
10 changes: 2 additions & 8 deletions src/packages/pongo/src/e2e/postgres.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ import assert from 'assert';
import console from 'console';
import { after, before, describe, it } from 'node:test';
import { v4 as uuid } from 'uuid';
import {
MongoClient,
pongoClient,
type Db,
type ObjectId,
type PongoClient,
type PongoDb,
} from '..';
import { pongoClient, type PongoClient, type PongoDb } from '../';
import { MongoClient, type Db, type ObjectId } from '../shim';

type History = { street: string };
type Address = {
Expand Down
1 change: 0 additions & 1 deletion src/packages/pongo/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './core';
export * from './mongo';
export * from './postgres';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/packages/pongo/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
watch: env === 'development',
target: 'esnext',
outDir: 'dist', //env === 'production' ? 'dist' : 'lib',
entry: ['src/index.ts'],
entry: ['src/index.ts', 'src/shim/index.ts'],
//entry: ['src/**/*.ts', '!src/**/*.spec.ts', '!src/**/*.internal.ts'], //include all files under src but not specs
sourcemap: true,
tsconfig: 'tsconfig.build.json', // workaround for https://github.com/egoist/tsup/issues/571#issuecomment-1760052931
Expand Down

0 comments on commit b39aafc

Please sign in to comment.