Skip to content

feat: add subdirectory support for static build pack - #38

Merged
Alimedhat000 merged 5 commits into
mainfrom
31/subdirectory-support
May 18, 2026
Merged

feat: add subdirectory support for static build pack#38
Alimedhat000 merged 5 commits into
mainfrom
31/subdirectory-support

Conversation

@Alimedhat000

Copy link
Copy Markdown
Owner

closes #31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for deploying static apps whose source lives in a subdirectory of the repo (e.g. frontend/, packages/web/). A new optional subdirectory column on apps flows from the create-app modal through validators into the static build-pack worker steps so that install/build run inside the subdir and verify/copy resolve output paths relative to it.

Changes:

  • Adds apps.subdirectory column (Drizzle migration 0006_magenta_polaris), schema export, API service column projection, and createAppSchema/updateAppSchema validator entry (with slash trimming).
  • Threads subdirectory through the static build-pack orchestrator into runInstallStep, runBuildStep, runVerifyStep, and the copy-step path computation, including subdir-aware lockfile detection.
  • Adds a Subdirectory input to CreateAppModal (static section) and adds unit/integration tests for the verify and pipeline behavior with a subdirectory set.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
drizzle/0006_magenta_polaris.sql Migration adding the subdirectory column.
drizzle/meta/0006_snapshot.json Drizzle snapshot reflecting the new column.
drizzle/meta/_journal.json Journal entry for the new migration.
packages/shared/src/schema.ts Declares subdirectory varchar(255) on apps.
packages/shared/src/validators/app.ts Adds subdirectory to schema; trims slashes but no shell/traversal validation.
packages/api/src/services/apps.ts Exposes subdirectory in safeColumns projection.
packages/worker/src/deployments/strategies/static.ts Reads app.subdirectory and passes it to install/build/verify/copy.
packages/worker/src/deployments/steps/install-step.ts Lockfile detection and install command use subdir-prefixed paths.
packages/worker/src/deployments/steps/build-step.ts Build command cds into subdir.
packages/worker/src/deployments/steps/verify-step.ts Resolves target path relative to subdir.
packages/web/src/components/CreateAppModal.tsx Adds Subdirectory input under the static section and includes it in the payload.
packages/worker/test/unit/deployments/steps/verify-step.test.ts Adds verify-step subdirectory cases.
packages/worker/test/unit/deployments/pipeline.test.ts Adds an end-to-end pipeline test with a subdirectory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +30
subdirectory: z
.string()
.optional()
.transform((val) =>
val?.trim() ? val.replace(/^\/+|\/+$/g, "") : undefined,
),
if (buildPack === "nixpacks") {
if (runCommand) payload.runCommand = runCommand;
if (outputDir) payload.outputDir = outputDir;
if (subdirectory) payload.subdirectory = subdirectory;
Comment on lines +154 to +161
const outputDir = subdirectory
? path.join(
workspacePath,
"repo",
subdirectory,
app.outputDir ?? "dist",
)
: path.join(workspacePath, "repo", app.outputDir ?? "dist");
…rsal

- Reject shell meta characters (;|&$()<>) via noShellMeta
- Reject .. path components to prevent traversal
- Collapse copy-step ternary to single path.join (handles empty
  subdirectory correctly)
@Alimedhat000
Alimedhat000 merged commit cfaedb7 into main May 18, 2026
4 checks passed
@Alimedhat000
Alimedhat000 deleted the 31/subdirectory-support branch May 18, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

static build pack: support subdirectory apps — run install/build commands inside subdir

2 participants