Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ js/developer/tools/* text eol=lf

# The wf project of the repository: its scripts, manifest and lock are hashed inputs of the self-build.
js/developer/scripts/* text eol=lf
webfront.project.json text eol=lf
webfront-packages.lock.json text eol=lf
js/developer/webfront.project.json text eol=lf
js/developer/webfront-packages.lock.json text eol=lf
2 changes: 1 addition & 1 deletion .github/actions/wf-driver/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runs:
#!/usr/bin/env bash
# Messages.hpp prints its encoding trace to the standard output: it is not part of a command's result.
export WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1
xvfb-run -a "$GITHUB_WORKSPACE/build-driver/test/web/webfront-wf" --project "$GITHUB_WORKSPACE" "\$@" 2>&1 \\
xvfb-run -a "$GITHUB_WORKSPACE/build-driver/test/web/webfront-wf" --project "$GITHUB_WORKSPACE" --manifest-dir js/developer "\$@" 2>&1 \\
| grep --line-buffered -v -e '^-> encoded to string of size' -e '^bufferIndex = '
exit "\${PIPESTATUS[0]}"
SCRIPT
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/DeveloperDistribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'test/developer/**'
- 'webfront.project.json'
- 'webfront-packages.lock.json'
- 'js/developer/webfront.project.json'
- 'js/developer/webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
- 'include/webfront/system/DeveloperReleaseData.hpp'
- '.github/actions/wf-driver/**'
Expand All @@ -26,8 +26,8 @@ on:
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'test/developer/**'
- 'webfront.project.json'
- 'webfront-packages.lock.json'
- 'js/developer/webfront.project.json'
- 'js/developer/webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
- 'include/webfront/system/DeveloperReleaseData.hpp'
- '.github/actions/wf-driver/**'
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
run: |
set -euo pipefail
gh auth setup-git
# In the workspace, since the wf script writes inside the project (permissions.publish of webfront.project.json).
# In the workspace, since the wf script writes inside the project (permissions.publish of js/developer/webfront.project.json).
site=build-site
git init --initial-branch=gh-pages "$site"
git -C "$site" remote add origin "https://github.com/$GITHUB_REPOSITORY.git"
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati
- `include/webfront/system/`: layered virtual filesystems and the embedded web resources, a closed list guarded by the `MinimalCoreAssets` CTest case (normative list and 150 KiB decoded budget in ADR-016; changing it means amending the ADR and `test/cmake/CheckMinimalCoreAssets.cmake` together).
- `include/webfront/frontend/`: system-browser, CEF, optional Windows WebView2 and macOS WKWebView frontend adapters.
- `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages).
- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and vendoring tools. The repository is itself a `wf` project (`webfront.project.json` and its lock at the root): the environment builds itself, and its pure JavaScript specs (`test/developer/`) run with `wf test`. `docs/NODE_TOOLS_MIGRATION.md` records where each former Node.js tool went. Production C++ remains header-only in `include/webfront/`.
- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and vendoring tools. The repository is itself a `wf` project (`js/developer/webfront.project.json` and its lock, selected with `--manifest-dir js/developer`): the environment builds itself, and its pure JavaScript specs (`test/developer/`) run with `wf test`. `docs/NODE_TOOLS_MIGRATION.md` records where each former Node.js tool went. Production C++ remains header-only in `include/webfront/`.
- `test/fixtures/`, `test/web/fixtures/`: retained regression fixtures, not public example applications.
- `test/unit/`: Catch2 unit tests; `test/web/`: real-browser integration (`suite/` is the WebFront project of the Jasmine specs, run by `webtest` through `wf test`); `test/driver/`: `webfront-wf`, the non-interactive `wf` driver for tests; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root.
- `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`.
Expand Down Expand Up @@ -67,7 +67,7 @@ Build the developer environment with wf (the driver comes from any build with `E
`js/developer/tools/PUBLISHING.md` describes:

```bash
wf() { build/test/web/webfront-wf --project "$PWD" -- "$@"; }
wf() { build/test/web/webfront-wf --project "$PWD" --manifest-dir js/developer -- "$@"; }
wf restore && wf run build build-distribution
```

Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- The manifest and the lock of the repository move to `js/developer/` (#354): the driver and the CI select them with `--manifest-dir js/developer`, and the closed list of the root loses two entries (9 left).

- The test bootstrap environment is the published 0.6.2 (#354), which installs the archives of `@types` packages and honours a manifest directory; the README walkthrough no longer needs a local archive for `wf check`.

- The manifest and the lock of a project may live in a directory of the project (#354): `DeveloperBootstrapOptions::manifestDirectory` (validated, passed in the bootstrap configuration only when set) and `webfront-wf --manifest-dir`; the environment derives `manifestPath` and `lockPath` from it, and a script still never writes them. Paths inside the manifest stay relative to the project root. Environment 0.6.2, not yet published; an earlier environment ignores the option.
Expand Down
4 changes: 2 additions & 2 deletions docs/DEVELOPER_ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ blocks the public network after the configure step.

## Environment distribution and offline tests (maintainers)

The environment builds itself (#315). The repository is a `wf` project: `webfront.project.json` declares the build
The environment builds itself (#315). The repository is a `wf` project, with its manifest and lock in `js/developer/` (the driver is given `--manifest-dir js/developer` and the project is the repository): `js/developer/webfront.project.json` declares the build
dependencies (esbuild-wasm, semver, xterm and its fit addon, and the React versions the starters pin), the scripts
and the permissions (`files` it reads, `publish` where it writes), and `webfront-packages.lock.json` locks them by
and the permissions (`files` it reads, `publish` where it writes), and `js/developer/webfront-packages.lock.json` locks them by
SHA-512. The scripts of `js/developer/scripts/` run in the pinned bootstrap environment with the driver `webfront-wf`
(see [the test driver](#the-test-driver-webfront-wf-and-the-bootstrap-environment)). They prepare
a tarball that application developers can download. No command publishes anything to a registry automatically.
Expand Down
4 changes: 2 additions & 2 deletions docs/PROJECT_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ case needs no prepared fixtures: configure downloads the registry's packages (#3

## Self-hosted developer environment (#315, epic #303)

The repository is a `wf` project (`webfront.project.json`, `webfront-packages.lock.json` at the root, the only files added
to the closed root list). The pinned 0.6.2 bootstrap environment runs `js/developer/scripts/build.mjs` with `webfront-wf`:
The repository is a `wf` project (`js/developer/webfront.project.json` and `js/developer/webfront-packages.lock.json`, selected by the driver's
`--manifest-dir js/developer`, so that the root stays short). The pinned 0.6.2 bootstrap environment runs `js/developer/scripts/build.mjs` with `webfront-wf`:
the locked esbuild-wasm bundles the environment in the script's Worker, and `environment.tgz`, the starters,
`provision.json`, the pinned header and (with `--refresh-bootstrap`) the bootstrap bundles and their checksums come out
the same twice in a row, and byte for byte as the 0.6.2 that is published (`sha512-SYnS6iRd...`). `site.mjs` stages the Pages
Expand Down
6 changes: 3 additions & 3 deletions docs/adr/ADR-016-bootstrap-comme-socle.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ reconstruction (#315). Toute autre exception exige une révision de cette ADR.

### Auto-hébergement de l'environnement (#315)

Le dépôt est lui-même un projet `wf` : `webfront.project.json` (dépendances de construction exactes, scripts, permissions) et
`webfront-packages.lock.json` (intégrités SHA-512) sont à la racine, qui reste une liste fermée où ces deux fichiers
s'ajoutent. Les scripts `js/developer/scripts/` (`build.mjs`, `site.mjs`, `pin.mjs`) s'exécutent dans l'environnement
Le dépôt est lui-même un projet `wf` : `js/developer/webfront.project.json` (dépendances de construction exactes, scripts, permissions) et
`js/developer/webfront-packages.lock.json` (intégrités SHA-512) sont dans `js/developer/`, désignés par `--manifest-dir`
(#354) ; la racine reste une liste fermée. Les scripts `js/developer/scripts/` (`build.mjs`, `site.mjs`, `pin.mjs`) s'exécutent dans l'environnement
d'amorçage épinglé (`cmake/WebFrontBootstrap.cmake`) par le pilote `webfront-wf`, avec l'esbuild-wasm verrouillé dans le
Worker du script : ils lisent les sources du projet et les paquets verrouillés, n'écrivent que sous `permissions.publish`
(répertoires `build-*` et sorties versionnées nommées) et n'ont ni shell ni API Node. Ils produisent `environment.tgz`,
Expand Down
4 changes: 2 additions & 2 deletions js/developer/environment/bundles.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"js/developer/tools/distribution.json": "a40253717a5a0f2107ad9b96ada3d0487ee35b27a382e19b3b8a2d20388573af",
"js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b",
"js/developer/tools/distribution.mjs": "1108b61bc659dd945ba1417aa84337bca03039842d342c95815b5463d87a136e",
"js/developer/scripts/build.mjs": "9d9f2342e86019d7f7452bdd494667fed740b26a34115311494e8a0d29853776",
"webfront.project.json": "24974ea48207b13fb5dac2e164fc433c6c348080f346605a1b132670438d802e",
"js/developer/scripts/build.mjs": "df91efbc9bb19559c36440f0be7ec2b2af406209146a0d8eb88d688803a74c68",
"js/developer/webfront.project.json": "691836184ab09fddf7248920473a0b89402dea1807747deb018c4597049455a8",
"js/core/bootstrap/bootstrap.bundle.mjs": "536831257f0fc92e31911841750e1e59247f7c64e756b0fcb878efd9860a741f",
"js/developer/environment/packages.bundle.mjs": "413e1dbf24d3993894d6bcbd9c01bd456e446170931f8daacfd06ce537cb2abc",
"include/webfront/system/DeveloperReleaseData.hpp": "567a88fed2839a23c2abad2dd9c2b74afe9934b1e1bdf44ec1099d9332b35c90"
Expand Down
5 changes: 3 additions & 2 deletions js/developer/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {packageRoot} from '../environment/paths.mjs';
import {tar} from '../tools/archive.mjs';
import {baseUrl, versionPath, bootstrapHeader, sriOf} from '../tools/distribution.mjs';

const lockPath = 'webfront-packages.lock.json';
const manifestPath = 'js/developer/webfront.project.json';
const lockPath = 'js/developer/webfront-packages.lock.json';
const encoder = new TextEncoder();
const hexOf = bytes => Array.from(new Uint8Array(bytes), byte => byte.toString(16).padStart(2, '0')).join('');

Expand Down Expand Up @@ -60,7 +61,7 @@ export default async function (context) {
const version = distribution.version;
const publicBase = baseUrl(distribution.baseUrl);
versionPath(version);
const dependencies = JSON.parse(await project.readText('webfront.project.json')).dependencies;
const dependencies = JSON.parse(await project.readText(manifestPath)).dependencies;
const licenses = [
['esbuild-wasm', lockedFile(lock, 'esbuild-wasm', 'LICENSE.md')],
['semver', lockedFile(lock, 'semver', 'LICENSE')],
Expand Down
6 changes: 3 additions & 3 deletions js/developer/tools/PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hosts only WebFront's development environment, its pinned Life starter and provi
The package names in their manifests are identifiers, not a requirement to own or publish npm scopes.

The environment builds itself: the pinned bootstrap environment (`cmake/WebFrontBootstrap.cmake`) runs the scripts of
`js/developer/scripts/` on the sources of this repository, which is a `wf` project (`webfront.project.json` and its
`js/developer/scripts/` on the sources of this repository, which is a `wf` project (`js/developer/webfront.project.json` and its
lock). Building, reviewing and publishing need a C++23 compiler, CMake, the engine of the driver's frontend and `gh`
and `jq` for the host operations.

Expand All @@ -19,7 +19,7 @@ works; WebKitGTK on Linux is the one CI uses.
cmake -S . -B build-driver -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON \
-DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK
cmake --build build-driver --target webfront-wf
wf() { xvfb-run -a build-driver/test/web/webfront-wf --project "$PWD" -- "$@"; }
wf() { xvfb-run -a build-driver/test/web/webfront-wf --project "$PWD" --manifest-dir js/developer -- "$@"; }

wf restore # the locked build dependencies, verified against their SHA-512
wf run build build-distribution # environment, starters, provision.json, pinned header
Expand All @@ -32,7 +32,7 @@ cmp build-distribution/environment.tgz build-distribution-repeat/environment.tgz
(`js/developer/environment/bundles.json`, over the inputs of `js/developer/tools/bundle-inputs.json`) and the pinned
header. The core headers that embed the bootstrap bundle (`DeveloperIndexHtmlData.hpp`, `DeveloperBootstrapData.hpp`) are
rendered from their sources by CMake, like the others: `cmake --build <dir> --target webfront-embedded-assets`. A script may only write where `permissions.publish`
of `webfront.project.json` allows: the `build-*` directories and these checked-in outputs.
of `js/developer/webfront.project.json` allows: the `build-*` directories and these checked-in outputs.

The output of a script reaches the terminal of an environment 0.6.1 or later; with 0.6.0 the command prints
only its summary. The integrity of an archive is `openssl dgst -sha512 -binary build-distribution/environment.tgz | base64 -w0`,
Expand Down
2 changes: 1 addition & 1 deletion js/developer/tools/bundle-inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"js/developer/tools/archive.mjs",
"js/developer/tools/distribution.mjs",
"js/developer/scripts/build.mjs",
"webfront.project.json",
"js/developer/webfront.project.json",
"js/core/bootstrap/bootstrap.bundle.mjs",
"js/developer/environment/packages.bundle.mjs",
"include/webfront/system/DeveloperReleaseData.hpp"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions webfront.project.json → js/developer/webfront.project.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
},
"permissions": {
"files": [
"webfront.project.json",
"webfront-packages.lock.json",
"js/developer/webfront.project.json",
"js/developer/webfront-packages.lock.json",
".webfront/developer/packages",
"js/core",
"js/developer/environment",
Expand Down
6 changes: 3 additions & 3 deletions test/cmake/CheckRepositoryLayout.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The tracked root of the repository is a closed list, so that the README stays visible on the
# GitHub page, and no third-party source is vendored: libraries are locked npm packages (#319). webfront.project.json and
# its lock make the repository a wf project: the environment builds itself with wf run (#315).
# GitHub page, and no third-party source is vendored: libraries are locked npm packages (#319). The repository is a wf project whose
# manifest and lock are js/developer/webfront.project.json and its lock (#354, #315): the environment builds itself with wf run.
# Each entry has to stay at the root (#352): .clang-format sits next to the C++ it formats (include/webfront/, test/, examples/) and
# .clang-tidy is cmake/clang-tidy.yaml, passed by cmake/StaticAnalyzers.cmake; wf only grants files under the project root, which must contain js/, test/, examples/ and
# include/; Git, GitHub, CMake and the agents require the others. There is no .devcontainer: the CI is the toolchain reference.
Expand All @@ -13,7 +13,7 @@ endif()

set(expected
.gitattributes .github .gitignore
AGENTS.md CMakeLists.txt README.md webfront-packages.lock.json webfront.project.json
AGENTS.md CMakeLists.txt README.md
cmake docs examples include js test)

set(actual "")
Expand Down
2 changes: 1 addition & 1 deletion test/cmake/CheckRepositoryLayoutNegative.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()
file(REMOVE_RECURSE "${WORK_DIR}" "${WORK_DIR}-archive")
file(MAKE_DIRECTORY "${WORK_DIR}/include/webfront")
foreach(entry .gitattributes .github .gitignore AGENTS.md CMakeLists.txt README.md
webfront-packages.lock.json webfront.project.json cmake docs examples js test)
cmake docs examples js test)
file(WRITE "${WORK_DIR}/${entry}/placeholder" "")
endforeach()
file(WRITE "${WORK_DIR}/include/webfront/WebFront.hpp" "")
Expand Down
6 changes: 3 additions & 3 deletions test/cmake/NodeGuardExceptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set(NODE_GUARD_EXCEPTIONS
"test/cmake/CheckRepositoryLayoutNegative.cmake|node-config|tracks such a directory in a scratch repository to prove that the layout guard rejects it"
"docs/DEVELOPER_ENVIRONMENT.md|node-config|states which directories wf check never lists, the TypeScript layout among them"
# Data of dependencies.
"webfront-packages.lock.json|node-command|the lock records the package.json scripts of its dependencies verbatim, and nothing runs them"
"webfront-packages.lock.json|npm-command|the lock records the package.json scripts of its dependencies verbatim, and nothing runs them"
"webfront-packages.lock.json|node-config|the lock records the file lists of its dependencies verbatim"
"js/developer/webfront-packages.lock.json|node-command|the lock records the package.json scripts of its dependencies verbatim, and nothing runs them"
"js/developer/webfront-packages.lock.json|npm-command|the lock records the package.json scripts of its dependencies verbatim, and nothing runs them"
"js/developer/webfront-packages.lock.json|node-config|the lock records the file lists of its dependencies verbatim"
"js/developer/environment/packages.bundle.mjs|node-api|semver's debug probe, guarded by typeof process, inside the bundle that is a checked-in generated artifact (lock and notices in PACKAGES-LICENSE.txt)")
4 changes: 2 additions & 2 deletions test/cmake/PrepareSelfBuildProject.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Gives the self-build tests a fresh copy of the sources that the environment is built from: the wf project of the
# repository (without its lock, which the tests resolve from the local registry), the environment, the tools and scripts,
# repository, kept in js/developer (without its lock, which the tests resolve from the local registry), the environment, the tools and scripts,
# the starters, the sources of the core's embedded assets, the specs of the developer environment and the pinned header. The build outputs go inside this copy,
# never into the checkout. The site directory is not created: the first staging creates it. The scripts of the test
# registry are copied too, and, with ARCHIVES, the verified archives of its real packages.
# Usage: cmake -DSOURCE=<checkout> -DPROJECT=<directory to create> [-DARCHIVES=<directory>] -P PrepareSelfBuildProject.cmake
file(REMOVE_RECURSE "${PROJECT}")
file(MAKE_DIRECTORY "${PROJECT}" "${PROJECT}/include/webfront/system" "${PROJECT}/js/developer")
file(COPY "${SOURCE}/webfront.project.json" DESTINATION "${PROJECT}")
file(COPY "${SOURCE}/js/core" DESTINATION "${PROJECT}/js")
file(COPY "${SOURCE}/js/developer/webfront.project.json" DESTINATION "${PROJECT}/js/developer")
foreach(directory environment scripts tools)
file(COPY "${SOURCE}/js/developer/${directory}" DESTINATION "${PROJECT}/js/developer")
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion test/developer/support.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ let initialized;
*/
export function esbuild() {
initialized ??= (async () => {
const lock = JSON.parse(await projectText('webfront-packages.lock.json'));
const lock = JSON.parse(await projectText('js/developer/webfront-packages.lock.json'));
const key = lock.packages[lock.roots['esbuild-wasm'].id].key;
const wasmModule = await WebAssembly.compile(await projectBytes(`.webfront/developer/packages/${key}/esbuild.wasm`));
await esbuildWasm.initialize({wasmModule, worker: false});
Expand Down
Loading
Loading