Skip to content

Commit

Permalink
chore: Add exports field for utils and types modules from Shared package
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaah committed Nov 19, 2024
1 parent aa3b4f4 commit 37fa0ef
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@freedivah/shared';
import { logger } from '@freedivah/shared/utils';

logger('Shared is connected', {
state: 'ON',
Expand Down
43 changes: 26 additions & 17 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"module": "commonjs",
"moduleResolution": "node",
"noEmit": false,
"baseUrl": ".",
"paths": {
"@freedivah/shared": ["../shared/src"]
}
},
"references": [
{ "path": "../shared" }
],
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"module": "commonjs",
"moduleResolution": "node",
"noEmit": false,
"baseUrl": ".",
"paths": {
"@freedivah/shared": [
"../shared"
]
}
},
"references": [
{
"path": "../shared"
}
],
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"dist"
]
}
12 changes: 11 additions & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
},
"exports": {
"./utils": {
"types": "./dist/utils/index.d.ts",
"default": "./dist/utils/index.js"
},
"./types": {
"types": "./dist/types/index.d.ts",
"default": "./dist/types/index.js"
}
},
"devDependencies": {
"ts-jest": "^29.2.5"
}
}
}
12 changes: 4 additions & 8 deletions packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
"compilerOptions": {
"composite": true,
"outDir": "./dist",
"rootDir": "./src",
"rootDir": ".",
"declaration": true,
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"*": [
"src/*"
]
}
"baseUrl": "."
},
"include": [
"src/**/*"
"**/*.ts",
"utils/index.ts"
],
"exclude": [
"node_modules",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from "@freedivah/shared";
import { logger } from "@freedivah/shared/utils";

logger('Shared is connected', {
state: 'ON',
Expand Down
3 changes: 3 additions & 0 deletions packages/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"@/*": [
"./src/*"
],
"@shared/*": [
"../shared/*"
],
"@styles/*": [
"./src/styles/*"
],
Expand Down

0 comments on commit 37fa0ef

Please sign in to comment.