chore: fix env variables (#1204)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
|||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
|
|
||||||
- name: Typecheck
|
- name: Typecheck
|
||||||
run: npm run typecheck
|
run: npm run turbo:typecheck
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: 1
|
FORCE_COLOR: 1
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ jobs:
|
|||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run turbo:build
|
||||||
env:
|
env:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
FORCE_COLOR: 1
|
FORCE_COLOR: 1
|
||||||
|
|||||||
@@ -318,7 +318,13 @@ export const TaskMetadataSidebar: React.FC<TaskMetadataSidebarProps> = ({
|
|||||||
variant="default"
|
variant="default"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="w-full text-xs"
|
className="w-full text-xs"
|
||||||
disabled={isRegenerating || isAppending || isStartingTask || currentTask?.status === 'done'}
|
disabled={
|
||||||
|
isRegenerating ||
|
||||||
|
isAppending ||
|
||||||
|
isStartingTask ||
|
||||||
|
currentTask?.status === 'done' ||
|
||||||
|
currentTask?.status === 'in-progress'
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{isStartingTask ? (
|
{isStartingTask ? (
|
||||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||||
|
|||||||
@@ -363,20 +363,25 @@ export class WebviewManager {
|
|||||||
|
|
||||||
case 'openTerminal':
|
case 'openTerminal':
|
||||||
// Open VS Code terminal for task execution
|
// Open VS Code terminal for task execution
|
||||||
this.logger.info(`Opening terminal for task ${data.taskId}: ${data.taskTitle}`);
|
this.logger.log(
|
||||||
|
`Opening terminal for task ${data.taskId}: ${data.taskTitle}`
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const terminal = vscode.window.createTerminal({
|
const terminal = vscode.window.createTerminal({
|
||||||
name: `Task ${data.taskId}: ${data.taskTitle}`,
|
name: `Task ${data.taskId}: ${data.taskTitle}`,
|
||||||
cwd: this.workspaceRoot
|
cwd: vscode.workspace.workspaceFolders?.[0]?.uri.fsPath
|
||||||
});
|
});
|
||||||
terminal.show();
|
terminal.show();
|
||||||
|
|
||||||
this.logger.info('Terminal created and shown successfully');
|
this.logger.log('Terminal created and shown successfully');
|
||||||
response = { success: true };
|
response = { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error('Failed to create terminal:', error);
|
this.logger.error('Failed to create terminal:', error);
|
||||||
response = { success: false, error: error.message };
|
response = {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
3
package-lock.json
generated
3
package-lock.json
generated
@@ -31274,9 +31274,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.9.4",
|
"@biomejs/biome": "^1.9.4",
|
||||||
|
"@tm/build-config": "*",
|
||||||
"@types/node": "^20.11.30",
|
"@types/node": "^20.11.30",
|
||||||
"@vitest/coverage-v8": "^2.0.5",
|
"@vitest/coverage-v8": "^2.0.5",
|
||||||
|
"dotenv-mono": "^1.3.14",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
"tsup": "^8.5.0",
|
||||||
"typescript": "^5.4.3",
|
"typescript": "^5.4.3",
|
||||||
"vitest": "^2.0.5"
|
"vitest": "^2.0.5"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"dev": "tsup --watch",
|
"dev": "tsup --watch",
|
||||||
"turbo:dev": "turbo dev",
|
"turbo:dev": "turbo dev",
|
||||||
"turbo:build": "turbo build",
|
"turbo:build": "turbo build",
|
||||||
|
"turbo:typecheck": "turbo typecheck",
|
||||||
"dev:main": "tsup --watch --onSuccess 'echo \"📦 Main package built\" && npm link'",
|
"dev:main": "tsup --watch --onSuccess 'echo \"📦 Main package built\" && npm link'",
|
||||||
"dev:legacy": "npm run build:build-config && concurrently -n \"core,cli,main\" -c \"blue,green,yellow\" \"npm run dev:core\" \"npm run dev:cli\" \"npm run dev:main\"",
|
"dev:legacy": "npm run build:build-config && concurrently -n \"core,cli,main\" -c \"blue,green,yellow\" \"npm run dev:core\" \"npm run dev:cli\" \"npm run dev:main\"",
|
||||||
"dev:core": "npm run dev -w @tm/core",
|
"dev:core": "npm run dev -w @tm/core",
|
||||||
@@ -24,10 +25,6 @@
|
|||||||
"build:build-config": "npm run build -w @tm/build-config",
|
"build:build-config": "npm run build -w @tm/build-config",
|
||||||
"build:core": "npm run build -w @tm/core",
|
"build:core": "npm run build -w @tm/core",
|
||||||
"build:cli": "npm run build -w @tm/cli",
|
"build:cli": "npm run build -w @tm/cli",
|
||||||
"typecheck": "turbo typecheck",
|
|
||||||
"typecheck:all": "turbo typecheck",
|
|
||||||
"typecheck:core": "npm run typecheck -w @tm/core",
|
|
||||||
"typecheck:cli": "npm run typecheck -w @tm/cli",
|
|
||||||
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
||||||
"test:unit": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern=unit",
|
"test:unit": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern=unit",
|
||||||
"test:integration": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern=integration",
|
"test:integration": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern=integration",
|
||||||
|
|||||||
@@ -3,38 +3,17 @@
|
|||||||
* Provides shared configuration that can be extended by individual packages
|
* Provides shared configuration that can be extended by individual packages
|
||||||
*/
|
*/
|
||||||
import type { Options } from 'tsup';
|
import type { Options } from 'tsup';
|
||||||
import * as dotenv from 'dotenv-mono';
|
|
||||||
|
|
||||||
dotenv.load();
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
'TM_PUBLIC_BASE_DOMAIN:',
|
|
||||||
process.env.TM_PUBLIC_BASE_DOMAIN,
|
|
||||||
'TM_PUBLIC_SUPABASE_URL:',
|
|
||||||
process.env.TM_PUBLIC_SUPABASE_URL,
|
|
||||||
'TM_PUBLIC_SUPABASE_ANON_KEY:',
|
|
||||||
process.env.TM_PUBLIC_SUPABASE_ANON_KEY
|
|
||||||
);
|
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
const isDevelopment = !isProduction;
|
const isDevelopment = !isProduction;
|
||||||
|
|
||||||
const envVariables = {
|
|
||||||
TM_PUBLIC_BASE_DOMAIN: process.env.TM_PUBLIC_BASE_DOMAIN ?? '',
|
|
||||||
TM_PUBLIC_SUPABASE_URL: process.env.TM_PUBLIC_SUPABASE_URL ?? '',
|
|
||||||
TM_PUBLIC_SUPABASE_ANON_KEY: process.env.TM_PUBLIC_SUPABASE_ANON_KEY ?? ''
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('envVariables:', envVariables);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Environment helpers
|
* Environment helpers
|
||||||
*/
|
*/
|
||||||
export const env = {
|
export const env = {
|
||||||
isProduction,
|
isProduction,
|
||||||
isDevelopment,
|
isDevelopment,
|
||||||
NODE_ENV: process.env.NODE_ENV || 'development',
|
NODE_ENV: process.env.NODE_ENV || 'development'
|
||||||
...envVariables
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +31,6 @@ export const baseConfig: Partial<Options> = {
|
|||||||
splitting: false,
|
splitting: false,
|
||||||
// Don't bundle any other dependencies (auto-external all node_modules)
|
// Don't bundle any other dependencies (auto-external all node_modules)
|
||||||
external: [/^[^./]/],
|
external: [/^[^./]/],
|
||||||
env: envVariables,
|
|
||||||
esbuildOptions(options) {
|
esbuildOptions(options) {
|
||||||
options.platform = 'node';
|
options.platform = 'node';
|
||||||
// Allow importing TypeScript from JavaScript
|
// Allow importing TypeScript from JavaScript
|
||||||
|
|||||||
@@ -53,8 +53,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsup",
|
||||||
"dev": "tsc --watch",
|
"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",
|
||||||
@@ -71,9 +71,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.9.4",
|
"@biomejs/biome": "^1.9.4",
|
||||||
|
"@tm/build-config": "*",
|
||||||
"@types/node": "^20.11.30",
|
"@types/node": "^20.11.30",
|
||||||
"@vitest/coverage-v8": "^2.0.5",
|
"@vitest/coverage-v8": "^2.0.5",
|
||||||
|
"dotenv-mono": "^1.3.14",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
"tsup": "^8.5.0",
|
||||||
"typescript": "^5.4.3",
|
"typescript": "^5.4.3",
|
||||||
"vitest": "^2.0.5"
|
"vitest": "^2.0.5"
|
||||||
},
|
},
|
||||||
|
|||||||
41
packages/tm-core/tsup.config.ts
Normal file
41
packages/tm-core/tsup.config.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
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()
|
||||||
|
})
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user