Skip to content

Commit 7b92ce8

Browse files
authored
Mariano/fix existing automations missing (#1932)
* fix(app): update custom automations section to show based on conditions * chore(api): add integration platform extension and update workflows
1 parent ae1787c commit 7b92ce8

File tree

5 files changed

+114
-2
lines changed

5 files changed

+114
-2
lines changed

.github/workflows/trigger-tasks-deploy-main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ jobs:
2424
- name: Install Email package dependencies
2525
working-directory: ./packages/email
2626
run: bun install --frozen-lockfile --ignore-scripts
27+
- name: Install Integration Platform package dependencies
28+
working-directory: ./packages/integration-platform
29+
run: bun install --frozen-lockfile --ignore-scripts
2730
- name: Build DB package
2831
working-directory: ./packages/db
2932
run: bun run build
33+
- name: Build Integration Platform package
34+
working-directory: ./packages/integration-platform
35+
run: bun run build
3036
- name: Copy schema to app and generate client
3137
working-directory: ./apps/app
3238
run: |

.github/workflows/trigger-tasks-deploy-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,18 @@ jobs:
2727
- name: Install Email package dependencies
2828
working-directory: ./packages/email
2929
run: bun install --frozen-lockfile --ignore-scripts
30+
- name: Install Integration Platform package dependencies
31+
working-directory: ./packages/integration-platform
32+
run: bun install --frozen-lockfile --ignore-scripts
3033

3134
- name: Build DB package
3235
working-directory: ./packages/db
3336
run: bun run build
3437

38+
- name: Build Integration Platform package
39+
working-directory: ./packages/integration-platform
40+
run: bun run build
41+
3542
- name: Copy schema to app and generate client
3643
working-directory: ./apps/app
3744
run: |
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import type {
2+
BuildContext,
3+
BuildExtension,
4+
BuildManifest,
5+
} from '@trigger.dev/build';
6+
import { existsSync } from 'node:fs';
7+
import { cp, mkdir } from 'node:fs/promises';
8+
import { dirname, resolve } from 'node:path';
9+
10+
/**
11+
* Custom Trigger.dev build extension for @comp/integration-platform workspace package.
12+
*
13+
* Since @comp/integration-platform is a workspace package (not published to npm),
14+
* we need to manually copy its built dist files into the trigger.dev deployment.
15+
*/
16+
export function integrationPlatformExtension(): IntegrationPlatformExtension {
17+
return new IntegrationPlatformExtension();
18+
}
19+
20+
class IntegrationPlatformExtension implements BuildExtension {
21+
public readonly name = 'IntegrationPlatformExtension';
22+
23+
externalsForTarget(target: string) {
24+
if (target === 'dev') {
25+
return [];
26+
}
27+
// Mark as external so esbuild doesn't try to bundle it
28+
return ['@comp/integration-platform'];
29+
}
30+
31+
async onBuildComplete(context: BuildContext, manifest: BuildManifest) {
32+
if (context.target === 'dev') {
33+
return;
34+
}
35+
36+
// Find the integration-platform package dist
37+
const packageDistPath = this.findPackageDist(context.workingDir);
38+
39+
if (!packageDistPath) {
40+
throw new Error(
41+
[
42+
'IntegrationPlatformExtension could not find @comp/integration-platform dist.',
43+
'Make sure the package is built (run `bun run build` in packages/integration-platform).',
44+
'Searched in: ' +
45+
resolve(
46+
context.workingDir,
47+
'../../packages/integration-platform/dist',
48+
),
49+
].join('\n'),
50+
);
51+
}
52+
53+
context.logger.debug(
54+
`Found integration-platform dist at ${packageDistPath}`,
55+
);
56+
57+
// Copy the entire dist to the build output
58+
const destPath = resolve(
59+
manifest.outputPath,
60+
'node_modules/@comp/integration-platform',
61+
);
62+
const destDistPath = resolve(destPath, 'dist');
63+
64+
await mkdir(destDistPath, { recursive: true });
65+
66+
// Copy dist files
67+
await cp(packageDistPath, destDistPath, { recursive: true });
68+
69+
// Copy package.json for proper module resolution
70+
const packageJsonPath = resolve(dirname(packageDistPath), 'package.json');
71+
if (existsSync(packageJsonPath)) {
72+
await cp(packageJsonPath, resolve(destPath, 'package.json'));
73+
}
74+
75+
context.logger.log(
76+
'Copied @comp/integration-platform to deployment bundle',
77+
);
78+
}
79+
80+
private findPackageDist(workingDir: string): string | undefined {
81+
// Look for the package relative to the api app
82+
const candidates = [
83+
resolve(workingDir, '../../packages/integration-platform/dist'),
84+
resolve(workingDir, '../packages/integration-platform/dist'),
85+
];
86+
87+
for (const candidate of candidates) {
88+
if (existsSync(candidate)) {
89+
return candidate;
90+
}
91+
}
92+
93+
return undefined;
94+
}
95+
}

apps/api/trigger.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { PrismaInstrumentation } from '@prisma/instrumentation';
22
import { syncVercelEnvVars } from '@trigger.dev/build/extensions/core';
33
import { defineConfig } from '@trigger.dev/sdk';
44
import { prismaExtension } from './customPrismaExtension';
5+
import { integrationPlatformExtension } from './integrationPlatformExtension';
56

67
export default defineConfig({
78
project: 'proj_zhioyrusqertqgafqgpj', // API project
@@ -14,6 +15,7 @@ export default defineConfig({
1415
version: '6.13.0',
1516
dbPackageVersion: '^1.3.15', // Version of @trycompai/db package with compiled JS
1617
}),
18+
integrationPlatformExtension(),
1719
syncVercelEnvVars(),
1820
],
1921
},

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/components/SingleTask.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ export function SingleTask({
205205
{/* Browser Automations Section */}
206206
{isWebAutomationsEnabled && <BrowserAutomations taskId={task.id} />}
207207

208-
{/* Custom Automations Section - only show if no mapped integration checks available */}
209-
{!hasMappedChecks && <TaskAutomations automations={automations || []} />}
208+
{/* Custom Automations Section - always show if automations exist, or show empty state if no integration checks */}
209+
{((automations && automations.length > 0) || !hasMappedChecks) && (
210+
<TaskAutomations automations={automations || []} />
211+
)}
210212

211213
{/* Comments Section */}
212214
<div>

0 commit comments

Comments
 (0)