@procedures/lib 0.2.3 → 0.4.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 +89 -0
- package/README.md +19 -40
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +22 -51
- package/dist/module.js.map +1 -1
- package/dist/procedures/lib/graph.d.ts +21 -0
- package/dist/procedures/lib/graph.d.ts.map +1 -0
- package/dist/procedures/lib/graph.js +118 -0
- package/dist/procedures/lib/graph.js.map +1 -0
- package/dist/procedures/lib/index.d.ts +1 -0
- package/dist/procedures/lib/index.d.ts.map +1 -1
- package/dist/procedures/lib/index.js +1 -0
- package/dist/procedures/lib/index.js.map +1 -1
- package/dist/types.d.ts +42 -58
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +27 -89
- package/dist/types.js.map +1 -1
- package/package.json +9 -9
- package/src/index.ts +2 -0
- package/src/module.ts +22 -60
- package/src/procedures/lib/graph.ts +134 -0
- package/src/procedures/lib/index.ts +1 -0
- package/src/types.ts +77 -144
- package/dist/procedures/core/catch.d.ts +0 -33
- package/dist/procedures/core/catch.d.ts.map +0 -1
- package/dist/procedures/core/catch.js +0 -118
- package/dist/procedures/core/catch.js.map +0 -1
- package/dist/procedures/core/index.d.ts +0 -9
- package/dist/procedures/core/index.d.ts.map +0 -1
- package/dist/procedures/core/index.js +0 -8
- package/dist/procedures/core/index.js.map +0 -1
- package/dist/procedures/dag/index.d.ts +0 -5
- package/dist/procedures/dag/index.d.ts.map +0 -1
- package/dist/procedures/dag/index.js +0 -5
- package/dist/procedures/dag/index.js.map +0 -1
- package/dist/procedures/dag/traverse.d.ts +0 -54
- package/dist/procedures/dag/traverse.d.ts.map +0 -1
- package/dist/procedures/dag/traverse.js +0 -252
- package/dist/procedures/dag/traverse.js.map +0 -1
- package/src/procedures/core/catch.ts +0 -142
- package/src/procedures/core/index.ts +0 -9
- package/src/procedures/dag/index.ts +0 -5
- package/src/procedures/dag/traverse.ts +0 -281
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,94 @@
|
|
|
1
1
|
# @procedures/lib
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2fd2398: `dag.traverse` moved from `@procedures/lib` to `@procedures/dag`. Its name, input, output and effects stay the same. In this version, `@procedures/dag` has a `./module` entry, a `./register` entry and the `client.procedures` field, and it depends on `@procedures/client` and `zod`. The graph algorithms of its root do not change.
|
|
8
|
+
|
|
9
|
+
`dag.traverse` gets the packages from `lib.scan` through `ctx.client` (`calls: ["lib.scan"]`). `@procedures/lib` depends on `@procedures/dag`, so the module of `@procedures/dag` does not list the module of `@procedures/lib` as a dependency: a host registers the two modules. `bundle-dev`, `bundle-mcp` and `mark` do. The module of `@procedures/lib` does not register `dag.traverse` any more.
|
|
10
|
+
|
|
11
|
+
`DagTraverseInputSchema`, `DagTraverseInput`, `DagTraverseOutput` and `TraverseNodeResult` are exports of `@procedures/dag`, not of `@procedures/lib`.
|
|
12
|
+
- 3fefa43: `core.catch` is removed. Use `client.tryCatch`.
|
|
13
|
+
|
|
14
|
+
`core.catch` did the same as `client.tryCatch` of `@procedures/client`. `CoreCatchInputSchema`, `CoreCatchInput`, `CoreCatchOutput` and `CoreCatchOutputSchema` are removed too. `client.tryCatch` gives no context name: a call of its `try` or `catch` operand needs no `$when: "catch"`.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [d919678]
|
|
19
|
+
- Updated dependencies [057d69a]
|
|
20
|
+
- Updated dependencies [b2a1a1e]
|
|
21
|
+
- Updated dependencies [057d69a]
|
|
22
|
+
- Updated dependencies [057d69a]
|
|
23
|
+
- Updated dependencies [057d69a]
|
|
24
|
+
- Updated dependencies [057d69a]
|
|
25
|
+
- Updated dependencies [057d69a]
|
|
26
|
+
- Updated dependencies [afd6a19]
|
|
27
|
+
- Updated dependencies [057d69a]
|
|
28
|
+
- Updated dependencies [2fd2398]
|
|
29
|
+
- Updated dependencies [3d76cb7]
|
|
30
|
+
- Updated dependencies [0ecc788]
|
|
31
|
+
- Updated dependencies [4c51727]
|
|
32
|
+
- Updated dependencies [4e751da]
|
|
33
|
+
- @procedures/client@0.4.0
|
|
34
|
+
- @procedures/dag@0.4.0
|
|
35
|
+
- @procedures/fs@0.4.0
|
|
36
|
+
- @procedures/git@0.4.0
|
|
37
|
+
- @procedures/shell@0.4.0
|
|
38
|
+
- @procedures/pnpm@0.4.0
|
|
39
|
+
|
|
40
|
+
## 0.3.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- 4d3ff39: `lib.graph` (roadmap R44) gives the dependency graph of the workspace packages. The nodes are the packages, and the edges are the dependencies with a `workspace:` specifier. The procedure finds the cycles, and gives the build levels of a graph without a cycle. It reads through `fs.readdir` and `fs.read.json`, and changes nothing.
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [ddea529]
|
|
49
|
+
- Updated dependencies [b2a3e3a]
|
|
50
|
+
- Updated dependencies [a8c47f1]
|
|
51
|
+
- Updated dependencies [381ce3a]
|
|
52
|
+
- Updated dependencies [0c627f8]
|
|
53
|
+
- Updated dependencies [ae7f05f]
|
|
54
|
+
- Updated dependencies [7873940]
|
|
55
|
+
- Updated dependencies [a70d445]
|
|
56
|
+
- Updated dependencies [f23c7ad]
|
|
57
|
+
- Updated dependencies [3c40d2d]
|
|
58
|
+
- Updated dependencies [bc70357]
|
|
59
|
+
- Updated dependencies [4cad9ab]
|
|
60
|
+
- Updated dependencies [07cc998]
|
|
61
|
+
- Updated dependencies [a6b01a9]
|
|
62
|
+
- Updated dependencies [c799cdd]
|
|
63
|
+
- Updated dependencies [540f8d9]
|
|
64
|
+
- Updated dependencies [b6daaec]
|
|
65
|
+
- Updated dependencies [5b9264e]
|
|
66
|
+
- Updated dependencies [956e88b]
|
|
67
|
+
- Updated dependencies [ff62281]
|
|
68
|
+
- Updated dependencies [6e4de6c]
|
|
69
|
+
- Updated dependencies [14d85fe]
|
|
70
|
+
- Updated dependencies [d81d0ed]
|
|
71
|
+
- Updated dependencies [aa67cc7]
|
|
72
|
+
- Updated dependencies [061fa22]
|
|
73
|
+
- Updated dependencies [cfb9d69]
|
|
74
|
+
- Updated dependencies [43f7de5]
|
|
75
|
+
- Updated dependencies [b07bb50]
|
|
76
|
+
- Updated dependencies [4a3bfa1]
|
|
77
|
+
- Updated dependencies [bd0b626]
|
|
78
|
+
- Updated dependencies [95b660d]
|
|
79
|
+
- Updated dependencies [a6be873]
|
|
80
|
+
- Updated dependencies [fb30718]
|
|
81
|
+
- Updated dependencies [c5528e4]
|
|
82
|
+
- Updated dependencies [fee5d9c]
|
|
83
|
+
- Updated dependencies [21f7743]
|
|
84
|
+
- Updated dependencies [31a0b46]
|
|
85
|
+
- @procedures/client@0.3.0
|
|
86
|
+
- @procedures/fs@0.3.0
|
|
87
|
+
- @procedures/git@0.3.0
|
|
88
|
+
- @procedures/pnpm@0.3.0
|
|
89
|
+
- @procedures/shell@0.3.0
|
|
90
|
+
- @procedures/dag@0.3.0
|
|
91
|
+
|
|
3
92
|
## 0.2.3
|
|
4
93
|
|
|
5
94
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
npm install @procedures/lib
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
`client-lib` gives the procedures that manage the packages of the monorepo
|
|
9
|
+
`client-lib` gives the procedures that manage the packages of the monorepo.
|
|
10
10
|
|
|
11
11
|
| Procedure | Function |
|
|
12
12
|
|---|---|
|
|
@@ -14,12 +14,16 @@ npm install @procedures/lib
|
|
|
14
14
|
| `lib.new` | Make a package from the template |
|
|
15
15
|
| `lib.audit` | Compare each package with the template |
|
|
16
16
|
| `lib.rename` | Rename a package in each file of the workspace |
|
|
17
|
+
| `lib.graph` | Give the dependency graph of the workspace packages, with its cycles |
|
|
17
18
|
| `ecosystem.procedures` | List the procedures of the packages |
|
|
18
|
-
| `dag.traverse` | Start a procedure for each package, in the order of their dependencies |
|
|
19
|
-
| `core.catch` | Start a deferred call, and give the error to a handler call |
|
|
20
19
|
|
|
21
20
|
Until October 2026, `client-lib` also had `lib.install`, `lib.pull` and `lib.refresh`, for one repository per package. The monorepo does not need them, and they are gone ([DECISIONS-2026-10.md](../documentation/DECISIONS-2026-10.md)).
|
|
22
21
|
|
|
22
|
+
In version 0.3.0 and before, `client-lib` also had two runners of programs:
|
|
23
|
+
|
|
24
|
+
- `dag.traverse` moved to [`client-dag`](../client-dag) (`@procedures/dag`), with the same name. It gets the packages from `lib.scan` of this package. Thus a host registers the two modules.
|
|
25
|
+
- `core.catch` is removed. It did the same as `client.tryCatch` of `@procedures/client`. Use `client.tryCatch`.
|
|
26
|
+
|
|
23
27
|
## Use
|
|
24
28
|
|
|
25
29
|
```typescript
|
|
@@ -70,51 +74,26 @@ The output also has `flagNotices`: the procedure flags whose short form is also
|
|
|
70
74
|
|
|
71
75
|
Input: `oldName`, `newName`, `rootPath` and `dryRun`. The procedure changes the package name, the dependencies, the imports and the dynamic imports in the workspace. The output lists each change and gives a summary.
|
|
72
76
|
|
|
73
|
-
## `
|
|
74
|
-
|
|
75
|
-
Input: `rootPath`, `namespace` and `includeMetadata`. The output lists the procedures of the packages that have a `client.procedures` field.
|
|
76
|
-
|
|
77
|
-
## `dag.traverse`
|
|
77
|
+
## `lib.graph`
|
|
78
78
|
|
|
79
|
-
`
|
|
79
|
+
Input: `rootPath`. The procedure reads the `package.json` of each folder in `packages/` through `fs.readdir` and `fs.read.json`. It changes nothing.
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| `rootPath` | the workspace | The workspace root |
|
|
87
|
-
| `concurrency` | 4 | The number of visits at the same time |
|
|
88
|
-
| `serialize` | `auto` | When the visits in one git repository start one at a time: `auto` (when the visit uses a `git` procedure), `repository` (always) or `none` |
|
|
89
|
-
| `continueOnError` | false | Continue after a failed visit |
|
|
90
|
-
| `dryRun` | false | Give the plan only |
|
|
81
|
+
- `nodes` has one item for each package: `name`, `folder`, `version` and `private`.
|
|
82
|
+
- `edges` has one item for each dependency with a `workspace:` specifier: `from`, `to`, `kind` and `spec`. The kinds are `dependencies`, `devDependencies`, `peerDependencies` and `optionalDependencies`.
|
|
83
|
+
- `cycles` lists each cycle as the names of its packages. A package that depends on itself is also a cycle. `acyclic` is true when the list is empty.
|
|
84
|
+
- `levels` is the build order of a graph without a cycle. The packages of level 0 depend on no workspace package. Each package of a level depends only on packages of lower levels.
|
|
85
|
+
- `warnings` lists the folders that the procedure cannot read, and each `workspace:` dependency on a name that is not in the workspace.
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
await client.exec(["dag", "traverse"], {
|
|
96
|
-
visit: { $proc: ["pnpm", "run"], input: { script: "build" }, $when: "$parent" },
|
|
97
|
-
root: "@procedures/fs",
|
|
98
|
-
});
|
|
87
|
+
```sh
|
|
88
|
+
node packages/mark/dist/cli.js lib graph
|
|
99
89
|
```
|
|
100
90
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
## `core.catch`
|
|
104
|
-
|
|
105
|
-
`core.catch` starts the `try` call. When it fails, `core.catch` starts the `handler` call with the error in its input (`success: false`, `error`, `proc`). Give both calls `$when: "catch"`, so that they wait for this runner.
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
await client.exec(["core", "catch"], {
|
|
109
|
-
try: { $proc: ["git", "commit"], input: { message: "auto" }, $when: "catch" },
|
|
110
|
-
handler: { $proc: ["client", "identity"], input: { value: { continue: true } }, $when: "catch" },
|
|
111
|
-
});
|
|
112
|
-
```
|
|
91
|
+
## `ecosystem.procedures`
|
|
113
92
|
|
|
114
|
-
|
|
93
|
+
Input: `rootPath`, `namespace` and `includeMetadata`. The output lists the procedures of the packages that have a `client.procedures` field.
|
|
115
94
|
|
|
116
95
|
## Related packages
|
|
117
96
|
|
|
118
|
-
- `client-dag`: the graph algorithms of `dag.traverse`.
|
|
97
|
+
- `client-dag`: the graph algorithms of `lib.graph`, and the procedure `dag.traverse`, which uses `lib.scan`.
|
|
119
98
|
- `client-procedure`: `procedure.new`, the scaffold of a procedure.
|
|
120
99
|
- `mark`: the CLI that starts these procedures.
|