Repository navigation
fix(build): preserve directory desktop artifacts and framework symlinks #24434
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
Changes from 1 commit
b5c5eb3
41bbd4b
9c025c3
c64afd7
81bc681
6948899
077b78d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4107,19 +4107,11 @@ const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(f | |||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const stageEntries = yield* fs.readDirectory(stageDistDir); | ||||||||||||||||||||||||||||||||||||||||||
| yield* fs.makeDirectory(options.outputDir, { recursive: true }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const copiedArtifacts: string[] = []; | ||||||||||||||||||||||||||||||||||||||||||
| for (const entry of stageEntries) { | ||||||||||||||||||||||||||||||||||||||||||
| const from = path.join(stageDistDir, entry); | ||||||||||||||||||||||||||||||||||||||||||
| const stat = yield* fs.stat(from).pipe(Effect.orElseSucceed(() => null)); | ||||||||||||||||||||||||||||||||||||||||||
| if (!stat || stat.type !== "File") continue; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const to = path.join(options.outputDir, entry); | ||||||||||||||||||||||||||||||||||||||||||
| yield* fs.copyFile(from, to); | ||||||||||||||||||||||||||||||||||||||||||
| copiedArtifacts.push(to); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| const copiedArtifacts = yield* copyDesktopBuildArtifacts( | ||||||||||||||||||||||||||||||||||||||||||
| stageDistDir, | ||||||||||||||||||||||||||||||||||||||||||
| options.outputDir, | ||||||||||||||||||||||||||||||||||||||||||
| options.target === "dir", | ||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (copiedArtifacts.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||
| return yield* new DesktopBuildNoArtifactsProducedError({ | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -4141,6 +4133,37 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( | |||||||||||||||||||||||||||||||||||||||||
| return yield* withDesktopBuildLock(repoRoot, buildDesktopArtifactUnlocked(options)); | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| export const copyDesktopBuildArtifacts = Effect.fn("copyDesktopBuildArtifacts")(function* ( | ||||||||||||||||||||||||||||||||||||||||||
| stageDistDir: string, | ||||||||||||||||||||||||||||||||||||||||||
| outputDir: string, | ||||||||||||||||||||||||||||||||||||||||||
| includeDirectories = false, | ||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||
| const fs = yield* FileSystem.FileSystem; | ||||||||||||||||||||||||||||||||||||||||||
| const path = yield* Path.Path; | ||||||||||||||||||||||||||||||||||||||||||
| const stageEntries = yield* fs.readDirectory(stageDistDir); | ||||||||||||||||||||||||||||||||||||||||||
| yield* fs.makeDirectory(outputDir, { recursive: true }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const copiedArtifacts: string[] = []; | ||||||||||||||||||||||||||||||||||||||||||
| for (const entry of stageEntries) { | ||||||||||||||||||||||||||||||||||||||||||
| const from = path.join(stageDistDir, entry); | ||||||||||||||||||||||||||||||||||||||||||
| const stat = yield* fs.stat(from).pipe(Effect.orElseSucceed(() => null)); | ||||||||||||||||||||||||||||||||||||||||||
| if (!stat || (stat.type !== "File" && !(includeDirectories && stat.type === "Directory"))) | ||||||||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const to = path.join(outputDir, entry); | ||||||||||||||||||||||||||||||||||||||||||
| yield* Effect.tryPromise(() => | ||||||||||||||||||||||||||||||||||||||||||
| NodeFSP.cp(from, to, { | ||||||||||||||||||||||||||||||||||||||||||
| recursive: true, | ||||||||||||||||||||||||||||||||||||||||||
| force: true, | ||||||||||||||||||||||||||||||||||||||||||
| verbatimSymlinks: true, | ||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||
|
zaydiscold marked this conversation as resolved.
Resolved
Comment on lines
+4103
to
+4114
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Supported by static analysis
Remove every included destination before copying.
Suggested fix
Committable suggestion
|
||||||||||||||||||||||||||||||||||||||||||
| copiedArtifacts.push(to); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| return copiedArtifacts; | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const buildDesktopArtifactCli = Command.make("build-desktop-artifact", { | ||||||||||||||||||||||||||||||||||||||||||
| platform: Flag.Literals("platform", BuildPlatform.literals).pipe( | ||||||||||||||||||||||||||||||||||||||||||
| Flag.withDescription("Build platform (env: T3CODE_DESKTOP_PLATFORM)."), | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.