fix(config): treat positional file root as deploy target, not config file#114
Open
tcerqueira wants to merge 1 commit into
Open
fix(config): treat positional file root as deploy target, not config file#114tcerqueira wants to merge 1 commit into
tcerqueira wants to merge 1 commit into
Conversation
…file `deno deploy --org o --app a --prod main.ts` failed with "Failed deserializing config file '.../main.ts'" because the positional `[root-path]` was fed into config discovery as a config file whenever it pointed at a file. Only an explicit `--config <file>` should force ConfigFile discovery. `resolve_config` now takes a `from_config` flag: a positional file root discovers config from its parent directory (Paths) and includes the file in the upload manifest, while `--config <non-standard-name.json>` keeps ConfigFile discovery. The command actions also normalize a positional file argument to its containing directory (`deployRootDir`) so the publish manifest and framework detection operate on the project rather than the single file. Fixes #107
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.
What
deno deploy --org o --app a --prod main.tsfailed withFailed deserializing config file '.../main.ts'.: Unexpected word on line 1 column 1because the positional[root-path]was passed into config discovery as a config file whenever it pointed at a file.Why
resolve_config(rs_lib) treated any file path asWorkspaceDiscoverStart::ConfigFile. That is correct for--config deno-staging.jsonbut wrong for a positional entrypoint/root likemain.ts, which should be a deploy target.Approach
from_configflag. A positional file root now discovers config from its parent directory (Paths) and includes the file in the collected manifest; only--config <file>keepsConfigFilediscovery, so non-standard config filenames still work unchanged.fromConfig = Boolean(maybeConfigPath).deploy/mod.ts,deploy/create/mod.ts): normalize a positional file argument to its containing directory via a newdeployRootDirhelper, so the publish manifest (relative(rootPath, …)) and framework detection operate on the project directory rather than the single file — otherwise the now-reachable upload path would produce corrupted manifest keys.Rejected alternative
Normalizing the positional file to its directory purely in TS before calling
resolve_configwould also suppress the error without a Rust change, but it leavesresolve_config's "any file = config file" contract implicit/fragile. Making the distinction explicit in Rust keeps that function correct for any caller.Tests
rs_lib/src/lib.rs:positional_file_root_discovers_parent_config(positionalmain.ts→ parentdeno.json, file collected, no deserialize error) andexplicit_config_flag_uses_named_config_file(--config deno-staging.jsonstill uses ConfigFile discovery).entry.tsno longer errors during config resolution (proceeds to auth), and--config <non-standard>.jsondebug output showsis_config_file=true.Fixes #107