-
Notifications
You must be signed in to change notification settings - Fork 0
Fix remote files upload issues #450
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
freekh
wants to merge
16
commits into
main
Choose a base branch
from
fix-remote-files-upload-issues
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
16 commits
Select commit
Hold shift + click to select a range
13c75e6
Possible to store files under public/ not only public/val
freekh e1d694f
Allow files in public dir, not only public/val dir.
freekh 869bc9d
Changeset
freekh 957aacc
Remove "files" directory option
freekh 1c50305
Replace quickjs based validation with node:vm running val.modules
freekh aa011c7
Fix so a top-level s.image() type checks as a ValModule
freekh 800e6c4
Add code frame (source file mapping) in validation errors for cooler …
freekh e298eed
Show code frame validation errors on key or value depending on the va…
freekh fe82d20
Show code frames for validation fixes as well
freekh 1416bee
Changeset
freekh d10bd50
In s.files and s.images the validation code frame error should be on …
freekh a481fe4
Add watch mode to validate
freekh 295cd1e
Reverse order of validation output (fixable at the end)
freekh 6fbfd2e
Make all error clickable in validation output
freekh e957647
Remove noisy test / example validation errors
freekh 21c430e
Fix broken remote files for s.images / s.files
freekh 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
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,5 @@ | ||
| --- | ||
| "@valbuild/core": patch | ||
| --- | ||
|
|
||
| Allow storing files anywhere under `/public`, not only `/public/val`. Config validation, remote refs, and the studio file/image fields now accept any `/public/...` directory (the default remains `/public/val`). Also removed the `files` property from `SharedValConfig` — the per-schema `s.files`/`s.images` directory is now the source of truth. |
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,10 @@ | ||
| --- | ||
| "@valbuild/core": patch | ||
| "@valbuild/server": patch | ||
| "@valbuild/shared": patch | ||
| "@valbuild/cli": patch | ||
| --- | ||
|
|
||
| Remote galleries (`s.images({ remote: true })` / `s.files({ remote: true })`) now report a fixable validation error when an entry is still a local path, mirroring the single-field `s.image().remote()` / `s.file().remote()` behaviour. Running the CLI with `validate --fix` uploads the file to remote storage and rewrites the record key from the local path to the remote URL, keeping the file on disk. The gallery "untracked files" check now recognizes a remote-URL key as covering its on-disk file, so kept files are not flagged. | ||
|
|
||
| Adds two new validation fixes: `images:upload-remote` and `files:upload-remote`. |
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 @@ | ||
| --- | ||
| "@valbuild/server": patch | ||
| "@valbuild/cli": patch | ||
| --- | ||
|
|
||
| Validation errors from the CLI now point at the offending location in the `.val.ts` file. Each error shows a clickable `file:line:col` and a code frame (the line above, the offending line, and the line below) with carets underlining the exact source. The carets target the **value** by default and the **key** when the error is about an object/record key (`keyError`), and the output is labelled `(key)` / `(value)` accordingly. Gallery metadata errors now point at the specific record entry instead of the whole module. | ||
|
|
||
| The module-path → source-range utility used for this (`createModulePathMap`, `getModulePathRange`, `ModulePathMap`) is now exported from `@valbuild/server`. | ||
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
20 changes: 20 additions & 0 deletions
20
packages/cli/src/__fixtures__/basic/content/basic-gallery-remote-existing.val.ts
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,20 @@ | ||
| import { c, s } from "../val.config"; | ||
|
|
||
| export default c.define( | ||
| "/content/basic-gallery-remote-existing.val.ts", | ||
| s.images({ | ||
| directory: "/public/val/images-remote2", | ||
| accept: "image/*", | ||
| remote: true, | ||
| }), | ||
|
|
||
| { | ||
| "https://remote.val.build/file/p/proj123/b/01/v/1.0.0/h/abc1/f/def4/p/public/val/images-remote2/image.png": | ||
| { | ||
| width: 1, | ||
| height: 1, | ||
| mimeType: "image/png", | ||
| alt: null, | ||
| }, | ||
| }, | ||
| ); |
19 changes: 19 additions & 0 deletions
19
packages/cli/src/__fixtures__/basic/content/basic-gallery-remote.val.ts
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,19 @@ | ||
| import { c, s } from "../val.config"; | ||
|
|
||
| export default c.define( | ||
| "/content/basic-gallery-remote.val.ts", | ||
| s.images({ | ||
| directory: "/public/val/images-remote", | ||
| accept: "image/*", | ||
| remote: true, | ||
| }), | ||
|
|
||
| { | ||
| "/public/val/images-remote/image.png": { | ||
| width: 1, | ||
| height: 1, | ||
| mimeType: "image/png", | ||
| alt: null, | ||
| }, | ||
| }, | ||
| ); |
Binary file added
BIN
+67 Bytes
packages/cli/src/__fixtures__/basic/public/val/images-remote/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+67 Bytes
packages/cli/src/__fixtures__/basic/public/val/images-remote2/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { initVal } from "@valbuild/core"; | ||
|
|
||
| const { s, c } = initVal(); | ||
| const { s, c, config } = initVal(); | ||
|
|
||
| export { s, c }; | ||
| export { s, c, config }; |
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,18 @@ | ||
| import { modules } from "@valbuild/core"; | ||
| import { config } from "./val.config"; | ||
|
|
||
| export default modules(config, [ | ||
| { def: () => import("./content/basic-valid.val") }, | ||
| { def: () => import("./content/basic-errors.val") }, | ||
| { def: () => import("./content/basic-files.val") }, | ||
| { def: () => import("./content/basic-image.val") }, | ||
| { def: () => import("./content/basic-image-from-gallery.val") }, | ||
| { def: () => import("./content/basic-image-from-galleries.val") }, | ||
| { def: () => import("./content/basic-gallery.val") }, | ||
| { def: () => import("./content/basic-gallery-2.val") }, | ||
| { def: () => import("./content/basic-gallery-fail-on-non-unique-dir.val") }, | ||
| { def: () => import("./content/basic-gallery-missing-tracked.val") }, | ||
| { def: () => import("./content/basic-gallery-wrong-metadata.val") }, | ||
| { def: () => import("./content/basic-gallery-remote.val") }, | ||
| { def: () => import("./content/basic-gallery-remote-existing.val") }, | ||
| ]); |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix changeset