-
-
Notifications
You must be signed in to change notification settings - Fork 953
fix(build): add destination option to additionalFiles extension #2855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ericallam
wants to merge
8
commits into
main
Choose a base branch
from
claude/slack-fix-additionalfiles-path-resolution-kDZvR
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a6e718a
fix(build): add destination option to additionalFiles extension
claude 55aba75
fix(build): handle specific file paths in getGlobBase for destination…
github-actions[bot] 345722e
fix(build): address review comments and add unit tests for additional…
github-actions[bot] 4574cfc
Merge branch 'main' into claude/slack-fix-additionalfiles-path-resolu…
ericallam 520ebcd
chore: update pnpm-lock.yaml after adding vitest dependency
github-actions[bot] ff856f7
chore: update vitest to 3.1.4 in packages/build for consistent test r…
github-actions[bot] 26f9dc3
Merge branch 'main' into claude/slack-fix-additionalfiles-path-resolu…
ericallam 674f5c7
chore: add patch changeset for additionalFiles destination option
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@trigger.dev/build": patch | ||
| --- | ||
|
|
||
| fix(build): add destination option to additionalFiles extension | ||
|
|
||
| When using glob patterns with parent directory references (../), the default behavior strips ".." segments resulting in unexpected paths. This adds an optional "destination" parameter that allows users to explicitly specify where matched files should be placed, which is useful in monorepo setups where files need to maintain their structure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { getGlobBase } from "../src/internal/additionalFiles.js"; | ||
|
|
||
| describe("getGlobBase", () => { | ||
| describe("glob patterns with wildcards", () => { | ||
| it("extracts base from parent directory glob pattern", () => { | ||
| expect(getGlobBase("../shared/**")).toBe("../shared"); | ||
| }); | ||
|
|
||
| it("extracts base from relative directory glob pattern", () => { | ||
| expect(getGlobBase("./assets/*.txt")).toBe("./assets"); | ||
| }); | ||
|
|
||
| it("extracts base from nested directory glob pattern", () => { | ||
| expect(getGlobBase("files/nested/**/*.js")).toBe("files/nested"); | ||
| }); | ||
|
|
||
| it("returns current directory for top-level glob", () => { | ||
| expect(getGlobBase("**/*.js")).toBe("."); | ||
| }); | ||
|
|
||
| it("returns current directory for star pattern", () => { | ||
| expect(getGlobBase("*.js")).toBe("."); | ||
| }); | ||
|
|
||
| it("handles question mark wildcard", () => { | ||
| expect(getGlobBase("./src/?/*.ts")).toBe("./src"); | ||
| }); | ||
|
|
||
| it("handles bracket patterns", () => { | ||
| expect(getGlobBase("./src/[abc]/*.ts")).toBe("./src"); | ||
| }); | ||
|
|
||
| it("handles brace expansion patterns", () => { | ||
| expect(getGlobBase("./src/{a,b}/*.ts")).toBe("./src"); | ||
| }); | ||
|
|
||
| it("handles deeply nested patterns", () => { | ||
| expect(getGlobBase("a/b/c/d/**")).toBe("a/b/c/d"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("specific file paths without globs", () => { | ||
| it("returns parent directory for file in subdirectory", () => { | ||
| expect(getGlobBase("./config/settings.json")).toBe("./config"); | ||
| }); | ||
|
|
||
| it("returns parent directory for file in nested subdirectory", () => { | ||
| expect(getGlobBase("../shared/utils/helpers.ts")).toBe("../shared/utils"); | ||
| }); | ||
|
|
||
| it("returns current directory for single-part filename", () => { | ||
| expect(getGlobBase("file.txt")).toBe("."); | ||
| }); | ||
|
|
||
| it("returns current directory for filename starting with dot", () => { | ||
| expect(getGlobBase(".env")).toBe("."); | ||
| }); | ||
|
|
||
| it("returns parent directory for explicit relative path to file", () => { | ||
| expect(getGlobBase("./file.txt")).toBe("."); | ||
| }); | ||
|
|
||
| it("returns parent directories for parent reference to file", () => { | ||
| expect(getGlobBase("../file.txt")).toBe(".."); | ||
| }); | ||
|
|
||
| it("handles multiple parent references", () => { | ||
| expect(getGlobBase("../../config/app.json")).toBe("../../config"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("edge cases", () => { | ||
| it("returns current directory for empty string", () => { | ||
| expect(getGlobBase("")).toBe("."); | ||
| }); | ||
|
|
||
| it("handles Windows-style backslashes", () => { | ||
| expect(getGlobBase("..\\shared\\**")).toBe("../shared"); | ||
| }); | ||
|
|
||
| it("handles mixed forward and back slashes", () => { | ||
| expect(getGlobBase("../shared\\nested/**")).toBe("../shared/nested"); | ||
| }); | ||
|
|
||
| it("handles patterns with only dots", () => { | ||
| expect(getGlobBase("./")).toBe("."); | ||
| }); | ||
|
|
||
| it("handles parent directory reference only", () => { | ||
| expect(getGlobBase("../")).toBe(".."); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { defineConfig } from "vitest/config"; | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| include: ["test/**/*.test.ts", "src/**/*.test.ts"], | ||
| globals: true, | ||
| }, | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.