@xylabs/ts-scripts-yarn3 7.5.12 → 7.5.14
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 +6 -5
- package/templates/claude/skills/xylabs-xy-cli/SKILL.md +68 -19
- package/templates/claude/skills/xylabs-xy-deplint-fix/SKILL.md +53 -189
- package/templates/claude/skills/xylabs-xy-deplint-fix/scripts/deplint-install.sh +0 -27
- package/templates/claude/skills/xylabs-xy-deplint-fix/scripts/deplint-scan.sh +0 -75
- package/templates/claude/skills/xylabs-xy-deplint-fix/scripts/deplint-verify.sh +0 -46
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.14",
|
|
4
4
|
"description": "TypeScript project scripts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
|
-
"templates"
|
|
41
|
+
"templates",
|
|
42
|
+
"README.md"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
45
|
"package-clean": "echo Not cleaning...",
|
|
@@ -51,8 +52,8 @@
|
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/node": "^25.5.0",
|
|
53
54
|
"@types/yargs": "~17.0.35",
|
|
54
|
-
"@xylabs/ts-scripts-common": "~7.5.
|
|
55
|
-
"@xylabs/tsconfig": "~7.5.
|
|
55
|
+
"@xylabs/ts-scripts-common": "~7.5.14",
|
|
56
|
+
"@xylabs/tsconfig": "~7.5.14",
|
|
56
57
|
"publint": "~0.3.18",
|
|
57
58
|
"tsup": "~8.5.1",
|
|
58
59
|
"typescript": "^5.9.3",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"vitest": "^4.1.2"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
|
-
"@xylabs/ts-scripts-common": "~7.5.
|
|
64
|
+
"@xylabs/ts-scripts-common": "~7.5.14",
|
|
64
65
|
"typescript": "~5"
|
|
65
66
|
},
|
|
66
67
|
"engines": {
|
|
@@ -36,40 +36,58 @@ install is needed.
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
+
## Global Options
|
|
40
|
+
|
|
41
|
+
All commands accept these flags:
|
|
42
|
+
|
|
43
|
+
| Flag | Description |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `-j, --jobs` | Max parallel jobs |
|
|
46
|
+
| `-v, --verbose` | Run with verbose logging (default: false) |
|
|
47
|
+
| `-i, --incremental` | Only act on changed packages (default: false) |
|
|
48
|
+
| `-p, --profile` | Profile the action (default: false) |
|
|
49
|
+
| `--version` | Show version number |
|
|
50
|
+
| `--help` | Show help |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
39
54
|
## Command Reference
|
|
40
55
|
|
|
41
56
|
### Build & Compile
|
|
42
57
|
|
|
43
58
|
| Command | Description |
|
|
44
59
|
|---|---|
|
|
45
|
-
| `xy build` | Full build: compile + publint + deplint + lint |
|
|
46
|
-
| `xy compile` | Compile all packages (TypeScript via tsup) + publint |
|
|
47
|
-
| `xy
|
|
48
|
-
| `xy
|
|
49
|
-
| `xy
|
|
60
|
+
| `xy build [package]` | Full build: compile + publint + deplint + lint |
|
|
61
|
+
| `xy compile [package]` | Compile all packages (TypeScript via tsup) + publint |
|
|
62
|
+
| `xy compile-only [package]` | Compile only (no publint) |
|
|
63
|
+
| `xy recompile [package]` | Clean compiled output, then compile again |
|
|
64
|
+
| `xy rebuild [package]` | Clean everything, then full build |
|
|
65
|
+
| `xy copy-assets [package]` | Copy non-TS assets from `src/` to `dist/` |
|
|
66
|
+
| `xy clean [package]` | Remove `dist/` and `build/` artifacts |
|
|
50
67
|
|
|
51
68
|
### Lint & Fix
|
|
52
69
|
|
|
53
70
|
| Command | Description |
|
|
54
71
|
|---|---|
|
|
55
|
-
| `xy
|
|
56
|
-
| `xy
|
|
57
|
-
| `xy
|
|
58
|
-
| `xy
|
|
59
|
-
| `xy
|
|
60
|
-
| `xy
|
|
72
|
+
| `xy check` | Run gitlint, publint, repo lint, and lintlint as a batch |
|
|
73
|
+
| `xy lint [package]` | Run ESLint across all packages |
|
|
74
|
+
| `xy fix [package]` | Run ESLint with `--fix` to auto-fix issues |
|
|
75
|
+
| `xy relint [package]` | Clean ESLint cache, then lint from scratch |
|
|
76
|
+
| `xy deplint [package]` | Verify imports match `package.json` dependency declarations |
|
|
77
|
+
| `xy publint [package]` | Validate `package.json` correctness for npm publishing |
|
|
78
|
+
| `xy cycle [package]` | Detect circular dependency cycles |
|
|
61
79
|
| `xy knip` | Find unused exports and dead code |
|
|
62
|
-
| `xy dead` | Check for dead (unreachable) code |
|
|
80
|
+
| `xy dead [package]` | Check for dead (unreachable) code |
|
|
63
81
|
| `xy sonar` | Run SonarQube analysis |
|
|
82
|
+
| `xy lintlint` | Check for redundant or overridden ESLint rules vs shared config |
|
|
64
83
|
| `xy dupdeps` | Find duplicate dependency declarations across packages |
|
|
65
|
-
| `xy lintlint` | Check for redundant or overridden ESLint rules |
|
|
66
84
|
|
|
67
85
|
### Testing
|
|
68
86
|
|
|
69
87
|
| Command | Description |
|
|
70
88
|
|---|---|
|
|
71
|
-
| `xy test` | Run Vitest tests |
|
|
72
|
-
| `xy retest` | Clean test cache, then run tests |
|
|
89
|
+
| `xy test [target]` | Run Vitest tests |
|
|
90
|
+
| `xy retest [target]` | Clean test cache, then run tests |
|
|
73
91
|
|
|
74
92
|
### Deploy & Publish
|
|
75
93
|
|
|
@@ -79,29 +97,60 @@ install is needed.
|
|
|
79
97
|
| `xy deploy-minor` | Minor version bump + build + publish |
|
|
80
98
|
| `xy deploy-major` | Major version bump + build + publish |
|
|
81
99
|
| `xy deploy-next` | Deploy as `next` tag (pre-release) |
|
|
100
|
+
| `xy publish` | Publish packages to npmjs (without version bump) |
|
|
82
101
|
|
|
83
102
|
### Dependency Management
|
|
84
103
|
|
|
85
104
|
| Command | Description |
|
|
86
105
|
|---|---|
|
|
87
|
-
| `xy clean` | Remove `dist/` and `build/` artifacts |
|
|
88
106
|
| `xy reinstall` | Remove `node_modules`, reinstall from scratch |
|
|
89
107
|
| `xy up` | Update all dependencies to latest compatible versions |
|
|
108
|
+
| `xy updo` | Update dependencies (interactive) |
|
|
109
|
+
| `xy upplug` | Update Yarn plugins |
|
|
110
|
+
| `xy upyarn` | Update Yarn version |
|
|
111
|
+
| `xy statics` | Confirm static packages |
|
|
112
|
+
| `xy yarn3only` | Check if using Yarn v3 |
|
|
90
113
|
|
|
91
114
|
### Git & Repo Maintenance
|
|
92
115
|
|
|
93
116
|
| Command | Description |
|
|
94
117
|
|---|---|
|
|
95
|
-
| `xy gitlint` | Lint git configuration (ignorecase, autocrlf, etc.) |
|
|
118
|
+
| `xy gitlint [package]` | Lint git configuration (ignorecase, autocrlf, etc.) |
|
|
96
119
|
| `xy gitignore` | Generate root `.gitignore` and remove package-level ones |
|
|
97
|
-
| `xy
|
|
98
|
-
| `xy
|
|
120
|
+
| `xy npmignore-gen` | Generate `.npmignore` files |
|
|
121
|
+
| `xy license [package]` | Check dependency licenses for compliance |
|
|
122
|
+
| `xy gen-docs [package]` | Generate TypeDoc API documentation |
|
|
123
|
+
| `xy clean-docs` | Clean TypeDoc output |
|
|
124
|
+
|
|
125
|
+
### README Utilities
|
|
126
|
+
|
|
127
|
+
| Command | Description |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `xy readme gen [package]` | Generate README.md files from template |
|
|
130
|
+
| `xy readme init` | Initialize README template and logo files |
|
|
131
|
+
|
|
132
|
+
`xy readme gen` accepts `--template <path>` to specify a custom template and
|
|
133
|
+
`--typedoc` to include TypeDoc reference sections.
|
|
134
|
+
|
|
135
|
+
### Repo Utilities
|
|
136
|
+
|
|
137
|
+
| Command | Description |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `xy repo lint` | Check monorepo package structure (root private, workspace globs, etc.) |
|
|
140
|
+
|
|
141
|
+
### Package Manager Utilities
|
|
142
|
+
|
|
143
|
+
| Command | Description |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `xy packman convert <target>` | Convert repo to a different package manager (pnpm or yarn) |
|
|
146
|
+
| `xy packman lint` | Check package manager configuration settings |
|
|
99
147
|
|
|
100
148
|
### Claude Code Integration
|
|
101
149
|
|
|
102
150
|
| Command | Description |
|
|
103
151
|
|---|---|
|
|
104
152
|
| `xy claude init` | Initialize all Claude configuration (commands, rules, skills, settings) |
|
|
153
|
+
| `xy claude check` | Check if Claude configuration is up to date with templates |
|
|
105
154
|
| `xy claude clean` | Remove all Claude configuration files |
|
|
106
155
|
| `xy claude commands` | Sync slash commands to `.claude/commands/` |
|
|
107
156
|
| `xy claude rules` | Sync rules to `.claude/rules/` |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xylabs-xy-deplint-fix
|
|
3
3
|
description: >
|
|
4
|
-
Fix dependency declaration errors in one or more packages using `xy deplint`.
|
|
4
|
+
Fix dependency declaration errors in one or more packages using `xy deplint --fix`.
|
|
5
5
|
Use this skill whenever the user asks to fix deplint errors, clean up package.json
|
|
6
6
|
dependencies, or resolve "dependency should be devDependency" / "missing dependency"
|
|
7
7
|
warnings in an XY Labs monorepo. If a package name is supplied as an argument, fix
|
|
@@ -11,32 +11,7 @@ description: >
|
|
|
11
11
|
# xylabs-xy-deplint-fix
|
|
12
12
|
|
|
13
13
|
Diagnoses and fixes `package.json` dependency declaration errors reported by `xy deplint`
|
|
14
|
-
in an XY Labs
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Bundled Scripts
|
|
19
|
-
|
|
20
|
-
Three shell scripts live alongside this skill in `scripts/`. They collapse multiple
|
|
21
|
-
bash operations into single approved calls, minimising permission prompts:
|
|
22
|
-
|
|
23
|
-
| Script | Purpose | Prompts saved |
|
|
24
|
-
|--------|---------|---------------|
|
|
25
|
-
| `scripts/deplint-scan.sh [pkg]` | Run deplint; emit structured `PACKAGE/ERROR/PATH/STATUS` lines | Replaces 1 raw deplint call with parseable output |
|
|
26
|
-
| `scripts/deplint-install.sh` | Run full `yarn install` (or `pnpm install`) from repo root | Always safe to approve once; never uses `workspaces focus` |
|
|
27
|
-
| `scripts/deplint-verify.sh pkg1 [pkg2 …]` | Check N packages in one call; prints `PASS/FAIL` per package | Replaces N individual verify calls with one |
|
|
28
|
-
|
|
29
|
-
**How to use them in the workflow:**
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
Step 1 → bash scripts/deplint-scan.sh [pkg] # 1 approval
|
|
33
|
-
Step 3 → (LLM reads/writes package.json files) # no prompts
|
|
34
|
-
Step 4 → bash scripts/deplint-install.sh # 1 approval
|
|
35
|
-
Step 5 → bash scripts/deplint-verify.sh <pkgs…> # 1 approval
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
All three scripts auto-detect the repo root (walking up until they find `yarn.lock`
|
|
39
|
-
or `pnpm-lock.yaml`), so they work correctly regardless of the current working directory.
|
|
14
|
+
in an XY Labs monorepo. The `--fix` flag handles all error types automatically.
|
|
40
15
|
|
|
41
16
|
---
|
|
42
17
|
|
|
@@ -51,208 +26,97 @@ All commands below are shown without a prefix. Prepend accordingly.
|
|
|
51
26
|
|
|
52
27
|
---
|
|
53
28
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
* **Argument provided** (e.g. `@xyo-network/advertising-payload-plugins`) → single-package
|
|
57
|
-
mode: run Steps 1–5 for that package only, then stop.
|
|
58
|
-
* **No argument** → whole-repo mode: run `xy deplint` without a package name to get all
|
|
59
|
-
problems, extract the unique set of affected package names from the output, then run
|
|
60
|
-
Steps 1–5 for each affected package in turn.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## Step 1 — Run deplint
|
|
65
|
-
|
|
66
|
-
Use the bundled scan script (preferred — one approval, structured output):
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
# Single-package
|
|
70
|
-
bash .claude/skills/xylabs-xy-deplint-fix/scripts/deplint-scan.sh @scope/package-name
|
|
29
|
+
## What `--fix` handles
|
|
71
30
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
31
|
+
| Error message | Fix applied |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `dependency should be devDependency` | Moves from `dependencies` → `devDependencies` |
|
|
34
|
+
| `Unused dependency` | Removes from `dependencies` |
|
|
35
|
+
| `Unused devDependency` | Removes from `devDependencies` |
|
|
36
|
+
| `Unused peerDependency` | Removes from `peerDependencies` |
|
|
37
|
+
| `Missing dependency` | Adds to `dependencies` (version from node_modules) |
|
|
38
|
+
| `Missing devDependency` | Adds to `devDependencies` (version from node_modules) |
|
|
39
|
+
| `Unsatisfied peer dependency` | Adds to appropriate section based on context |
|
|
75
40
|
|
|
76
|
-
|
|
41
|
+
Empty dependency sections are removed automatically. All edits are sorted with
|
|
42
|
+
`sort-package-json`.
|
|
77
43
|
|
|
78
|
-
|
|
79
|
-
PACKAGE:@scope/package-name
|
|
80
|
-
ERROR:<problem description>:<dep>
|
|
81
|
-
PATH:packages/path/to/package.json
|
|
82
|
-
STATUS:errors # or STATUS:clean
|
|
83
|
-
```
|
|
44
|
+
---
|
|
84
45
|
|
|
85
|
-
|
|
86
|
-
to fix. Work through them one at a time.
|
|
46
|
+
## Workflow
|
|
87
47
|
|
|
88
|
-
|
|
48
|
+
### Step 1 — Fix
|
|
89
49
|
|
|
90
50
|
```bash
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Each problem line has the form:
|
|
51
|
+
# Whole repo
|
|
52
|
+
xy deplint --fix
|
|
95
53
|
|
|
54
|
+
# Single package
|
|
55
|
+
xy deplint --fix package-name
|
|
96
56
|
```
|
|
97
|
-
[@scope/package-name] <problem description>: <dependency-name>
|
|
98
|
-
<path/to/package.json>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Step 2 — Classify each error
|
|
104
|
-
|
|
105
|
-
| Error message | Meaning | Fix |
|
|
106
|
-
|---|---|---|
|
|
107
|
-
| `dependency should be devDependency` | Listed in `dependencies` but not needed by npm consumers at runtime — it's a build/type/test dep, or it's a peer that consumers already provide | Move from `dependencies` → `devDependencies` |
|
|
108
|
-
| `Unused devDependency` | Listed in `devDependencies` but no import of it was found anywhere in the package's source | Remove from `devDependencies` |
|
|
109
|
-
| `Missing dependency` | Imported in source but absent from `dependencies` | Add to `dependencies` |
|
|
110
|
-
| `Missing devDependency` | Imported in source but absent from `devDependencies` | Add to `devDependencies` |
|
|
111
|
-
|
|
112
|
-
> **Aggregator packages** (packages with no `src/` that only re-export workspace children)
|
|
113
|
-
> typically need all of their workspace children as `devDependencies`, not `dependencies`.
|
|
114
|
-
> See Edge Cases below.
|
|
115
|
-
|
|
116
|
-
---
|
|
117
57
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Open the `package.json` file identified in the deplint output and apply the fix for each
|
|
121
|
-
classified error:
|
|
122
|
-
|
|
123
|
-
* **Move dep**: cut the entry from `dependencies`, paste into `devDependencies`.
|
|
124
|
-
* **Remove dep**: delete the entry entirely from `devDependencies`.
|
|
125
|
-
* **Add dep**: insert the entry with the correct version into the appropriate section.
|
|
126
|
-
Resolve the version using this priority order:
|
|
127
|
-
|
|
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`.
|
|
134
|
-
* In `yarn.lock`, look for a block starting with `"<pkg>@`:
|
|
135
|
-
```
|
|
136
|
-
"@xyo-network/payload-model@npm:~5.3.5":
|
|
137
|
-
version: 5.3.7
|
|
138
|
-
```
|
|
139
|
-
Use the declared range (e.g. `~5.3.5`), not the resolved exact version.
|
|
140
|
-
* In `pnpm-lock.yaml`, find the entry under `packages:` and use its
|
|
141
|
-
specifier (e.g. `~5.3.5`).
|
|
142
|
-
|
|
143
|
-
3. **Another package.json in the repo** — if the lock file entry is unclear,
|
|
144
|
-
grep other `package.json` files in the monorepo for the dep name and
|
|
145
|
-
copy the version string used there.
|
|
146
|
-
|
|
147
|
-
4. **Latest from the registry** — if the dep does not exist anywhere in the
|
|
148
|
-
repo yet, it is safe to use `~latest` by running:
|
|
149
|
-
```bash
|
|
150
|
-
npm view <package-name> version
|
|
151
|
-
```
|
|
152
|
-
Then prefix the result with `~` (e.g. `~5.4.0`).
|
|
153
|
-
|
|
154
|
-
**Version format rule:** prefer `~` ranges throughout. If the sourced version
|
|
155
|
-
already carries a range prefix (`~` or `^`), keep it as-is. If it is a bare
|
|
156
|
-
semver (e.g. `5.3.1`), add a `~` prefix (e.g. `~5.3.1`).
|
|
157
|
-
* If `dependencies` becomes empty after edits, remove the `"dependencies"` key entirely
|
|
158
|
-
to keep the file clean.
|
|
58
|
+
This scans for problems and applies fixes to `package.json` files in place.
|
|
59
|
+
Review the output to see what was changed.
|
|
159
60
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
## Step 4 — Reinstall dependencies
|
|
163
|
-
|
|
164
|
-
After editing `package.json`, run a **full install from the repo root**. Do not use
|
|
165
|
-
`yarn workspaces focus` — it strips the `xy` scripts needed for verification.
|
|
166
|
-
|
|
167
|
-
Use the bundled install script (preferred — one approval, always runs from root):
|
|
61
|
+
### Step 2 — Install
|
|
168
62
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Or directly:
|
|
63
|
+
After `--fix` modifies `package.json` files, reinstall from the repo root so the
|
|
64
|
+
lockfile and `node_modules` reflect the changes:
|
|
174
65
|
|
|
175
66
|
```bash
|
|
176
67
|
yarn install # or: pnpm install
|
|
177
68
|
```
|
|
178
69
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
## Step 5 — Verify
|
|
182
|
-
|
|
183
|
-
Use the bundled verify script (preferred — verifies multiple packages in one approval):
|
|
70
|
+
Do **not** use `yarn workspaces focus` — it strips the root-level `xy` script bindings.
|
|
184
71
|
|
|
185
|
-
|
|
186
|
-
bash .claude/skills/xylabs-xy-deplint-fix/scripts/deplint-verify.sh <pkg1> [pkg2 …]
|
|
187
|
-
```
|
|
72
|
+
### Step 3 — Verify
|
|
188
73
|
|
|
189
|
-
|
|
74
|
+
Re-run deplint without `--fix` to confirm all issues are resolved:
|
|
190
75
|
|
|
191
76
|
```bash
|
|
192
|
-
xy deplint
|
|
77
|
+
xy deplint [package-name]
|
|
193
78
|
```
|
|
194
79
|
|
|
195
|
-
**Definition of done
|
|
80
|
+
**Definition of done:**
|
|
196
81
|
|
|
197
82
|
```
|
|
198
83
|
Deplint: Found no dependency problems. ✔
|
|
199
84
|
```
|
|
200
85
|
|
|
201
|
-
If problems remain,
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
## Step 6 — Advance to the next package (whole-repo mode only)
|
|
206
|
-
|
|
207
|
-
In whole-repo mode, once a package passes Step 5, move to the next package in the list
|
|
208
|
-
collected in Step 1 and repeat Steps 2–5 for it.
|
|
209
|
-
|
|
210
|
-
**Definition of done for whole-repo mode:** every package that appeared in the original
|
|
211
|
-
`xy deplint` output now passes `xy deplint <package-name>` individually. Confirm by
|
|
212
|
-
running a final `xy deplint` (no arguments) and verifying:
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
Deplint: Found no dependency problems. ✔
|
|
216
|
-
```
|
|
86
|
+
If problems remain, repeat from Step 1. Some issues (e.g. newly-added deps introducing
|
|
87
|
+
their own unsatisfied peers) may require multiple passes.
|
|
217
88
|
|
|
218
89
|
---
|
|
219
90
|
|
|
220
91
|
## Edge Cases
|
|
221
92
|
|
|
222
|
-
###
|
|
223
|
-
|
|
224
|
-
`yarn workspaces focus <package>` installs only the deps for that one package and removes
|
|
225
|
-
the root-level `xy` script bindings. Always use `yarn install` (full) after editing any
|
|
226
|
-
`package.json`.
|
|
227
|
-
|
|
228
|
-
### Empty `dependencies` block after migration
|
|
93
|
+
### Multiple passes required
|
|
229
94
|
|
|
230
|
-
|
|
231
|
-
|
|
95
|
+
Fixing missing dependencies may introduce new unsatisfied peer dependency errors, since
|
|
96
|
+
the newly-added package has its own peers. Run the fix → install → verify loop until
|
|
97
|
+
clean.
|
|
232
98
|
|
|
233
|
-
###
|
|
99
|
+
### Version resolution for missing deps
|
|
234
100
|
|
|
235
|
-
|
|
236
|
-
|
|
101
|
+
`--fix` resolves versions by reading the installed version from `node_modules` and
|
|
102
|
+
prefixing with `~`. If the package is not installed, it falls back to `*`. After
|
|
103
|
+
installing and re-running, the version will be resolved correctly on the next pass.
|
|
237
104
|
|
|
238
105
|
### Aggregator packages
|
|
239
106
|
|
|
240
|
-
Aggregator packages (
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
* Workspace child packages belong in `devDependencies`, not `dependencies`
|
|
244
|
-
* Their transitive deps (e.g. `@xyo-network/payload-model`) will also surface as
|
|
245
|
-
`Missing devDependency` because deplint walks the leaf source files from the
|
|
246
|
-
aggregator's root
|
|
247
|
-
|
|
248
|
-
Fix: move all workspace children to `devDependencies`, then add any missing transitive
|
|
249
|
-
deps (also as `devDependencies`).
|
|
107
|
+
Aggregator packages (no `src/`, only re-export workspace children) may need all workspace
|
|
108
|
+
children as `devDependencies`. `--fix` handles this — it moves deps to devDependencies
|
|
109
|
+
and adds missing transitive deps automatically.
|
|
250
110
|
|
|
251
111
|
### `dependency should be devDependency` for a runtime import
|
|
252
112
|
|
|
253
113
|
deplint may flag a dep as "should be devDependency" even when it is imported for a
|
|
254
|
-
runtime value
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
114
|
+
runtime value. This happens when the dep is a foundational library that consumers are
|
|
115
|
+
expected to already have installed (behaves like a peer). `--fix` moves it to
|
|
116
|
+
`devDependencies`. If the dep must be guaranteed for external npm consumers, manually
|
|
117
|
+
add it to `peerDependencies` after fixing.
|
|
118
|
+
|
|
119
|
+
### `yarn workspaces focus` breaks the `xy` command
|
|
120
|
+
|
|
121
|
+
`yarn workspaces focus <package>` installs only the deps for that one package and removes
|
|
122
|
+
the root-level `xy` script bindings. Always use `yarn install` (full) after fixing.
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|