rman 1.3.0 → 2.0.0-beta.3

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.
Files changed (187) hide show
  1. package/README.md +65 -31
  2. package/builtins/platforms/node/augmentation/rmanrc.augmentation.d.ts +83 -0
  3. package/builtins/platforms/node/augmentation/system-info.augmentation.d.ts +26 -0
  4. package/builtins/platforms/node/augmentation/system-info.augmentation.js +79 -0
  5. package/builtins/platforms/node/commands/ci.command.d.ts +133 -0
  6. package/builtins/platforms/node/commands/ci.command.js +60 -0
  7. package/builtins/platforms/node/commands/clean.command.d.ts +185 -0
  8. package/builtins/platforms/node/commands/clean.command.js +74 -0
  9. package/builtins/platforms/node/index.d.ts +8 -0
  10. package/builtins/platforms/node/index.js +8 -0
  11. package/builtins/platforms/node/node-config.interface.d.ts +76 -0
  12. package/builtins/platforms/node/node-config.interface.js +7 -0
  13. package/builtins/platforms/node/node-manifest.provider.d.ts +68 -0
  14. package/builtins/platforms/node/node-manifest.provider.js +125 -0
  15. package/builtins/platforms/node/node.platform.d.ts +53 -0
  16. package/builtins/platforms/node/node.platform.js +134 -0
  17. package/builtins/platforms/node/services/ci.service.d.ts +47 -0
  18. package/builtins/platforms/node/services/ci.service.js +213 -0
  19. package/builtins/platforms/node/services/clean.service.d.ts +53 -0
  20. package/builtins/platforms/node/services/clean.service.js +237 -0
  21. package/builtins/platforms/node/services/publish.service.d.ts +114 -0
  22. package/builtins/platforms/node/services/publish.service.js +371 -0
  23. package/builtins/platforms/node/services/version-plan.service.d.ts +44 -0
  24. package/builtins/platforms/node/services/version-plan.service.js +58 -0
  25. package/builtins/platforms/node/utils/workspace-range.d.ts +26 -0
  26. package/builtins/platforms/node/utils/workspace-range.js +28 -0
  27. package/builtins/presets/index.d.ts +15 -0
  28. package/builtins/presets/index.js +57 -0
  29. package/builtins/presets/node.d.ts +16 -0
  30. package/builtins/presets/node.js +57 -0
  31. package/{services → builtins/publish-targets/docker}/docker-publish.service.d.ts +52 -31
  32. package/{services → builtins/publish-targets/docker}/docker-publish.service.js +49 -26
  33. package/builtins/publish-targets/docker/docker.target.d.ts +54 -0
  34. package/builtins/publish-targets/docker/docker.target.js +40 -0
  35. package/builtins/publish-targets/docker/index.d.ts +2 -0
  36. package/builtins/publish-targets/docker/index.js +2 -0
  37. package/builtins/publish-targets/npm/index.d.ts +2 -0
  38. package/builtins/publish-targets/npm/index.js +2 -0
  39. package/builtins/publish-targets/npm/npm-publish-target.d.ts +73 -0
  40. package/builtins/publish-targets/npm/npm-publish-target.js +95 -0
  41. package/builtins/publish-targets/npm/npm-view.d.ts +48 -0
  42. package/builtins/publish-targets/npm/npm-view.js +71 -0
  43. package/cli.d.ts +8 -0
  44. package/cli.js +228 -93
  45. package/commands/build.command.d.ts +177 -3
  46. package/commands/build.command.js +20 -10
  47. package/commands/changelog.command.d.ts +296 -3
  48. package/commands/changelog.command.js +127 -43
  49. package/commands/config.command.d.ts +44 -3
  50. package/commands/config.command.js +53 -24
  51. package/commands/diff.command.d.ts +37 -3
  52. package/commands/diff.command.js +25 -16
  53. package/commands/exec.command.d.ts +193 -3
  54. package/commands/exec.command.js +60 -58
  55. package/commands/github-release.command.d.ts +154 -3
  56. package/commands/github-release.command.js +67 -37
  57. package/commands/import.command.d.ts +36 -3
  58. package/commands/import.command.js +28 -20
  59. package/commands/info.command.d.ts +35 -7
  60. package/commands/info.command.js +36 -30
  61. package/commands/lint.command.d.ts +176 -0
  62. package/commands/lint.command.js +34 -0
  63. package/commands/list.command.d.ts +163 -3
  64. package/commands/list.command.js +109 -71
  65. package/commands/publish.command.d.ts +231 -0
  66. package/commands/publish.command.js +304 -0
  67. package/commands/run.command.d.ts +186 -6
  68. package/commands/run.command.js +26 -72
  69. package/commands/test.command.d.ts +173 -3
  70. package/commands/test.command.js +16 -10
  71. package/commands/version.command.d.ts +330 -3
  72. package/commands/version.command.js +292 -78
  73. package/commands.d.ts +32 -0
  74. package/commands.js +28 -0
  75. package/constants.js +1 -1
  76. package/core/application.d.ts +116 -0
  77. package/core/application.js +160 -0
  78. package/core/classes/package.d.ts +219 -0
  79. package/core/classes/package.js +214 -0
  80. package/core/classes/registry.d.ts +30 -0
  81. package/core/classes/registry.js +47 -0
  82. package/core/{repository.d.ts → classes/repository.d.ts} +69 -20
  83. package/core/{repository.js → classes/repository.js} +195 -75
  84. package/core/classes/service.d.ts +49 -0
  85. package/core/classes/service.js +40 -0
  86. package/core/{version-scheme.d.ts → classes/version-scheme.d.ts} +23 -1
  87. package/core/{version-scheme.js → classes/version-scheme.js} +29 -1
  88. package/core/classes/workspace.d.ts +275 -0
  89. package/core/classes/workspace.js +537 -0
  90. package/core/command-builder.d.ts +14 -0
  91. package/core/command-builder.js +94 -0
  92. package/core/config/config-file-scope.d.ts +107 -0
  93. package/core/config/config-file-scope.js +226 -0
  94. package/core/config/config-interpolator.d.ts +164 -0
  95. package/core/config/config-interpolator.js +577 -0
  96. package/core/config/config-paths.d.ts +65 -0
  97. package/core/config/config-paths.js +78 -0
  98. package/core/config/config-reader.d.ts +192 -0
  99. package/core/config/config-reader.js +727 -0
  100. package/core/{merge-config.d.ts → config/merge-config.d.ts} +33 -34
  101. package/core/config/merge-config.js +260 -0
  102. package/core/{resolve-target.d.ts → config/resolve-config-target.d.ts} +1 -1
  103. package/core/{resolve-target.js → config/resolve-config-target.js} +1 -1
  104. package/core/{custom-command.d.ts → interfaces/custom-command.d.ts} +46 -10
  105. package/core/{custom-command.js → interfaces/custom-command.js} +44 -17
  106. package/core/{manifest.d.ts → interfaces/manifest.d.ts} +49 -27
  107. package/core/interfaces/manifest.js +132 -0
  108. package/core/interfaces/plugin.d.ts +174 -0
  109. package/core/interfaces/plugin.js +124 -0
  110. package/core/interfaces/publish-target.d.ts +136 -0
  111. package/core/interfaces/publish-target.js +43 -0
  112. package/core/{run-step.d.ts → interfaces/run-step.d.ts} +4 -4
  113. package/core/interfaces/run-step.js +1 -0
  114. package/core/plugin-loader.d.ts +25 -0
  115. package/core/plugin-loader.js +53 -0
  116. package/index.d.ts +122 -24
  117. package/index.js +66 -16
  118. package/interfaces/config-scope.interface.d.ts +223 -0
  119. package/interfaces/config-scope.interface.js +1 -0
  120. package/interfaces/rman-config.interface.d.ts +821 -203
  121. package/interfaces/rman-config.interface.js +78 -1
  122. package/package.json +3 -1
  123. package/services/change-hash.service.d.ts +42 -8
  124. package/services/change-hash.service.js +92 -13
  125. package/services/changelog.service.d.ts +91 -52
  126. package/services/changelog.service.js +460 -74
  127. package/services/config-service.d.ts +8 -0
  128. package/services/config-service.js +3 -0
  129. package/services/exec.service.d.ts +23 -12
  130. package/services/exec.service.js +14 -9
  131. package/services/github-release.service.d.ts +45 -34
  132. package/services/github-release.service.js +15 -12
  133. package/services/import.service.d.ts +25 -14
  134. package/services/import.service.js +9 -5
  135. package/services/list.service.d.ts +67 -13
  136. package/services/list.service.js +62 -15
  137. package/services/run.service.d.ts +35 -22
  138. package/services/run.service.js +316 -233
  139. package/services/system-info.d.ts +1 -1
  140. package/services/version-plan.service.d.ts +35 -8
  141. package/services/version-plan.service.js +96 -36
  142. package/services/version.service.d.ts +34 -14
  143. package/services/version.service.js +35 -16
  144. package/services.d.ts +1 -1
  145. package/services.js +1 -1
  146. package/utils/bin-path.d.ts +6 -7
  147. package/utils/bin-path.js +7 -18
  148. package/utils/branch-guard.d.ts +30 -1
  149. package/utils/branch-guard.js +31 -0
  150. package/utils/color-yaml.d.ts +8 -0
  151. package/utils/color-yaml.js +86 -0
  152. package/utils/exec.d.ts +10 -0
  153. package/utils/exec.js +1 -1
  154. package/utils/git.d.ts +26 -0
  155. package/utils/git.js +65 -0
  156. package/utils/logger.d.ts +2 -2
  157. package/utils/logger.js +1 -1
  158. package/utils/package-filter.d.ts +135 -8
  159. package/utils/package-filter.js +204 -16
  160. package/utils/printable-config.d.ts +9 -1
  161. package/utils/printable-config.js +46 -1
  162. package/utils/progress-panel.d.ts +9 -0
  163. package/utils/progress-panel.js +23 -1
  164. package/utils/release-version.d.ts +1 -1
  165. package/utils/run-bin.d.ts +10 -0
  166. package/utils/run-bin.js +1 -1
  167. package/utils/run-options.d.ts +97 -0
  168. package/utils/run-options.js +81 -0
  169. package/utils/version-group.d.ts +31 -0
  170. package/utils/version-group.js +43 -0
  171. package/utils/version-stamp.d.ts +1 -1
  172. package/utils/version-stamp.js +1 -1
  173. package/commands/changed.command.d.ts +0 -3
  174. package/commands/changed.command.js +0 -29
  175. package/core/config.d.ts +0 -409
  176. package/core/config.js +0 -939
  177. package/core/extends-config.d.ts +0 -27
  178. package/core/extends-config.js +0 -89
  179. package/core/manifest.js +0 -150
  180. package/core/merge-config.js +0 -219
  181. package/core/package.d.ts +0 -83
  182. package/core/package.js +0 -106
  183. package/core/plugin.d.ts +0 -112
  184. package/core/plugin.js +0 -189
  185. package/core/workspace.d.ts +0 -68
  186. package/core/workspace.js +0 -83
  187. /package/{core/run-step.js → builtins/platforms/node/augmentation/rmanrc.augmentation.js} +0 -0
@@ -0,0 +1,223 @@
1
+ import type path from 'node:path';
2
+ import type semver from 'semver';
3
+ import type { ConfigFileScope } from '../core/config/config-file-scope.js';
4
+ /**
5
+ * **What a `${{ ... }}` expression can name**, and what a value function is handed.
6
+ *
7
+ * One file because these six describe one thing from different angles: `ConfigScope` is the whole
8
+ * of it, the others are its members, and `ConfigValueContext` is the same scope with `value` added
9
+ * for a function. They are `interfaces/` rather than `core/` for the reason the config interface
10
+ * already is - nothing here runs, and the audience is a config author.
11
+ */
12
+ /**
13
+ * What a `${{ ... }}` expression can see - the bindings of the fresh global it is evaluated in.
14
+ * Namespaced rather than a flat bag of loose names: one obvious place per fact, and room to add
15
+ * helpers to `pkg`/`repository` later without crowding the global.
16
+ *
17
+ * Alongside these, **the config's own top-level keys are bound bare** (`${{ changelog.filePath }}`,
18
+ * `${{ clean.include }}`) - see `interpolateConfig`. They are not listed here because they come
19
+ * from the config being interpolated, not from this object; a name here wins over a config key of
20
+ * the same name.
21
+ *
22
+ * **Trap: bare `${{ version }}` is the `version` *options block*, not the package's version
23
+ * string** - that is `${{ pkg.version }}`. Same word, two different things, and the plain one
24
+ * belongs to the config because every other config key is reachable that way.
25
+ */
26
+ export interface ConfigScope {
27
+ /** The package the config was resolved for - which is what lets one declaration at the root
28
+ * still say something package-specific. */
29
+ pkg: PackageScope;
30
+ repository: RepositoryScope;
31
+ /** Paths, resolved against the package the config was resolved for. */
32
+ file: FileScope;
33
+ /**
34
+ * The **contents** of a structured file - `${{ read('tsconfig.json').compilerOptions.outDir }}` -
35
+ * where `file` answers only where one is. Resolved against `pkg.dirname` like `file`, so a
36
+ * `"[*]"` block asks each package about its own; a repository-level file is reached through
37
+ * `read(path.join(repository.dirname, ...))`.
38
+ *
39
+ * `.json`, `.yml`/`.yaml` and `.ini` by extension, or name it for a file that does not say
40
+ * (`read('.npmrc', 'ini')`). **Throws** when the file is absent, as `file.resolve` does - compose
41
+ * with `file.exists` when its absence is a case to handle.
42
+ *
43
+ * **A manifest is `pkg.manifest`, not this.** `read('package.json')` works and is the wrong
44
+ * answer: which file a package's identity lives in belongs to the ecosystem, so that expression
45
+ * is already wrong in a Cargo package sitting beside a Node one.
46
+ *
47
+ * The result is **deeply frozen and shared** - see `readStructuredFile`. Spread it to change it.
48
+ */
49
+ read: ConfigFileScope.ReadFile;
50
+ env: Record<string, string | undefined>;
51
+ /** rman's own `semver`, for the arithmetic every release config eventually wants
52
+ * (`semver.major(pkg.version)`). */
53
+ semver: typeof semver;
54
+ /**
55
+ * Node's own `node:path` - `${{ path.join(pkg.dirname, 'LICENSE') }}`, rather than gluing
56
+ * strings with `+ "/" +` and getting a double separator or none.
57
+ *
58
+ * The platform's flavour, not `path.posix`, so a joined path is the one the shell on *this*
59
+ * machine understands; `path.posix` and `path.win32` are reachable through it when a config
60
+ * genuinely needs one of them (a Docker image path, say, which is always posix).
61
+ */
62
+ path: typeof path;
63
+ /**
64
+ * The checkout: branch, sha, whether the tree is dirty.
65
+ *
66
+ * **Top level, not `repository.git`** - which is where it used to be, and the move is the point.
67
+ * `repository` shares its shape with `pkg` because the repository root *is* a package, and its
68
+ * only other members (`monorepo`, `packages`, `package()`) say something about the repository as
69
+ * a container of packages. A branch name says nothing about any package; it describes the
70
+ * working tree every one of them happens to be sitting in - the same kind of ambient fact as
71
+ * `env`, and it belongs beside it.
72
+ *
73
+ * **Read from git only if an expression actually asks**, then remembered for the whole run: every
74
+ * command resolves config, and a repository that never mentions git must not pay for one. See
75
+ * `Repository.configScope` for the getter, and `interpolateConfig` for why the context is built
76
+ * from property descriptors rather than a spread - a spread would fire this getter on every
77
+ * command, which is exactly what moving it up here risked.
78
+ */
79
+ git: GitScope;
80
+ }
81
+ /** One package, as an expression sees it - the same shape for the package the config belongs to
82
+ * and for the repository itself, so `${{ repository.basename }}` reads the way `${{ pkg.basename }}` does. */
83
+ /**
84
+ * `file` in a `${{ ... }}` expression: what is actually on disk, resolved against **the package
85
+ * the config was resolved for** - so one declaration in a `"[*]"` block asks each package about
86
+ * its own directory.
87
+ *
88
+ * The pair exists because a config has two different questions about a path, and answering both
89
+ * with one function would mean picking a wrong default for the other:
90
+ *
91
+ * ```yaml
92
+ * "[*]":
93
+ * run:
94
+ * build:
95
+ * # first of these that exists, and an error naming the config path if none do
96
+ * exec: 'tsc -b ${{ file.exists("tsconfig-build.json") || file.resolve("tsconfig.json") }}'
97
+ * ```
98
+ *
99
+ * **Every member asks a question, and none may ever change anything - no `copy`, no `write`, no
100
+ * `mkdir`.** Not a matter of taste: this is evaluated when the config *resolves*, which every
101
+ * command does, so a member that acted would act on `rman list`, `rman info` and `rman config`.
102
+ *
103
+ * That has been tried, in the only way a missing function can be: a shared config reaching for a
104
+ * `file.copyMany(...)` that does not exist made **every** rman command exit 1 - and had it existed,
105
+ * the quieter outcome would have been files copied by `rman list`. Work belongs in a step
106
+ * (`run.<script>`'s slots, `version`'s hooks), which is the one place rman runs anything, and a
107
+ * step can now be a function - so there is nothing this would enable that is not already possible
108
+ * at the right moment.
109
+ */
110
+ export interface FileScope {
111
+ /**
112
+ * The absolute path if it exists, **`''` if it does not** - so `a || b || c` picks the first one
113
+ * present, and so a miss never reaches the "nullish inside a string" guard that `undefined` would
114
+ * trip. Accepts a relative path (against the package directory) or an absolute one.
115
+ *
116
+ * It returns a path rather than a boolean on purpose: the caller almost always wants the path,
117
+ * and a separate `file.path()` to fetch it after a boolean test would read the disk twice and
118
+ * invite the two calls to disagree.
119
+ */
120
+ exists(target: string): string;
121
+ /** The absolute path, or **throws** - for a file whose absence is a mistake rather than a case to
122
+ * handle. The error names the config path holding the expression, like any other. */
123
+ resolve(target: string): string;
124
+ /**
125
+ * The first of several that exists, or **throws** naming every candidate it tried:
126
+ *
127
+ * ```yaml
128
+ * exec: 'tsc -b ${{ file.resolveFirst("tsconfig-build.json", "tsconfig.build.json", "tsconfig.json") }}'
129
+ * ```
130
+ *
131
+ * The same thing an `exists() || exists() || resolve()` chain does, said once - and it cannot be
132
+ * got subtly wrong the way that chain can: ending it in `exists()` leaves `tsc -b ` with no
133
+ * argument when nothing matches, and tsc then silently falls back to the directory's default
134
+ * rather than reporting that the package has no build config.
135
+ */
136
+ resolveFirst(...targets: string[]): string;
137
+ }
138
+ export interface PackageScope {
139
+ /** The package's own name, scope included (`@sqb/builder`). */
140
+ name: string;
141
+ /** Just the scope (`@sqb`), or `undefined` for an unscoped package. */
142
+ scope: string | undefined;
143
+ /** The name with its scope stripped (`builder`). */
144
+ unscopedName: string;
145
+ version: string;
146
+ /** The package directory's last segment (`builder`) - not always the same as `unscopedName`,
147
+ * which is why both exist, and usually what a sibling path (`../../coverage/builder`) is keyed on. */
148
+ basename: string;
149
+ /** Absolute path to the package's own directory - named as rman's own `Package.dirname` is. */
150
+ dirname: string;
151
+ /** That directory relative to the repository root (`packages/builder`), which is what a command
152
+ * addressing another package from the root usually needs. Empty string for the root itself. */
153
+ relativeDir: string;
154
+ /**
155
+ * Which ecosystem this package belongs to - `'node'` for one the `node` built-in read, empty when no
156
+ * plugin claimed it. The same `Package.provider`, so one declaration can address a single
157
+ * ecosystem in a polyglot repository (`if: "${{ pkg.provider === 'node' }}"`).
158
+ */
159
+ provider: string;
160
+ /**
161
+ * The whole manifest, as a copy - so an expression can reach a field rman itself has no opinion
162
+ * about (`${{ pkg.manifest.engines.node }}`).
163
+ *
164
+ * Named `manifest`, not `json`: which file a package's identity lives in is the ecosystem's
165
+ * business now (see `Plugin`'s manifest members), and `json` was that assumption showing through the one
166
+ * remaining user-facing name. A config written against `${{ pkg.json... }}` needs the rename.
167
+ */
168
+ manifest: Record<string, unknown>;
169
+ /**
170
+ * The version this run is about to write - **bound only during `version`**, and only once its
171
+ * plan is computed. Reading it anywhere else throws rather than yielding `undefined`: no other
172
+ * command has a target version, so an expression asking for one has been put in the wrong place,
173
+ * and a config that quietly evaluates to "undefined" is the failure this evaluator exists to
174
+ * prevent.
175
+ */
176
+ targetVersion: string;
177
+ }
178
+ /** Facts about the repository, on top of the root package's own - because the repository root *is*
179
+ * a package (`repository.name` is what its `package.json` says, `repository.basename` the directory
180
+ * it sits in, and the two genuinely differ). Sharing `PackageScope`'s shape is what makes
181
+ * `repository.version` read the way `pkg.version` does. */
182
+ export interface RepositoryScope extends PackageScope {
183
+ monorepo: boolean;
184
+ /** Every package in the repository - the root included only when it *is* the one package. */
185
+ packages: PackageScope[];
186
+ /** One package by name, or `undefined` - for reaching a sibling's directory. */
187
+ package(name: string): PackageScope | undefined;
188
+ }
189
+ export interface GitScope {
190
+ branch: string | undefined;
191
+ sha: string | undefined;
192
+ shortSha: string | undefined;
193
+ /** Whether the working tree has uncommitted changes. */
194
+ dirty: boolean | undefined;
195
+ }
196
+ /**
197
+ * What a **value function** is handed - `clean: { include: ({ value, pkg }) => [...] }`.
198
+ *
199
+ * The same scope a `${{ }}` expression sees, plus `value`. There is no asymmetry between the two
200
+ * spellings and that is an invariant with a spec on it: the argument *is* the expression context
201
+ * with `value` on it, so a member defined straight onto the argument would split them silently and
202
+ * a config author would meet a name that works in one spelling and not the other.
203
+ *
204
+ * **The config's own top-level keys are bound bare too**, and they cannot be typed here - they come
205
+ * from the config being interpolated rather than from this object. Reach them through `pkg.config`
206
+ * when a type matters, or accept `any` from the bare name.
207
+ *
208
+ * **Not what a *step* function is handed.** `run.<script>.exec` and `version.<slot>` take a
209
+ * `RunStepFn`, which gets a `RunStepContext` (`pkg`, `repository`, `cwd`, `runBin`, `logger`) when
210
+ * its turn comes - a different object at a different time, which is the whole distinction the two
211
+ * forms exist to draw. Never widen a step key to accept this one.
212
+ */
213
+ export interface ConfigValueContext extends ConfigScope {
214
+ /**
215
+ * What this key resolved to in the layers **below** this one - the list form of it, so
216
+ * `[...value, 'x']` needs no guard. `any` rather than a generic: the key's own type is what the
217
+ * function must return, while `value` is whatever the layers underneath happened to produce, and
218
+ * a scalar underneath arrives as a one-element list. See `previousValue`.
219
+ */
220
+ value: any;
221
+ /** The config's own top-level keys, bound bare - `vars`, `publish`, `clean`, … */
222
+ [key: string]: any;
223
+ }
@@ -0,0 +1 @@
1
+ export {};