textrun-shell 0.6.0 → 0.7.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/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ SPDX-License-Identifier: ISC
2
+
3
+ Copyright 2026 Kevin Goslar
4
+
5
+ Permission to use, copy, modify, and/or distribute this software
6
+ for any purpose with or without fee is hereby granted,
7
+ provided that the above copyright notice
8
+ and this permission notice appear in all copies.
9
+
10
+ THE SOFTWARE IS PROVIDED “AS IS”
11
+ AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
+ WITH REGARD TO THIS SOFTWARE
13
+ INCLUDING ALL IMPLIED WARRANTIES
14
+ OF MERCHANTABILITY AND FITNESS.
15
+
16
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE
17
+ FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
18
+ OR ANY DAMAGES WHATSOEVER
19
+ RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20
+ WHETHER IN AN ACTION OF CONTRACT,
21
+ NEGLIGENCE OR OTHER TORTIOUS ACTION,
22
+ ARISING OUT OF OR IN CONNECTION WITH
23
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  import * as assertNoDiff from "assert-no-diff";
2
2
  import stripAnsi from "strip-ansi";
3
- import { CurrentCommand } from "../helpers/current-command.js";
3
+ import * as currentCommand from "../helpers/current-command.js";
4
4
  export function commandOutput(action) {
5
5
  action.name("verifying the output of the last run console command");
6
6
  const expectedText = action.region.text();
@@ -8,7 +8,7 @@ export function commandOutput(action) {
8
8
  .split("\n")
9
9
  .map((line) => line.trim())
10
10
  .filter((line) => line);
11
- const actualOutput = stripAnsi(CurrentCommand.instance().combinedText);
11
+ const actualOutput = stripAnsi(currentCommand.instance().combinedText);
12
12
  const actualLines = actualOutput
13
13
  .split("\n")
14
14
  .map(line => line.trim())
@@ -2,14 +2,14 @@ import { styleText } from "node:util";
2
2
  import * as observableProcess from "observable-process";
3
3
  import { callArgs } from "textrun-extension";
4
4
  import { Configuration } from "../helpers/configuration.js";
5
- import { CurrentCommand } from "../helpers/current-command.js";
5
+ import * as currentCommand from "../helpers/current-command.js";
6
6
  import { parseCommand } from "../helpers/parse-command.js";
7
7
  /**
8
8
  * The "runConsoleCommand" action runs the given commands on the console
9
9
  * and waits until the command is finished.
10
10
  */
11
11
  export async function commandWithInput(action) {
12
- var commandText = action.region[0].attributes["command"];
12
+ var commandText = action.region[0].attributes.command;
13
13
  if (commandText === "") {
14
14
  throw new Error('empty "command" attribute');
15
15
  }
@@ -35,11 +35,11 @@ export async function commandWithInput(action) {
35
35
  await enter(processor, inputLine);
36
36
  }
37
37
  const finished = (await processor.waitForEnd());
38
- CurrentCommand.set(finished);
38
+ currentCommand.set(finished);
39
39
  action.log(processor.output.fullText());
40
40
  }
41
41
  async function enter(processor, input) {
42
- processor.stdin.write(input.input + "\n");
42
+ processor.stdin.write(`${input.input}\n`);
43
43
  if (input.textToWait) {
44
44
  await processor.stdout.waitForText(input.textToWait);
45
45
  }
@@ -2,14 +2,14 @@ import { styleText } from "node:util";
2
2
  import * as observableProcess from "observable-process";
3
3
  import * as trExt from "textrun-extension";
4
4
  import { Configuration } from "../helpers/configuration.js";
5
- import { CurrentCommand } from "../helpers/current-command.js";
5
+ import * as currentCommand from "../helpers/current-command.js";
6
6
  import { parseCommand } from "../helpers/parse-command.js";
7
7
  /** Runs the given commands synchronously on the console. */
8
8
  export async function command(action) {
9
9
  action.name("run shell command");
10
10
  const configPath = action.configuration.sourceDir.joinStr("textrun-shell.js");
11
11
  const config = await Configuration.load(configPath);
12
- var commandText = action.region[0].attributes["command"];
12
+ var commandText = action.region[0].attributes.command;
13
13
  if (commandText === "") {
14
14
  throw new Error('empty "command" attribute');
15
15
  }
@@ -28,7 +28,7 @@ export async function command(action) {
28
28
  // this is also used in the "verify-run-console-output" step
29
29
  const finished = (await processor.waitForEnd());
30
30
  action.log(finished.combinedText);
31
- CurrentCommand.set(finished);
31
+ currentCommand.set(finished);
32
32
  if (finished.exitCode !== 0 && !allowError) {
33
33
  throw new Error(`command "${commandsToRun}" failed with exit code ${finished.exitCode}`);
34
34
  }
@@ -11,7 +11,7 @@ import { parseCommand } from "../helpers/parse-command.js";
11
11
  export async function server(action) {
12
12
  const configPath = action.configuration.sourceDir.joinStr("textrun-shell.js");
13
13
  const config = await Configuration.load(configPath);
14
- var commandText = action.region[0].attributes["command"];
14
+ var commandText = action.region[0].attributes.command;
15
15
  if (commandText === "") {
16
16
  throw new Error('empty "command" attribute');
17
17
  }
@@ -19,7 +19,7 @@ export class Configuration {
19
19
  const config = content.default;
20
20
  return new Configuration(config);
21
21
  }
22
- catch (e) {
22
+ catch (_e) {
23
23
  debug(`found no path mapping in ${filePath}`);
24
24
  return Configuration.default();
25
25
  }
@@ -1,14 +1,12 @@
1
1
  /** CurrentCommand provides global access to the currently running console command. */
2
- export class CurrentCommand {
3
- static instance() {
4
- if (!instance) {
5
- throw new Error("no instance");
6
- }
7
- return instance;
8
- }
9
- static set(process) {
10
- instance = process;
2
+ export function instance() {
3
+ if (!_instance) {
4
+ throw new Error("no instance");
11
5
  }
6
+ return _instance;
7
+ }
8
+ export function set(process) {
9
+ _instance = process;
12
10
  }
13
- let instance = null;
11
+ let _instance = null;
14
12
  //# sourceMappingURL=current-command.js.map
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
+ import { command } from "./actions/command.js";
1
2
  import { commandOutput } from "./actions/command-output.js";
2
3
  import { commandWithInput } from "./actions/command-with-input.js";
3
- import { command } from "./actions/command.js";
4
- import { serverOutput } from "./actions/server-output.js";
5
4
  import { server } from "./actions/server.js";
5
+ import { serverOutput } from "./actions/server-output.js";
6
6
  import { stopServer } from "./actions/stop-server.js";
7
7
  export const textrunActions = {
8
8
  command,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textrun-shell",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -11,27 +11,27 @@
11
11
  "build": "tsc -p tsconfig-build.json",
12
12
  "cuke": "cucumber-js --format=progress",
13
13
  "doc": "text-runner",
14
- "fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet && ../tools/rta ghokin fmt replace features",
15
- "lint": "dprint check && sort-package-json --check --quiet && eslint --ignore-pattern=dist/ . && depcheck --config=../.depcheckrc",
14
+ "fix": "biome check --write --unsafe && dprint fmt && sort-package-json --quiet && ../tools/rta ghokin fmt replace features",
15
+ "lint": "biome check --error-on-warnings && dprint check && sort-package-json --check --quiet && depcheck --config=../.depcheckrc",
16
16
  "reset": "rm -rf dist && yarn run build",
17
17
  "unit": "node --test --import tsx 'src/**/*.test.ts'"
18
18
  },
19
19
  "dependencies": {
20
20
  "assert-no-diff": "4.1.0",
21
21
  "debug": "4.4.3",
22
- "end-child-processes": "2.0.3",
22
+ "end-child-processes": "2.0.4",
23
23
  "observable-process": "8.0.0",
24
24
  "strip-ansi": "7.1.2",
25
- "text-runner-engine": "7.4.0",
26
- "textrun-extension": "0.6.0"
25
+ "text-runner-engine": "7.5.1",
26
+ "textrun-extension": "0.7.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "shared-cucumber-steps": "*",
30
- "text-runner": "7.4.0",
31
- "textrun-action": "0.6.0",
32
- "textrun-extension": "0.6.0",
33
- "textrun-workspace": "0.6.0",
34
- "tsx": "4.20.6"
30
+ "text-runner": "7.5.1",
31
+ "textrun-action": "0.7.1",
32
+ "textrun-extension": "0.7.1",
33
+ "textrun-workspace": "0.7.1",
34
+ "tsx": "4.21.0"
35
35
  },
36
- "gitHead": "a173b524f1afa311e27fa7aa847acc2ddf6b1cbb"
36
+ "gitHead": "ffa7b993386ef88d6f199373e97d9c39e3ea3ac4"
37
37
  }