Skip to content

Commit d70d70b

Browse files
authored
chore: metrics-utils common tsconfig (#544)
* metrics-utils using shared tsconfig * Imports fixes * Lint fix
1 parent 1fa0a88 commit d70d70b

8 files changed

Lines changed: 21 additions & 45 deletions

File tree

packages/app/metrics-utils/biome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "../../../node_modules/@biomejs/biome/configuration_schema.json",
33
"extends": [
44
"../../../node_modules/@lokalise/biome-config/configs/biome-base.jsonc",
5-
"../../../node_modules/@lokalise/biome-config/configs/biome-package.jsonc"
5+
"../../../node_modules/@lokalise/biome-config/configs/biome-package.jsonc",
6+
"../../../node_modules/@lokalise/biome-config/configs/biome-esm.jsonc"
67
]
78
}

packages/app/metrics-utils/package.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,45 @@
44
"files": ["dist"],
55
"license": "Apache-2.0",
66
"type": "module",
7-
"main": "./dist/index.cjs",
8-
"module": "./dist/index.js",
9-
"types": "./dist/index.d.ts",
7+
"main": "./dist/index.js",
108
"homepage": "https://github.com/lokalise/shared-ts-libs",
119
"repository": {
1210
"type": "git",
1311
"url": "git://github.com/lokalise/shared-ts-libs.git"
1412
},
1513
"exports": {
16-
".": {
17-
"types": "./dist/index.d.ts",
18-
"require": "./dist/index.cjs",
19-
"import": "./dist/index.js"
20-
}
14+
".": "./dist/index.js",
15+
"./package.json": "./package.json"
2116
},
2217
"publishConfig": {
2318
"access": "public"
2419
},
2520
"scripts": {
2621
"build": "rimraf dist && vite build",
2722
"clean": "rimraf dist",
28-
"lint": "biome check . && tsc --project tsconfig.lint.json --noEmit",
23+
"lint": "biome check . && tsc",
2924
"lint:fix": "biome check --write",
3025
"test:ci": "vitest run --coverage",
3126
"prepublishOnly": "npm run build",
3227
"package-version": "echo $npm_package_version",
3328
"postversion": "biome check --write package.json"
3429
},
3530
"peerDependencies": {
36-
"@lokalise/fastify-extras": ">=24.0.0",
31+
"@lokalise/fastify-extras": ">=27.0.0",
3732
"prom-client": "^15.1.3",
3833
"fastify-metrics": "^12.1.0"
3934
},
4035
"devDependencies": {
4136
"@biomejs/biome": "^1.9.4",
4237
"@lokalise/biome-config": "^1.5.0",
43-
"@lokalise/fastify-extras": "^26.1.1",
38+
"@lokalise/fastify-extras": "^27.0.0",
4439
"@lokalise/package-vite-config": "latest",
40+
"@lokalise/tsconfig": "^1.0.2",
4541
"@vitest/coverage-v8": "^3.0.7",
4642
"rimraf": "^6.0.1",
4743
"typescript": "5.8.2",
4844
"vite": "6.2.1",
45+
"vite-plugin-dts": "^4.5.3",
4946
"vitest": "^3.0.7"
5047
}
5148
}

packages/app/metrics-utils/src/AbstractCounterMetric.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { IFastifyMetrics } from 'fastify-metrics'
22
import { type Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
3-
import { AbstractCounterMetric } from './AbstractCounterMetric'
3+
import { AbstractCounterMetric } from './AbstractCounterMetric.js'
44

55
class ConcreteCounterMetric extends AbstractCounterMetric<'status', ['successful', 'failed']> {
66
constructor(appMetrics?: IFastifyMetrics) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { AbstractCounterMetric } from './AbstractCounterMetric'
1+
export { AbstractCounterMetric } from './AbstractCounterMetric.js'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": ["./tsconfig.json", "@lokalise/tsconfig/build-public-lib"],
3+
"include": ["src/**/*"],
4+
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
5+
}
Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
{
2-
"compilerOptions": {
3-
"outDir": "dist",
4-
"module": "ESNext",
5-
"target": "ESNext",
6-
"lib": ["ESNext"],
7-
"sourceMap": true,
8-
"declaration": true,
9-
"declarationMap": true,
10-
"types": ["vitest/globals"],
11-
"strict": true,
12-
"moduleResolution": "node",
13-
"noUnusedLocals": false,
14-
"noUnusedParameters": false,
15-
"noFallthroughCasesInSwitch": true,
16-
"strictNullChecks": true,
17-
"importHelpers": true,
18-
"baseUrl": ".",
19-
"allowSyntheticDefaultImports": true,
20-
"esModuleInterop": true,
21-
"skipLibCheck": true,
22-
"forceConsistentCasingInFileNames": true,
23-
"resolveJsonModule": true
24-
},
25-
"include": ["src/**/*"],
26-
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
2+
"extends": "@lokalise/tsconfig/bundler",
3+
"include": ["src/**/*", "vite.config.ts"]
274
}

packages/app/metrics-utils/tsconfig.lint.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/app/metrics-utils/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { resolve } from 'node:path'
2-
32
import defineConfig from '@lokalise/package-vite-config/package'
3+
import dtsPlugin from 'vite-plugin-dts'
44

55
// @ts-ignore
66
import packageJson from './package.json'
@@ -9,6 +9,7 @@ import packageJson from './package.json'
99
export default defineConfig({
1010
entry: resolve(__dirname, 'src/index.ts'),
1111
dependencies: Object.keys(packageJson.peerDependencies),
12+
plugins: [dtsPlugin({ tsconfigPath: './tsconfig.build.json' })],
1213
test: {
1314
coverage: {
1415
exclude: ['src/**/index.ts', 'src/**/*.spec.ts'],

0 commit comments

Comments
 (0)