@xylabs/ts-scripts-yarn3 7.5.11 → 7.5.12
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/package.json +7 -5
- package/templates/claude/skills/xylabs-xy-deplint-fix/SKILL.md +8 -4
- package/templates/claude/skills/xylabs-xy-deplint-fix/scripts/deplint-install.sh +27 -0
- package/templates/claude/skills/xylabs-xy-deplint-fix/scripts/deplint-scan.sh +75 -0
- package/templates/claude/skills/xylabs-xy-deplint-fix/scripts/deplint-verify.sh +46 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/ts-scripts-yarn3",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.12",
|
|
4
4
|
"description": "TypeScript project scripts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -49,16 +49,18 @@
|
|
|
49
49
|
"yargs": "~18.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
+
"@types/node": "^25.5.0",
|
|
52
53
|
"@types/yargs": "~17.0.35",
|
|
53
|
-
"@xylabs/ts-scripts-common": "~7.5.
|
|
54
|
-
"@xylabs/tsconfig": "~7.5.
|
|
54
|
+
"@xylabs/ts-scripts-common": "~7.5.12",
|
|
55
|
+
"@xylabs/tsconfig": "~7.5.12",
|
|
55
56
|
"publint": "~0.3.18",
|
|
56
57
|
"tsup": "~8.5.1",
|
|
57
58
|
"typescript": "^5.9.3",
|
|
58
|
-
"
|
|
59
|
+
"vite": "^8.0.3",
|
|
60
|
+
"vitest": "^4.1.2"
|
|
59
61
|
},
|
|
60
62
|
"peerDependencies": {
|
|
61
|
-
"@xylabs/ts-scripts-common": "~7.5.
|
|
63
|
+
"@xylabs/ts-scripts-common": "~7.5.12",
|
|
62
64
|
"typescript": "~5"
|
|
63
65
|
},
|
|
64
66
|
"engines": {
|
|
@@ -125,8 +125,12 @@ classified error:
|
|
|
125
125
|
* **Add dep**: insert the entry with the correct version into the appropriate section.
|
|
126
126
|
Resolve the version using this priority order:
|
|
127
127
|
|
|
128
|
-
1. **
|
|
129
|
-
|
|
128
|
+
1. **Workspace package** (highest priority) — check the `WORKSPACE:name:version` lines
|
|
129
|
+
emitted at the top of `deplint-scan.sh` output. If the dep name appears there, read
|
|
130
|
+
its version directly from that line and prefix with `~` (e.g. `5.3.7` → `~5.3.7`).
|
|
131
|
+
Never use the `workspace:` protocol — use the real semver version from the package.
|
|
132
|
+
|
|
133
|
+
2. **Lock file** — for deps not in the workspace, search `yarn.lock` or `pnpm-lock.yaml`.
|
|
130
134
|
* In `yarn.lock`, look for a block starting with `"<pkg>@`:
|
|
131
135
|
```
|
|
132
136
|
"@xyo-network/payload-model@npm:~5.3.5":
|
|
@@ -136,11 +140,11 @@ classified error:
|
|
|
136
140
|
* In `pnpm-lock.yaml`, find the entry under `packages:` and use its
|
|
137
141
|
specifier (e.g. `~5.3.5`).
|
|
138
142
|
|
|
139
|
-
|
|
143
|
+
3. **Another package.json in the repo** — if the lock file entry is unclear,
|
|
140
144
|
grep other `package.json` files in the monorepo for the dep name and
|
|
141
145
|
copy the version string used there.
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
4. **Latest from the registry** — if the dep does not exist anywhere in the
|
|
144
148
|
repo yet, it is safe to use `~latest` by running:
|
|
145
149
|
```bash
|
|
146
150
|
npm view <package-name> version
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# deplint-install.sh
|
|
3
|
+
#
|
|
4
|
+
# Runs a full package install from the repo root using the detected package manager.
|
|
5
|
+
# Always installs from root — never uses scoped/filtered installs (yarn workspaces focus,
|
|
6
|
+
# pnpm --filter) as those strip the root xy script bindings needed for verification.
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
find_repo_root() {
|
|
10
|
+
local dir="$PWD"
|
|
11
|
+
while [[ "$dir" != "/" ]]; do
|
|
12
|
+
[[ -f "$dir/yarn.lock" || -f "$dir/pnpm-lock.yaml" ]] && echo "$dir" && return
|
|
13
|
+
dir="$(dirname "$dir")"
|
|
14
|
+
done
|
|
15
|
+
echo "ERROR: repo root not found (no yarn.lock or pnpm-lock.yaml)" >&2
|
|
16
|
+
exit 1
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
REPO_ROOT="$(find_repo_root)"
|
|
20
|
+
cd "$REPO_ROOT"
|
|
21
|
+
|
|
22
|
+
# pnpm takes precedence over yarn — repos mid-migration may have both lock files
|
|
23
|
+
if [[ -f pnpm-lock.yaml ]]; then
|
|
24
|
+
pnpm install
|
|
25
|
+
else
|
|
26
|
+
yarn install
|
|
27
|
+
fi
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# deplint-scan.sh [package-name]
|
|
3
|
+
#
|
|
4
|
+
# Emits:
|
|
5
|
+
# WORKSPACE:name:version — for every non-root package in the monorepo
|
|
6
|
+
# PACKAGE:name — for each package with deplint errors
|
|
7
|
+
# ERROR:description:dep — for each error within that package
|
|
8
|
+
# PATH:path/to/package.json
|
|
9
|
+
# STATUS:clean|errors
|
|
10
|
+
#
|
|
11
|
+
# Usage:
|
|
12
|
+
# bash deplint-scan.sh # whole-repo scan
|
|
13
|
+
# bash deplint-scan.sh @scope/package-name # single-package scan
|
|
14
|
+
set -euo pipefail
|
|
15
|
+
|
|
16
|
+
find_repo_root() {
|
|
17
|
+
local dir="$PWD"
|
|
18
|
+
while [[ "$dir" != "/" ]]; do
|
|
19
|
+
[[ -f "$dir/yarn.lock" || -f "$dir/pnpm-lock.yaml" ]] && echo "$dir" && return
|
|
20
|
+
dir="$(dirname "$dir")"
|
|
21
|
+
done
|
|
22
|
+
echo "ERROR: repo root not found (no yarn.lock or pnpm-lock.yaml)" >&2
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
REPO_ROOT="$(find_repo_root)"
|
|
27
|
+
cd "$REPO_ROOT"
|
|
28
|
+
|
|
29
|
+
# pnpm takes precedence over yarn — repos mid-migration may have both lock files
|
|
30
|
+
if [[ -f pnpm-lock.yaml ]]; then PM=pnpm; else PM=yarn; fi
|
|
31
|
+
|
|
32
|
+
# Emit WORKSPACE:name:version for every non-root package in the monorepo.
|
|
33
|
+
# Used by Step 3 to resolve versions for workspace-local deps without using
|
|
34
|
+
# the workspace: protocol (which npm publish does not rewrite).
|
|
35
|
+
find "$REPO_ROOT" -name "package.json" \
|
|
36
|
+
-not -path "*/node_modules/*" \
|
|
37
|
+
-not -path "$REPO_ROOT/package.json" | sort | \
|
|
38
|
+
node -e "
|
|
39
|
+
const fs = require('fs');
|
|
40
|
+
const rl = require('readline').createInterface({ input: process.stdin });
|
|
41
|
+
rl.on('line', f => {
|
|
42
|
+
try {
|
|
43
|
+
const p = JSON.parse(fs.readFileSync(f.trim(), 'utf8'));
|
|
44
|
+
if (p.name && p.version) process.stdout.write('WORKSPACE:' + p.name + ':' + p.version + '\n');
|
|
45
|
+
} catch(e) {}
|
|
46
|
+
});
|
|
47
|
+
" || true
|
|
48
|
+
|
|
49
|
+
# Run deplint — exits non-zero when errors are found, so capture output regardless
|
|
50
|
+
if [[ -n "${1:-}" ]]; then
|
|
51
|
+
deplint_out="$($PM xy deplint "$1" 2>&1)" || true
|
|
52
|
+
else
|
|
53
|
+
deplint_out="$($PM xy deplint 2>&1)" || true
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Parse deplint output into structured lines
|
|
57
|
+
current_pkg=""
|
|
58
|
+
while IFS= read -r line; do
|
|
59
|
+
if [[ "$line" =~ ^\[([^]]+)\]\ (.+):\ (.+)$ ]]; then
|
|
60
|
+
pkg="${BASH_REMATCH[1]}"
|
|
61
|
+
if [[ "$pkg" != "$current_pkg" ]]; then
|
|
62
|
+
current_pkg="$pkg"
|
|
63
|
+
echo "PACKAGE:$pkg"
|
|
64
|
+
fi
|
|
65
|
+
echo "ERROR:${BASH_REMATCH[2]}:${BASH_REMATCH[3]}"
|
|
66
|
+
elif [[ "$line" =~ ^[[:space:]]+(.+package\.json)$ ]]; then
|
|
67
|
+
echo "PATH:${BASH_REMATCH[1]}"
|
|
68
|
+
fi
|
|
69
|
+
done <<< "$deplint_out"
|
|
70
|
+
|
|
71
|
+
if echo "$deplint_out" | grep -q "Found no dependency problems"; then
|
|
72
|
+
echo "STATUS:clean"
|
|
73
|
+
else
|
|
74
|
+
echo "STATUS:errors"
|
|
75
|
+
fi
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# deplint-verify.sh <package-name> [package-name ...]
|
|
3
|
+
#
|
|
4
|
+
# Verifies one or more packages pass deplint in a single approved call.
|
|
5
|
+
# Emits:
|
|
6
|
+
# PASS:name — package has no deplint errors
|
|
7
|
+
# FAIL:name — package still has deplint errors (details follow indented)
|
|
8
|
+
#
|
|
9
|
+
# Exits 0 only if every package passes.
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
if [[ $# -eq 0 ]]; then
|
|
13
|
+
echo "Usage: deplint-verify.sh <package-name> [package-name ...]" >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
find_repo_root() {
|
|
18
|
+
local dir="$PWD"
|
|
19
|
+
while [[ "$dir" != "/" ]]; do
|
|
20
|
+
[[ -f "$dir/yarn.lock" || -f "$dir/pnpm-lock.yaml" ]] && echo "$dir" && return
|
|
21
|
+
dir="$(dirname "$dir")"
|
|
22
|
+
done
|
|
23
|
+
echo "ERROR: repo root not found (no yarn.lock or pnpm-lock.yaml)" >&2
|
|
24
|
+
exit 1
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
REPO_ROOT="$(find_repo_root)"
|
|
28
|
+
cd "$REPO_ROOT"
|
|
29
|
+
|
|
30
|
+
# pnpm takes precedence over yarn — repos mid-migration may have both lock files
|
|
31
|
+
if [[ -f pnpm-lock.yaml ]]; then PM=pnpm; else PM=yarn; fi
|
|
32
|
+
|
|
33
|
+
all_passed=true
|
|
34
|
+
|
|
35
|
+
for pkg in "$@"; do
|
|
36
|
+
output="$($PM xy deplint "$pkg" 2>&1)" || true
|
|
37
|
+
if echo "$output" | grep -q "Found no dependency problems"; then
|
|
38
|
+
echo "PASS:$pkg"
|
|
39
|
+
else
|
|
40
|
+
echo "FAIL:$pkg"
|
|
41
|
+
echo "$output" | grep -E "^\[|^[[:space:]]" | sed 's/^/ /' || true
|
|
42
|
+
all_passed=false
|
|
43
|
+
fi
|
|
44
|
+
done
|
|
45
|
+
|
|
46
|
+
$all_passed || exit 1
|