@valbuild/cli 0.132.1 → 0.134.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,118 @@
1
1
  # @valbuild/cli
2
2
 
3
+ ## 0.134.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#698](https://github.com/valbuild/val/pull/698) [`15c5367`](https://github.com/valbuild/val/commit/15c536746c0f813a51a2dce8a2cb1e617174c238) Thanks [@freekh](https://github.com/freekh)! - Add `val publish`, which publishes a project's build through content.val.build.
8
+
9
+ ```sh
10
+ npx val publish # publish the artifacts in .val/publish
11
+ npx val publish --artifacts build/out # publish a directory by name
12
+ npx val publish --dry-run # verify, and stop before the site changes
13
+ ```
14
+
15
+ It declares what the build is made of — every artifact by key, sha256 and size
16
+ — uploads only the ones content does not already hold, straight to object
17
+ storage, and then has content build and render the build as a canary before
18
+ anything goes live. A build content already holds uploads nothing. A canary
19
+ that does not render is never promoted, and the command exits non-zero with
20
+ content's own problem codes, hints included, so CI gates on it. Declaring the
21
+ same build twice resumes that publish rather than starting a second one, so a
22
+ re-run of a CI job picks up where it left off.
23
+
24
+ The artifacts are read from a directory whose layout is the key namespace:
25
+ the path of each file under it is its artifact key — `server`, `client`,
26
+ `css`, `rsc`, `layer`, or a path under `chunk/server`, `chunk/client`,
27
+ `chunk/rsc`, `asset`, `public`. Nothing is renamed on the way, since an asset
28
+ is addressed by the path the built code imports it at.
29
+
30
+ Authenticates with `VAL_PROJECT_TOKEN` — the single secret a repository needs,
31
+ since the token names its project — or with the `val login` token in
32
+ `.val/pat.json`, which is exchanged for a ten minute publish token and needs
33
+ the project (`"<org>/<project>"`) in `val.config` or `VAL_PROJECT`. Never a
34
+ command line flag: an argument is visible to anyone who can list processes,
35
+ and it is kept in shell history and in the log of every CI job that echoes its
36
+ command line.
37
+
38
+ The commit and branch the build is of are taken from `--commit` / `--branch`,
39
+ then `VAL_GIT_COMMIT` / `VAL_GIT_BRANCH`, then `GITHUB_SHA` / `GITHUB_REF_NAME`,
40
+ then git. The commit is baked into the published site and decides which version
41
+ of its own content it reads, so the command refuses rather than guessing when
42
+ it cannot tell.
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [[`be78a9b`](https://github.com/valbuild/val/commit/be78a9b51678439f7ecb1c7f3887f9e8e1261a13), [`16c49ea`](https://github.com/valbuild/val/commit/16c49ea6dd97c7a96bbfdf211af9bab5884579e2), [`eaa265e`](https://github.com/valbuild/val/commit/eaa265e78d9f6d2a1b685c38901612b8a3704eed)]:
47
+ - @valbuild/server@0.134.0
48
+ - @valbuild/core@0.134.0
49
+ - @valbuild/shared@0.134.0
50
+ - @valbuild/language-server@0.134.0
51
+
52
+ ## 0.133.0
53
+
54
+ ### Minor Changes
55
+
56
+ - [#700](https://github.com/valbuild/val/pull/700) [`802412b`](https://github.com/valbuild/val/commit/802412b92c06bc1abbca78c86885e39c8710dd83) Thanks [@freekh](https://github.com/freekh)! - http mode no longer needs a git repository
57
+
58
+ A Val app can now run in http mode with no commit and no branch — its content
59
+ service is the store of record, and git is an optional mirror of the code. This
60
+ is what `fs` mode has always done: it has never had git, and it works.
61
+
62
+ Before this, `VAL_API_KEY` and `VAL_SECRET` were not enough. `VAL_GIT_COMMIT`
63
+ and `VAL_GIT_BRANCH` were required too, so a deployment with no commit to name
64
+ either threw at boot or fell through to `fs` mode and reached for a working
65
+ tree that was not there.
66
+
67
+ **Breaking, if you pass `http` options in code.** `gitCommit` and `gitBranch`
68
+ are replaced by one optional `git`:
69
+
70
+ ```diff
71
+ initValServer(valModules, config, {
72
+ http: {
73
+ apiKey,
74
+ valSecret,
75
+ - gitCommit: process.env.VAL_GIT_COMMIT,
76
+ - gitBranch: "main",
77
+ + // Only for a project whose content is mirrored into a repository.
78
+ + // Omit it entirely otherwise.
79
+ + git: { commit: process.env.VAL_GIT_COMMIT, branch: "main" },
80
+ },
81
+ })
82
+ ```
83
+
84
+ `VAL_GIT_COMMIT` and `VAL_GIT_BRANCH` still work and are still read; they are
85
+ simply no longer required. Set both or neither — a commit without a branch, or
86
+ a branch without a commit, is refused at startup with a message naming the
87
+ missing half, rather than failing later at a publish.
88
+
89
+ **What a commit is for, where you have one.** Turning pending patches into new
90
+ `.val.ts` text means reading the current text first, and that read goes to the
91
+ content service at that commit. It is the publish path, not the serving path: a
92
+ committed render reads the source compiled into the build and asks the content
93
+ service nothing. With no repository there is nothing to write `.val.ts` into,
94
+ so a publish records the module's data and its schema and skips the file — and
95
+ that data is what history reads, so nothing is lost.
96
+
97
+ **A publish can now be refused by name, before it is attempted.** If a project
98
+ mirrors its commits into a repository but the running deployment was built
99
+ before that repository existed, it has no commit to write the mirror against.
100
+ Publishing anyway would save the content and silently leave the repository
101
+ behind. The Studio now disables Publish and shows why, and `/save` refuses with
102
+ a `no-base` code instead of failing partway.
103
+
104
+ **Also:** `ValCommit` and `HistoricalCommit` have nullable `parentCommitSha`
105
+ and `clientCommitSha`, and `/stat`'s `commitSha` is optional. A root commit has
106
+ no parent, and a publisher with no repository does not report where it was. If
107
+ you read these fields, handle `null`.
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [[`802412b`](https://github.com/valbuild/val/commit/802412b92c06bc1abbca78c86885e39c8710dd83)]:
112
+ - @valbuild/server@0.133.0
113
+ - @valbuild/shared@0.133.0
114
+ - @valbuild/language-server@0.133.0
115
+
3
116
  ## 0.132.1
4
117
 
5
118
  ### Patch Changes