feat: make build output paths cwd-relative#132
Merged
Conversation
Removes the `__file__`-derived `ROOT` constant from the build command so the rendered `index.html` and the data directory are no longer pinned to the location of the installed package. Defaults are now relative to the current working directory: - `--directory` defaults to `public/data` (was `ROOT / "public" / "data"`) - new `--html-output` flag, defaults to `index.html` (was `ROOT / "index.html"`) Upstream behavior is unchanged when run from the repo root. Downstream consumers can now install the CLI as a package and run `build` from anywhere — useful for site forks that overlay their own config and let upstream render `index.html` into their working tree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
✨ Preview deployed to S3! Visit http://ds-preview-contributor-network-132.s3-website-us-west-2.amazonaws.com/ |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The cwd-relative default already lets downstream consumers control the output location by chdir'ing before calling build. The extra flag added API surface for a case nobody had. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
@gadomski ready for your review. another follow up to #131 and #127 found when trying to implement this in nasa-odsi-contributor-network |
gadomski
approved these changes
May 7, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Removes the
__file__-derivedROOTconstant from thebuildcommand so output paths are no longer pinned to where the package is installed.--directorynow defaults topublic/data(cwd-relative)--html-outputflag, defaults toindex.html(cwd-relative)Upstream behavior is unchanged when run from the repo root.
Why
When upstream is installed as a Python package by a downstream fork (e.g. `nasa-odsi-contributor-network`), `file` resolves inside the consumer's `.venv/`, so `ROOT / "index.html"` lands in a useless venv-internal path. With cwd-relative defaults, downstream forks can install the CLI and run `contributor-network build` from any directory — the rendered `index.html` lands where the consumer's `cwd` is, alongside their overlaid `config.toml` and `public/`.
This unblocks the nasa-odsi-contributor-network upstream-reuse cutover, which uses `degit` to copy upstream's frontend into a cache directory and runs `build` from there.
Test plan