@tui-sandbox/library 11.5.0 → 11.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-sandbox/library",
3
- "version": "11.5.0",
3
+ "version": "11.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mikavilpas/tui-sandbox"
@@ -17,6 +17,7 @@
17
17
  "@xterm/addon-fit": "0.10.0",
18
18
  "@xterm/addon-unicode11": "0.8.0",
19
19
  "@xterm/xterm": "5.5.0",
20
+ "concurrently": "9.2.0",
20
21
  "cors": "2.8.5",
21
22
  "cypress": "14.5.3",
22
23
  "dree": "5.1.5",
@@ -0,0 +1,35 @@
1
+ import concurrently from "concurrently"
2
+ import { debuglog } from "util"
3
+
4
+ const log = debuglog("tui-sandbox.commandRunOnce")
5
+
6
+ export async function commandRunOnce(): Promise<void> {
7
+ const job = concurrently(
8
+ [
9
+ {
10
+ name: "server",
11
+ command: "tui start",
12
+ prefixColor: "blue",
13
+ },
14
+ {
15
+ name: "cypress",
16
+ command: `'wait-on --timeout 60000 http-get://127.0.0.1:3000/ping && pnpm exec cypress run --config baseUrl=http://127.0.0.1:3000 --quiet'`,
17
+ prefixColor: "yellow",
18
+ },
19
+ ],
20
+ {
21
+ killOthersOn: ["failure", "success"],
22
+ padPrefix: true, // makes all the prefixes the same length
23
+ successCondition: "command-cypress", // the test run that determines success/failure
24
+ }
25
+ )
26
+
27
+ await job.result.then(
28
+ _ => {
29
+ log("All commands completed successfully")
30
+ },
31
+ (err: unknown) => {
32
+ log("One or more commands failed. Debug info follows.", err)
33
+ }
34
+ )
35
+ }
@@ -21,3 +21,8 @@ it(`can parse "start"`, async () => {
21
21
  expect(await parseArguments(["start"])).toEqual({ action: "start" })
22
22
  expect(await parseArguments(["start", "foo"])).toBeUndefined()
23
23
  })
24
+
25
+ it(`can parse "run"`, async () => {
26
+ expect(await parseArguments(["run"])).toEqual({ action: "run" })
27
+ expect(await parseArguments(["run", "foo"])).toBeUndefined()
28
+ })
@@ -37,9 +37,20 @@ export const parseArguments = async (args: string[]): Promise<ParseArgumentsResu
37
37
  }
38
38
  }
39
39
  }
40
+
41
+ {
42
+ // tui start
43
+ const schema = z.tuple([z.literal("run")])
44
+ const result = schema.safeParse(args)
45
+ if (result.success) {
46
+ return {
47
+ action: "run",
48
+ }
49
+ }
50
+ }
40
51
  }
41
52
 
42
- export type ParseArgumentsResult = NeovimPrepare | NeovimExec | TuiStart
53
+ export type ParseArgumentsResult = NeovimPrepare | NeovimExec | TuiStart | TuiRunOnce
43
54
 
44
55
  export type NeovimExec = {
45
56
  action: "neovim exec"
@@ -53,3 +64,7 @@ export type NeovimPrepare = {
53
64
  export type TuiStart = {
54
65
  action: "start"
55
66
  }
67
+
68
+ export type TuiRunOnce = {
69
+ action: "run"
70
+ }
@@ -1,5 +1,6 @@
1
1
  import path from "node:path"
2
2
  import type { TestServerConfig } from "../server/index.js"
3
+ import { commandRunOnce } from "./commands/commandRunOnce.js"
3
4
  import { commandTuiNeovimExec } from "./commands/commandTuiNeovimExec.js"
4
5
  import { commandTuiNeovimPrepare } from "./commands/commandTuiNeovimPrepare.js"
5
6
  import { commandTuiStart } from "./commands/commandTuiStart.js"
@@ -40,6 +41,10 @@ switch (command?.action) {
40
41
  await commandTuiStart()
41
42
  break
42
43
  }
44
+ case "run": {
45
+ await commandRunOnce()
46
+ break
47
+ }
43
48
  default: {
44
49
  command satisfies undefined
45
50
  showUsageAndExit()