textrun-shell 0.2.1 → 0.3.1
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/README.md
CHANGED
|
@@ -6,8 +6,7 @@ actions for documenting console commands to be executed by the reader.
|
|
|
6
6
|
### Setup
|
|
7
7
|
|
|
8
8
|
To add this package as a Text-Runner plugin, run <code type="npm/install">npm i
|
|
9
|
-
-D textrun-shell</code
|
|
10
|
-
textrun-shell</code>.
|
|
9
|
+
-D textrun-shell</code>.
|
|
11
10
|
|
|
12
11
|
<!-- TODO: verify this somehow -->
|
|
13
12
|
|
|
@@ -18,8 +17,8 @@ an example:
|
|
|
18
17
|
```js
|
|
19
18
|
export default {
|
|
20
19
|
binaries: {
|
|
21
|
-
"text-
|
|
22
|
-
}
|
|
20
|
+
"text-runner": path.join(__dirname, "node_modules", ".bin", "text-runner")
|
|
21
|
+
}
|
|
23
22
|
}
|
|
24
23
|
```
|
|
25
24
|
|
|
@@ -50,7 +49,7 @@ looks like this:
|
|
|
50
49
|
The "echo" command prints text on the command line. For example, let's run:
|
|
51
50
|
|
|
52
51
|
<pre type="shell/command">
|
|
53
|
-
|
|
52
|
+
echo Hello world!
|
|
54
53
|
</pre>
|
|
55
54
|
|
|
56
55
|
It welcomes us with a nice greeting:
|
|
@@ -81,7 +80,7 @@ import * as readline from "readline"
|
|
|
81
80
|
var rl = readline.createInterface({
|
|
82
81
|
input: process.stdin,
|
|
83
82
|
output: process.stdout,
|
|
84
|
-
terminal: false
|
|
83
|
+
terminal: false
|
|
85
84
|
})
|
|
86
85
|
|
|
87
86
|
rl.question("your name\n", name => {
|
|
@@ -100,7 +99,7 @@ rl.question("your name\n", name => {
|
|
|
100
99
|
Run this tool on the command line
|
|
101
100
|
|
|
102
101
|
```
|
|
103
|
-
|
|
102
|
+
node greeter.js
|
|
104
103
|
```
|
|
105
104
|
|
|
106
105
|
and provide user input with an HTML table:
|
|
@@ -161,7 +160,7 @@ that shows them in action:
|
|
|
161
160
|
Start the server:
|
|
162
161
|
|
|
163
162
|
<pre type="shell/server">
|
|
164
|
-
|
|
163
|
+
node server.js
|
|
165
164
|
</pre>
|
|
166
165
|
|
|
167
166
|
Wait until it is fully booted up:
|
|
@@ -25,7 +25,7 @@ export async function commandWithInput(action) {
|
|
|
25
25
|
}
|
|
26
26
|
// this needs to be global because it is used in the "verify-run-console-output" step
|
|
27
27
|
const processor = observableProcess.start(callArgs(commandsToRun, process.platform), {
|
|
28
|
-
cwd: action.configuration.workspace.platformified()
|
|
28
|
+
cwd: action.configuration.workspace.platformified()
|
|
29
29
|
});
|
|
30
30
|
for (const inputLine of input) {
|
|
31
31
|
await enter(processor, inputLine);
|
|
@@ -63,13 +63,13 @@ function getInput(nodes) {
|
|
|
63
63
|
if (tdNode.length === 1) {
|
|
64
64
|
// single-column table, use that column
|
|
65
65
|
const text = trContent.textInNode(tdNode[0]);
|
|
66
|
-
result.push({
|
|
66
|
+
result.push({ input: text, textToWait: null });
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
69
|
// multi-colum table, use the last column
|
|
70
70
|
result.push({
|
|
71
71
|
input: trContent.textInNode(tdNode[tdNode.length - 1]),
|
|
72
|
-
textToWait: trContent.textInNode(tdNode[0])
|
|
72
|
+
textToWait: trContent.textInNode(tdNode[0])
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
}
|
package/dist/actions/command.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function command(action) {
|
|
|
21
21
|
}
|
|
22
22
|
action.name(`running console command: ${color.cyan(commandsToRun)}`);
|
|
23
23
|
const processor = observableProcess.start(trExt.callArgs(commandsToRun, process.platform), {
|
|
24
|
-
cwd: action.configuration.workspace.platformified()
|
|
24
|
+
cwd: action.configuration.workspace.platformified()
|
|
25
25
|
});
|
|
26
26
|
// this is also used in the "verify-run-console-output" step
|
|
27
27
|
const finished = (await processor.waitForEnd());
|
package/dist/actions/server.js
CHANGED
|
@@ -17,7 +17,7 @@ export function server(action) {
|
|
|
17
17
|
.join(" && ");
|
|
18
18
|
action.name(`starting a server process: ${color.bold(color.cyan(commandsToRun))}`);
|
|
19
19
|
CurrentServer.instance().set(observableProcess.start(trExt.callArgs(commandsToRun, process.platform), {
|
|
20
|
-
cwd: action.configuration.workspace.platformified()
|
|
20
|
+
cwd: action.configuration.workspace.platformified()
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=server.js.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { PathMapper } from "./path-mapper.js";
|
|
2
2
|
/** Configuration represents the configuration options for the textrun-shell library. */
|
|
3
3
|
export class Configuration {
|
|
4
|
+
constructor(file) {
|
|
5
|
+
this.file = file;
|
|
6
|
+
}
|
|
4
7
|
static default() {
|
|
5
8
|
return new Configuration({
|
|
6
|
-
globals: {}
|
|
9
|
+
globals: {}
|
|
7
10
|
});
|
|
8
11
|
}
|
|
9
12
|
/** Provides the configuration stored in the file with the given path. */
|
|
@@ -17,9 +20,6 @@ export class Configuration {
|
|
|
17
20
|
return Configuration.default();
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
|
-
constructor(file) {
|
|
21
|
-
this.file = file;
|
|
22
|
-
}
|
|
23
23
|
/** provides the PathMapper instance to use */
|
|
24
24
|
pathMapper() {
|
|
25
25
|
return new PathMapper(this.file.globals);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** CurrentServer provides global access to the currently running server process. */
|
|
2
2
|
export class CurrentServer {
|
|
3
|
-
static instance() {
|
|
4
|
-
return instance;
|
|
5
|
-
}
|
|
6
3
|
constructor() {
|
|
7
4
|
this.process = null;
|
|
8
5
|
}
|
|
6
|
+
static instance() {
|
|
7
|
+
return instance;
|
|
8
|
+
}
|
|
9
9
|
hasProcess() {
|
|
10
10
|
return this.process != null;
|
|
11
11
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { command } from "./actions/command.js";
|
|
2
1
|
import { commandOutput } from "./actions/command-output.js";
|
|
3
2
|
import { commandWithInput } from "./actions/command-with-input.js";
|
|
4
|
-
import {
|
|
3
|
+
import { command } from "./actions/command.js";
|
|
5
4
|
import { serverOutput } from "./actions/server-output.js";
|
|
5
|
+
import { server } from "./actions/server.js";
|
|
6
6
|
import { stopServer } from "./actions/stop-server.js";
|
|
7
7
|
export const textrunActions = {
|
|
8
8
|
command,
|
|
9
9
|
commandOutput,
|
|
10
10
|
commandWithInput,
|
|
11
|
-
serverOutput,
|
|
12
11
|
server,
|
|
13
|
-
|
|
12
|
+
serverOutput,
|
|
13
|
+
stopServer
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textrun-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,29 +9,29 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc -p tsconfig-build.json",
|
|
12
|
-
"clean": "rm -rf dist",
|
|
13
12
|
"cuke": "cucumber-js --format=progress",
|
|
14
|
-
"doc": "text-
|
|
15
|
-
"fix": "eslint --fix --ignore-pattern=dist/ . &&
|
|
16
|
-
"lint": "
|
|
17
|
-
"
|
|
13
|
+
"doc": "text-runner",
|
|
14
|
+
"fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet",
|
|
15
|
+
"lint": "dprint check && sort-package-json --check --quiet && eslint --ignore-pattern=dist/ . && depcheck --config=../.depcheckrc",
|
|
16
|
+
"reset": "rm -rf dist && yarn run build",
|
|
17
|
+
"unit": "node --test --import tsx 'src/**/*.test.ts'"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"assert-no-diff": "
|
|
20
|
+
"assert-no-diff": "4.1.0",
|
|
21
21
|
"colorette": "2.0.20",
|
|
22
|
-
"end-child-processes": "
|
|
23
|
-
"observable-process": "8.0.0
|
|
22
|
+
"end-child-processes": "2.0.3",
|
|
23
|
+
"observable-process": "8.0.0",
|
|
24
24
|
"strip-ansi": "7.1.0",
|
|
25
|
-
"text-runner-
|
|
26
|
-
"textrun-extension": "0.
|
|
25
|
+
"text-runner-engine": "7.1.2",
|
|
26
|
+
"textrun-extension": "0.3.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"shared-cucumber-steps": "*",
|
|
30
|
-
"text-runner": "
|
|
31
|
-
"textrun-action": "0.
|
|
32
|
-
"textrun-extension": "0.
|
|
33
|
-
"textrun-workspace": "0.
|
|
30
|
+
"text-runner": "7.1.2",
|
|
31
|
+
"textrun-action": "0.3.1",
|
|
32
|
+
"textrun-extension": "0.3.1",
|
|
33
|
+
"textrun-workspace": "0.3.1",
|
|
34
34
|
"tsx": "4.19.3"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "8aa3f5d9fbf24776eae6516b96ebde4863ad33a2"
|
|
37
37
|
}
|