fix: vue-seo-layer as a peer dependency

pnpm refuses a git dependency inside another package by default
(blockExoticSubdeps), so an app could not install v0.8.0. vue-seo-layer
is now a peer dependency (^0.2.0) and a development dependency pinned
to v0.2.0; apps list vue-seo-layer#v0.2.0 next to the layer.
This commit is contained in:
Jakub Zych
2026-11-05 01:34:21 +01:00
parent 0a77e6e85c
commit f5dc9b2c6d
4 changed files with 47 additions and 26 deletions

View File

@@ -5,7 +5,8 @@
#
# Proves the layer's distribution end to end: a scratch app installs
# vue-journal-layer from git+https://git.golem15.com/golem15/vue-journal-layer.git#<tag>
# anonymously, the installed package.json has no local dependency, the
# anonymously, next to vue-seo-layer (a peer dependency, listed by the app at
# the tag's devDependencies pin) with pnpm's default settings, the installed package.json has no local dependency, the
# lockfile pins the tag's commit, `nuxt build` of the layer's playground
# config succeeds, and the built server passes testing/expect-acme.txt
# against the fixture API.
@@ -144,20 +145,36 @@ TAG_SHA="$(awk -v ref="refs/tags/$TAG^{}" '$2 == ref { print $1 }' <<<"$REMOTE_R
[[ -n "$TAG_SHA" ]] || TAG_SHA="$(awk -v ref="refs/tags/$TAG" '$2 == ref { print $1 }' <<<"$REMOTE_REFS")"
[[ -n "$TAG_SHA" ]] || die "tag $TAG not found on $REPO_URL"
# vue-seo-layer is a peer dependency of the layer, so an app lists it next to
# the layer, as the README's Installation says. The scratch app takes the
# spec the tag pins for its own development (devDependencies), or
# SEO_LAYER_SPEC when set. A tag that still lists vue-seo-layer under
# dependencies (v0.8.0) gets none: pnpm then refuses it as an exotic
# subdependency, which is what this check is for.
SEO_SPEC="${SEO_LAYER_SPEC:-}"
if [[ -z "$SEO_SPEC" ]]; then
SRC="$(mktemp -d "${TMPDIR:-/tmp}/journal-git-install-src.XXXXXX")"
GIT_TERMINAL_PROMPT=0 git clone --quiet --depth 1 --branch "$TAG" "$REPO_URL" "$SRC/layer" 2>/dev/null \
|| { rm -rf "$SRC"; die "git clone of $TAG failed"; }
SEO_SPEC="$(node -e '
const pkg = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"))
const peer = (pkg.peerDependencies || {})["vue-seo-layer"]
const dev = (pkg.devDependencies || {})["vue-seo-layer"]
process.stdout.write(peer && dev ? dev : "")
' "$SRC/layer/package.json")" || { rm -rf "$SRC"; die "cannot read the tag's package.json"; }
rm -rf "$SRC"
fi
cd "$WORK"
cat >package.json <<JSON
{
"name": "acme-blog",
"private": true,
"type": "module",
"dependencies": {
"nuxt": "4.4.8",
"vue": "3.5.35",
"vue-journal-layer": "git+$REPO_URL#$TAG"
}
}
JSON
node -e '
const [repo, tag, seo] = process.argv.slice(1)
const deps = { nuxt: "4.4.8", vue: "3.5.35" }
if (seo) deps["vue-seo-layer"] = seo
deps["vue-journal-layer"] = `git+${repo}#${tag}`
const pkg = { name: "acme-blog", private: true, type: "module", dependencies: deps }
require("node:fs").writeFileSync("package.json", JSON.stringify(pkg, null, 2) + "\n")
' "$REPO_URL" "$TAG" "$SEO_SPEC"
cat >pnpm-workspace.yaml <<'YAML'
allowBuilds: