Skip to content

Commit d63dc9c

Browse files
committed
refactor: add barrels to shared package
1 parent ffa2b07 commit d63dc9c

File tree

11 files changed

+64
-23
lines changed

11 files changed

+64
-23
lines changed

backend/src/internal/core/entity/EmotionProfile.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import {
2-
type EmotionScores as SharedEmotionScores,
3-
type TonalityScores as SharedTonalityScores,
4-
} from '@devbarometer/shared';
1+
import type {
2+
EmotionScores,
3+
TonalityScores,
4+
} from '@devbarometer/shared/domain';
55

6-
export type EmotionScores = SharedEmotionScores;
7-
export type TonalityScores = SharedTonalityScores;
6+
export type { EmotionScores, TonalityScores };
87

98
export interface AggregatedEmotionProfile {
109
count: number;
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
import {
2-
WEATHER_EMOJIS as SHARED_WEATHER_EMOJIS,
3-
type Report as SharedReport,
4-
type WeatherEmoji as SharedWeatherEmoji,
5-
} from '@devbarometer/shared';
6-
7-
export const WEATHER_EMOJIS = SHARED_WEATHER_EMOJIS;
8-
export type WeatherEmoji = SharedWeatherEmoji;
9-
export type Report = SharedReport;
1+
export { WEATHER_EMOJIS, type Report } from '@devbarometer/shared';

backend/src/internal/core/port/QueryPort.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import type { HeadlineDto } from '@devbarometer/shared';
2-
import { type AggregatedEmotionProfileDto } from '@devbarometer/shared';
1+
import type {
2+
AggregatedEmotionProfileDto,
3+
HeadlineDto,
4+
} from '@devbarometer/shared/dto';
35
import type { EmotionProfile } from '../entity/EmotionProfile';
46
import type { Report } from '../entity/Report';
57

eslint.config.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,21 @@ export default defineConfig([
7777
},
7878
},
7979
},
80+
{
81+
files: ['frontend/src/**/*.{ts,tsx}', 'backend/src/**/*.{ts,tsx}'],
82+
rules: {
83+
'no-restricted-imports': [
84+
'error',
85+
{
86+
patterns: [
87+
{
88+
group: ['@devbarometer/shared/*/*'],
89+
message:
90+
'Use the published barrels (e.g. "@devbarometer/shared") instead of deep internal paths.',
91+
},
92+
],
93+
},
94+
],
95+
},
96+
},
8097
]);

shared/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,34 @@
77
".": {
88
"types": "./dist/index.d.ts",
99
"default": "./dist/index.js"
10+
},
11+
"./domain": {
12+
"types": "./dist/domain/index.d.ts",
13+
"default": "./dist/domain/index.js"
14+
},
15+
"./dto": {
16+
"types": "./dist/dto/index.d.ts",
17+
"default": "./dist/dto/index.js"
18+
},
19+
"./primitives": {
20+
"types": "./dist/primitives/index.d.ts",
21+
"default": "./dist/primitives/index.js"
1022
}
1123
},
1224
"types": "./dist/index.d.ts",
25+
"typesVersions": {
26+
"*": {
27+
"domain": [
28+
"dist/domain/index.d.ts"
29+
],
30+
"dto": [
31+
"dist/dto/index.d.ts"
32+
],
33+
"primitives": [
34+
"dist/primitives/index.d.ts"
35+
]
36+
}
37+
},
1338
"files": [
1439
"dist"
1540
],

shared/src/domain/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './EmotionMetrics';
2+
export * from './Report';

shared/src/dto/aggregatedEmotionProfileDto.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { z } from 'zod';
2-
import { EmotionScoresSchema, TonalityScoresSchema } from '../domain/Emotion';
2+
import {
3+
EmotionScoresSchema,
4+
TonalityScoresSchema,
5+
} from '../domain/EmotionMetrics';
36
import { IsoDateStringSchema } from '../primitives/date';
47

58
export const AggregatedEmotionProfileDtoSchema = z.object({

shared/src/dto/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './aggregatedEmotionProfileDto';
2+
export * from './headlineDto';

shared/src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export * from './domain/Emotion';
2-
export * from './domain/Report';
3-
export * from './dto/aggregatedEmotionProfileDto';
4-
export * from './dto/headlineDto';
5-
export * from './primitives/date';
1+
export * from './domain';
2+
export * from './dto';
3+
export * from './primitives';

0 commit comments

Comments
 (0)