Skip to content

Commit f040417

Browse files
authored
v3: new build system fixes (#1278)
* Support custom config file names & paths * Fix entry point paths on windows * Support custom conditions Add support for custom conditions (for bundling and running), to support being able to import `ai/rsc` with the “react-server” condition. - Fixed an issue where symlinking unresolvable externals after rebuilding caused the build to hang - Fixed an issue with external not working with subpath exports (e.g. “ai” would not match “ai/rsc”) - Protect better against build extensions breaking builds * Add changeset * Fix passing CLI process.env down to the task processes * Remove unused import * reviving the e2e CLI tests * Another attempt at fixing windows * yet another windows attempt (yawa) * Output index child stdout and stderr (yawa) * normalize import paths for windows * Added some logging (yawa) * normalize the loader path as well * Added some logging to figure out why the entry points aren’t being found on windows * Fix for entry point detection on windows * Normalize runner import loader path * Normalize import paths in dev and make sure rewritten build manifest paths are correct on windows as well * Various cleanup after windows fixes * Remove the webapp e2e for now * Add node10 type resolution support for subpath exports (still does not actually import in Node 10 or Browserify/Parcel) https://github.com/andrewbranch/example-subpath-exports-ts-compat * init using templates again but downloaded from the repo this time * Adding init schedule example * Support for js init * init now working with js * Fix issues with links in terminals that don’t support them. Also skip update check of version starts with 0.0.0
1 parent 5231381 commit f040417

File tree

178 files changed

+4881
-26507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+4881
-26507
lines changed

.changeset/many-papayas-hope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Fix entry point paths on windows

.changeset/smart-meals-join.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Support custom config file names & paths

.changeset/witty-dancers-smash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Support for custom conditions

.github/workflows/e2e.yml

Lines changed: 5 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ on:
99
type: string
1010
jobs:
1111
cli-v3:
12-
name: "🧪 CLI v3 tests"
12+
name: "🧪 CLI v3 tests (${{ matrix.os }} - ${{ matrix.package-manager }})"
1313
if: inputs.package == 'cli-v3' || inputs.package == ''
14-
runs-on: buildjet-8vcpu-ubuntu-2204
14+
runs-on: ${{ matrix.os }}
1515
strategy:
1616
fail-fast: false
1717
matrix:
18+
os: [buildjet-8vcpu-ubuntu-2204, windows-latest]
1819
package-manager: ["npm", "pnpm", "yarn"]
1920
steps:
2021
- name: ⬇️ Checkout repo
@@ -46,71 +47,8 @@ jobs:
4647
run: corepack enable
4748

4849
- name: Run E2E Tests
50+
shell: bash
4951
run: |
50-
PM=${{ matrix.package-manager }} pnpm --filter trigger.dev run test:e2e
51-
webapp:
52-
name: "🧪 Webapp tests"
53-
if: inputs.package == 'webapp' || inputs.package == ''
54-
runs-on: buildjet-16vcpu-ubuntu-2204
55-
steps:
56-
- name: 🐳 Login to Docker Hub
57-
uses: docker/login-action@v2
58-
with:
59-
username: ${{ secrets.DOCKERHUB_USERNAME || vars.DOCKERHUB_USERNAME }}
60-
password: ${{ secrets.DOCKERHUB_TOKEN || vars.DOCKERHUB_TOKEN }}
61-
62-
- name: ⬇️ Checkout repo
63-
uses: actions/checkout@v3
64-
with:
65-
fetch-depth: 0
66-
submodules: recursive
52+
LOG=debug PM=${{ matrix.package-manager }} pnpm --filter trigger.dev run test:e2e
6753
68-
- name: ⎔ Setup pnpm
69-
uses: pnpm/action-setup@v4
70-
with:
71-
version: 8.15.5
7254
73-
- name: ⎔ Setup node
74-
uses: buildjet/setup-node@v3
75-
with:
76-
node-version: 20.11.1
77-
cache: "pnpm"
78-
79-
- name: 📥 Download deps
80-
run: pnpm install --frozen-lockfile
81-
82-
- name: Install Playwright Browsers
83-
run: npx playwright install --with-deps
84-
85-
- name: Run Playwright tests
86-
run: |
87-
# Setup environment variables
88-
cp ./.env.example ./.env
89-
cp ./references/nextjs-test/.env.example ./references/nextjs-test/.env.local
90-
91-
# Build packages
92-
pnpm run build --filter @references/nextjs-test^...
93-
cd apps/webapp && pnpm run build:server
94-
cd ../..
95-
pnpm --filter @trigger.dev/database generate
96-
pnpm --filter @trigger.dev/otlp-importer generate
97-
98-
# Move trigger-cli bin to correct place
99-
pnpm install --frozen-lockfile
100-
101-
# Execute tests
102-
pnpm run docker
103-
pnpm run db:migrate
104-
pnpm run db:seed
105-
pnpm run test:e2e
106-
107-
# Cleanup
108-
pnpm run docker:stop
109-
110-
- name: Upload Playwright report
111-
uses: actions/upload-artifact@v3
112-
if: always()
113-
with:
114-
name: playwright-report
115-
path: playwright-report/
116-
retention-days: 30

.github/workflows/pr_checks.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ jobs:
2121
uses: ./.github/workflows/unit-tests.yml
2222
secrets: inherit
2323

24+
e2e:
25+
uses: ./.github/workflows/e2e.yml
26+
with:
27+
package: cli-v3
28+
secrets: inherit
29+
2430
preview-release:
2531
name: Preview Release
26-
needs: [typecheck, units]
32+
needs: [typecheck, units, e2e]
2733
if: |
2834
github.repository == 'triggerdotdev/trigger.dev'
2935
runs-on: buildjet-8vcpu-ubuntu-2204
@@ -52,9 +58,3 @@ jobs:
5258

5359
- name: ⚡ publish preview release
5460
run: npx pkg-pr-new publish --no-template $(ls -d ./packages/*)
55-
56-
# e2e:
57-
# uses: ./.github/workflows/e2e.yml
58-
# with:
59-
# package: webapp
60-
# secrets: inherit

.github/workflows/typecheck.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ jobs:
2929
run: pnpm run generate
3030

3131
- name: 🔎 Type check
32-
run: pnpm run typecheck --filter webapp
32+
run: pnpm run typecheck
33+
34+
- name: 🔎 Check exports
35+
run: pnpm run check-exports

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ apps/**/public/build
5353
/playwright/.cache/
5454

5555
.cosine
56-
.trigger/
57-
.tshy*
56+
.trigger
57+
.tshy*
58+
.yarn
59+
*.tsbuildinfo

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
"cwd": "${workspaceFolder}/references/job-catalog",
3030
"sourceMaps": true
3131
},
32+
{
33+
"type": "node-terminal",
34+
"request": "launch",
35+
"name": "Debug V3 init CLI",
36+
"command": "pnpm exec triggerdev init",
37+
"cwd": "${workspaceFolder}/references/init-shell",
38+
"sourceMaps": true
39+
},
3240
{
3341
"type": "node-terminal",
3442
"request": "launch",
@@ -76,6 +84,14 @@
7684
"port": 9229,
7785
"restart": true,
7886
"skipFiles": ["<node_internals>/**"]
87+
},
88+
{
89+
"type": "node-terminal",
90+
"request": "launch",
91+
"name": "Debug CLI e2e tests",
92+
"command": "PM=yarn pnpm run test:e2e",
93+
"cwd": "${workspaceFolder}/packages/cli-v3",
94+
"sourceMaps": true
7995
}
8096
]
8197
}

docs/guides/new-build-system-preview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ import { defineConfig } from "@trigger.dev/sdk/v3";
7171
export default defineConfig({
7272
project: "<project ref>",
7373
build: {
74-
externals: ["native-module"],
74+
external: ["native-module"],
7575
},
7676
});
7777
```
7878

79-
`externals` is an array of strings, where each string is the name of a dependency that should be made external. Glob expressions are also supported and use the [minimatch](https://github.com/isaacs/minimatch) matcher.
79+
`external` is an array of strings, where each string is the name of a dependency that should be made external. Glob expressions are also supported and use the [minimatch](https://github.com/isaacs/minimatch) matcher.
8080

8181
### `additionalFiles`
8282

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"test": "turbo run test",
2929
"test:dev": "turbo run test:dev",
3030
"start": "turbo run start",
31+
"check-exports": "turbo run check-exports",
3132
"clean": "turbo run clean",
3233
"clean:node_modules": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
3334
"typecheck": "turbo run typecheck",

packages/build/package.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,32 @@
3333
"@triggerdotdev/source"
3434
]
3535
},
36+
"typesVersions": {
37+
"*": {
38+
"extensions": [
39+
"dist/commonjs/extensions/index.d.ts"
40+
],
41+
"extensions/core": [
42+
"dist/commonjs/extensions/core.d.ts"
43+
],
44+
"extensions/prisma": [
45+
"dist/commonjs/extensions/prisma.d.ts"
46+
],
47+
"extensions/audioWaveform": [
48+
"dist/commonjs/extensions/audioWaveform.d.ts"
49+
],
50+
"extensions/typescript": [
51+
"dist/commonjs/extensions/typescript.d.ts"
52+
]
53+
}
54+
},
3655
"scripts": {
3756
"clean": "rimraf dist",
3857
"build": "tshy && pnpm run update-version",
3958
"dev": "tshy --watch",
4059
"typecheck": "tsc --noEmit -p tsconfig.src.json",
41-
"update-version": "tsx ../../scripts/updateVersion.ts"
60+
"update-version": "tsx ../../scripts/updateVersion.ts",
61+
"check-exports": "attw --pack ."
4262
},
4363
"dependencies": {
4464
"@trigger.dev/core": "workspace:3.0.0-beta.56",
@@ -51,7 +71,8 @@
5171
"tshy": "^3.0.2",
5272
"typescript": "^5.5.4",
5373
"tsx": "4.17.0",
54-
"esbuild": "^0.23.0"
74+
"esbuild": "^0.23.0",
75+
"@arethetypeswrong/cli": "^0.15.4"
5576
},
5677
"engines": {
5778
"node": ">=18.20.0"

packages/build/tsconfig.src.tsbuildinfo

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)