chore: improve build process
This commit is contained in:
@@ -13,8 +13,6 @@
|
|||||||
},
|
},
|
||||||
"files": ["dist", "README.md"],
|
"files": ["dist", "README.md"],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
|
||||||
"dev": "tsc --watch",
|
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"lint": "biome check src",
|
"lint": "biome check src",
|
||||||
"format": "biome format --write src",
|
"format": "biome format --write src",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"workspaces": ["apps/*", "packages/*", "."],
|
"workspaces": ["apps/*", "packages/*", "."],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run build:build-config && tsup",
|
"build": "npm run build:build-config && tsup",
|
||||||
"dev": "tsup --watch",
|
"dev": "tsup --watch='packages/*/src/**/*' --watch='apps/cli/src/**/*' --watch='bin/**/*' --watch='mcp-server/**/*'",
|
||||||
"turbo:dev": "turbo dev",
|
"turbo:dev": "turbo dev",
|
||||||
"turbo:build": "turbo build",
|
"turbo:build": "turbo build",
|
||||||
"turbo:typecheck": "turbo typecheck",
|
"turbo:typecheck": "turbo typecheck",
|
||||||
|
|||||||
@@ -53,8 +53,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup",
|
|
||||||
"dev": "tsup --watch",
|
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vitest run --coverage",
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import { defineConfig } from 'tsup';
|
|
||||||
import { baseConfig, mergeConfig } from '@tm/build-config';
|
|
||||||
import { load as dotenvLoad } from 'dotenv-mono';
|
|
||||||
|
|
||||||
dotenvLoad();
|
|
||||||
|
|
||||||
// Get all TM_PUBLIC_* env variables for build-time injection
|
|
||||||
const getBuildTimeEnvs = () => {
|
|
||||||
const envs: Record<string, string> = {};
|
|
||||||
for (const [key, value] of Object.entries(process.env)) {
|
|
||||||
if (key.startsWith('TM_PUBLIC_')) {
|
|
||||||
// Return the actual value, not JSON.stringify'd
|
|
||||||
envs[key] = value || '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return envs;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default defineConfig(
|
|
||||||
mergeConfig(baseConfig, {
|
|
||||||
entry: {
|
|
||||||
index: 'src/index.ts',
|
|
||||||
'auth/index': 'src/auth/index.ts',
|
|
||||||
'config/index': 'src/config/index.ts',
|
|
||||||
'errors/index': 'src/errors/index.ts',
|
|
||||||
'interfaces/index': 'src/interfaces/index.ts',
|
|
||||||
'logger/index': 'src/logger/index.ts',
|
|
||||||
'parser/index': 'src/parser/index.ts',
|
|
||||||
'providers/index': 'src/providers/index.ts',
|
|
||||||
'services/index': 'src/services/index.ts',
|
|
||||||
'storage/index': 'src/storage/index.ts',
|
|
||||||
'types/index': 'src/types/index.ts',
|
|
||||||
'utils/index': 'src/utils/index.ts'
|
|
||||||
},
|
|
||||||
format: ['esm'],
|
|
||||||
dts: true,
|
|
||||||
outDir: 'dist',
|
|
||||||
// Replace process.env.TM_PUBLIC_* with actual values at build time
|
|
||||||
env: getBuildTimeEnvs()
|
|
||||||
})
|
|
||||||
);
|
|
||||||
@@ -12,7 +12,15 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"baseUrl": "."
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@tm/core": ["./packages/tm-core/src/index.ts"],
|
||||||
|
"@tm/core/*": ["./packages/tm-core/src/*"],
|
||||||
|
"@tm/cli": ["./apps/cli/src/index.ts"],
|
||||||
|
"@tm/cli/*": ["./apps/cli/src/*"],
|
||||||
|
"@tm/build-config": ["./packages/build-config/src/index.ts"],
|
||||||
|
"@tm/build-config/*": ["./packages/build-config/src/*"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"tsx": {
|
"tsx": {
|
||||||
"tsconfig": {
|
"tsconfig": {
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
import { defineConfig } from 'tsup';
|
import { defineConfig } from 'tsup';
|
||||||
import { baseConfig, mergeConfig } from '@tm/build-config';
|
import { baseConfig, mergeConfig } from '@tm/build-config';
|
||||||
|
import { load as dotenvLoad } from 'dotenv-mono';
|
||||||
|
|
||||||
|
dotenvLoad();
|
||||||
|
|
||||||
|
// Get all TM_PUBLIC_* env variables for build-time injection
|
||||||
|
const getBuildTimeEnvs = () => {
|
||||||
|
const envs: Record<string, string> = {};
|
||||||
|
for (const [key, value] of Object.entries(process.env)) {
|
||||||
|
if (key.startsWith('TM_PUBLIC_')) {
|
||||||
|
// Return the actual value, not JSON.stringify'd
|
||||||
|
envs[key] = value || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return envs;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export default defineConfig(
|
export default defineConfig(
|
||||||
mergeConfig(baseConfig, {
|
mergeConfig(baseConfig, {
|
||||||
@@ -21,6 +37,7 @@ export default defineConfig(
|
|||||||
'tests',
|
'tests',
|
||||||
'*.test.*',
|
'*.test.*',
|
||||||
'*.spec.*'
|
'*.spec.*'
|
||||||
]
|
],
|
||||||
|
env: getBuildTimeEnvs()
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
"dev": {
|
"dev": {
|
||||||
"cache": false,
|
"cache": false,
|
||||||
"persistent": true,
|
"persistent": true,
|
||||||
"dependsOn": ["^build"],
|
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"$TURBO_DEFAULT$",
|
"$TURBO_DEFAULT$",
|
||||||
"!{packages,apps}/**/dist/**",
|
"!{packages,apps}/**/dist/**",
|
||||||
|
|||||||
Reference in New Issue
Block a user