textrun-shell 0.2.1 → 0.3.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/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> or <code type="npm/install">yarn i -D
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-run": path.join(__dirname, "node_modules", ".bin", "text-run"),
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
- $ echo Hello world!
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
- $ node greeter.js
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
- $ node server.js
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({ textToWait: null, input: text });
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
  }
@@ -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());
@@ -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 { server } from "./actions/server.js";
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
- stopServer,
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.2.1",
3
+ "version": "0.3.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -11,10 +11,10 @@
11
11
  "build": "tsc -p tsconfig-build.json",
12
12
  "clean": "rm -rf dist",
13
13
  "cuke": "cucumber-js --format=progress",
14
- "doc": "text-run static --format=summary && text-run dynamic --format=progress",
15
- "fix": "eslint --fix --ignore-pattern=dist/ . && prettier --write .",
16
- "lint": "prettier -l . && eslint --ignore-pattern=dist/ . && depcheck --config=../.depcheckrc",
17
- "unit": "env NODE_NO_WARNINGS=1 mocha --reporter=dot 'src/**/*.test.ts'"
14
+ "doc": "text-runner",
15
+ "fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet",
16
+ "lint": "dprint check && sort-package-json --check --quiet && eslint --ignore-pattern=dist/ . && depcheck --config=../.depcheckrc",
17
+ "unit": "node --test --import tsx 'src/**/*.test.ts'"
18
18
  },
19
19
  "dependencies": {
20
20
  "assert-no-diff": "3.0.6",
@@ -22,16 +22,16 @@
22
22
  "end-child-processes": "1.0.3",
23
23
  "observable-process": "8.0.0-pre4",
24
24
  "strip-ansi": "7.1.0",
25
- "text-runner-core": "6.0.1",
26
- "textrun-extension": "0.2.1"
25
+ "text-runner-engine": "7.1.0",
26
+ "textrun-extension": "0.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "shared-cucumber-steps": "*",
30
- "text-runner": "6.0.1",
31
- "textrun-action": "0.2.1",
32
- "textrun-extension": "0.2.1",
33
- "textrun-workspace": "0.2.1",
30
+ "text-runner": "7.1.0",
31
+ "textrun-action": "0.3.0",
32
+ "textrun-extension": "0.3.0",
33
+ "textrun-workspace": "0.3.0",
34
34
  "tsx": "4.19.3"
35
35
  },
36
- "gitHead": "e479ff08fba71c7b2f6d1e3e14001b7818a38e12"
36
+ "gitHead": "bdf119a8e549f679af14f88952f7353648b50759"
37
37
  }