feat: add file storage service and update configurations
refactor: migrate to tsup for builds and update tsconfigs fix: update error handling and validation in payment service chore: update package scripts and dependencies docs: update README and env examples
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
{
|
||||
"name": "@repo/config",
|
||||
"version": "0.0.0",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "tsc --watch",
|
||||
"build": "tsc",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit"
|
||||
"build": "tsup",
|
||||
"dev": "tsup --watch",
|
||||
"lint": "eslint src/",
|
||||
"check-types": "tsc --noEmit",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"znv": "^0.5.0",
|
||||
@@ -18,6 +34,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/typescript-config": "*",
|
||||
"typescript": "^5.0.0"
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { parseEnv } from 'znv';
|
||||
import { z } from 'zod';
|
||||
import type { ConfigSchema, ConfigOptions, InferConfig } from './types';
|
||||
import { parseEnv } from "znv";
|
||||
import { z } from "zod";
|
||||
import type { ConfigSchema, ConfigOptions, InferConfig } from "./types";
|
||||
|
||||
export const createConfig = <T extends ConfigSchema>(
|
||||
options: ConfigOptions<T>,
|
||||
): InferConfig<T> => {
|
||||
const { schema, env = process.env, prefix = '' } = options;
|
||||
const { schema, env = process.env, prefix = "" } = options;
|
||||
|
||||
// Add prefix to schema keys if provided
|
||||
const prefixedSchema = prefix
|
||||
@@ -14,7 +14,7 @@ export const createConfig = <T extends ConfigSchema>(
|
||||
acc[`${prefix}${key}`] = zodSchema;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, z.ZodTypeAny>
|
||||
{} as Record<string, z.ZodTypeAny>,
|
||||
)
|
||||
: schema;
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './create-config';
|
||||
export * from './types';
|
||||
export * from "./create-config";
|
||||
export * from "./types";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import { z } from "zod";
|
||||
|
||||
export type ConfigSchema = Record<string, z.ZodTypeAny>;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"extends": "@repo/typescript-config/base.json",
|
||||
"extends": "@repo/typescript-config/library.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["dist", "node_modules"]
|
||||
}
|
||||
"include": ["src/**/*", "tsup.config.ts"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
||||
13
packages/config/tsup.config.ts
Normal file
13
packages/config/tsup.config.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["src/index.ts"],
|
||||
format: ["cjs", "esm"],
|
||||
dts: true,
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
treeshake: true,
|
||||
minify: false,
|
||||
target: "es2022",
|
||||
});
|
||||
Reference in New Issue
Block a user