@ontrails/commander 1.0.0-beta.16 → 1.0.0-beta.17
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 +10 -0
- package/package.json +3 -3
- package/src/surface.ts +15 -0
- package/src/to-commander.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ontrails/commander
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 61497c5: Add v1-minimum public API examples for shipped surface entrypoints.
|
|
8
|
+
- Updated dependencies [3dc8254]
|
|
9
|
+
- Updated dependencies [61497c5]
|
|
10
|
+
- @ontrails/core@1.0.0-beta.17
|
|
11
|
+
- @ontrails/cli@1.0.0-beta.17
|
|
12
|
+
|
|
3
13
|
## 1.0.0-beta.16
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontrails/commander",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.17",
|
|
4
4
|
"files": [
|
|
5
5
|
"src/**/*.ts",
|
|
6
6
|
"!src/**/__tests__/**",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ontrails/cli": "^1.0.0-beta.
|
|
26
|
-
"@ontrails/core": "^1.0.0-beta.
|
|
25
|
+
"@ontrails/cli": "^1.0.0-beta.16",
|
|
26
|
+
"@ontrails/core": "^1.0.0-beta.16",
|
|
27
27
|
"commander": "^14.0.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
package/src/surface.ts
CHANGED
|
@@ -68,6 +68,14 @@ const deriveCommanderOptions = (
|
|
|
68
68
|
* @remarks This is a host materialization boundary. Derivation failures are
|
|
69
69
|
* thrown for the caller's CLI bootstrap code after `deriveCliCommands` has
|
|
70
70
|
* already represented the framework error as a Result.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* import { createProgram } from '@ontrails/commander';
|
|
75
|
+
*
|
|
76
|
+
* const program = createProgram(graph, { name: 'demo' });
|
|
77
|
+
* program.parse();
|
|
78
|
+
* ```
|
|
71
79
|
*/
|
|
72
80
|
export const createProgram = (
|
|
73
81
|
graph: Topo,
|
|
@@ -108,6 +116,13 @@ export const createProgram = (
|
|
|
108
116
|
* Returns the process exit code without calling `process.exit()`, so callers
|
|
109
117
|
* can run cleanup before terminating. The CLI `surface()` entry point
|
|
110
118
|
* delegates here and lets the process exit naturally.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* import { surface } from '@ontrails/commander';
|
|
123
|
+
*
|
|
124
|
+
* const { exitCode } = await surface(graph, { name: 'demo' });
|
|
125
|
+
* ```
|
|
111
126
|
*/
|
|
112
127
|
export const surface = async (
|
|
113
128
|
graph: Topo,
|
package/src/to-commander.ts
CHANGED
|
@@ -438,6 +438,20 @@ const applyCliCommand = (
|
|
|
438
438
|
state.executable = true;
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Convert framework-agnostic CLI commands into a Commander program.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* import { deriveCliCommands } from '@ontrails/cli';
|
|
447
|
+
* import { toCommander } from '@ontrails/commander';
|
|
448
|
+
*
|
|
449
|
+
* const commands = deriveCliCommands(graph);
|
|
450
|
+
* if (commands.isErr()) throw commands.error;
|
|
451
|
+
*
|
|
452
|
+
* const program = toCommander(commands.value, { name: 'demo' });
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
441
455
|
export const toCommander = (
|
|
442
456
|
commands: CliCommand[],
|
|
443
457
|
options?: ToCommanderOptions
|