@tui-sandbox/library 11.5.0 → 11.6.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/CHANGELOG.md +14 -0
- package/dist/browser/assets/{index-BIcK2_KN.js → index-BYVmuU8p.js} +1 -1
- package/dist/browser/index.html +1 -1
- package/dist/src/scripts/commands/commandRun.d.ts +1 -0
- package/dist/src/scripts/commands/commandRun.js +27 -0
- package/dist/src/scripts/commands/commandRun.js.map +1 -0
- package/dist/src/scripts/parseArguments.d.ts +4 -1
- package/dist/src/scripts/parseArguments.js +10 -0
- package/dist/src/scripts/parseArguments.js.map +1 -1
- package/dist/src/scripts/parseArguments.test.js +4 -0
- package/dist/src/scripts/parseArguments.test.js.map +1 -1
- package/dist/src/scripts/tui.js +13 -0
- package/dist/src/scripts/tui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/scripts/commands/commandRun.ts +35 -0
- package/src/scripts/parseArguments.test.ts +5 -0
- package/src/scripts/parseArguments.ts +16 -1
- package/src/scripts/tui.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tui-sandbox/library",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.1",
|
|
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",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"prettier": "3.6.2",
|
|
27
28
|
"type-fest": "4.41.0",
|
|
28
29
|
"winston": "3.17.0",
|
|
29
|
-
"zod": "4.0.
|
|
30
|
+
"zod": "4.0.15"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/command-exists": "1.2.3",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import concurrently from "concurrently"
|
|
2
|
+
import { debuglog } from "util"
|
|
3
|
+
|
|
4
|
+
const log = debuglog("tui-sandbox.commandRun")
|
|
5
|
+
|
|
6
|
+
export async function commandRun(): 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
|
+
}
|
package/src/scripts/tui.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import assert from "node:assert"
|
|
1
2
|
import path from "node:path"
|
|
2
3
|
import type { TestServerConfig } from "../server/index.js"
|
|
4
|
+
import { commandRun } from "./commands/commandRun.js"
|
|
3
5
|
import { commandTuiNeovimExec } from "./commands/commandTuiNeovimExec.js"
|
|
4
6
|
import { commandTuiNeovimPrepare } from "./commands/commandTuiNeovimPrepare.js"
|
|
5
7
|
import { commandTuiStart } from "./commands/commandTuiStart.js"
|
|
@@ -9,6 +11,15 @@ import { parseArguments } from "./parseArguments.js"
|
|
|
9
11
|
// This is the main entrypoint to tui-sandbox
|
|
10
12
|
//
|
|
11
13
|
|
|
14
|
+
const [major] = process.versions.node.split(".").map(Number)
|
|
15
|
+
assert(major)
|
|
16
|
+
assert(!isNaN(major))
|
|
17
|
+
|
|
18
|
+
if (major < 24) {
|
|
19
|
+
console.error(`tui-sandbox error: Node.js >= 24.0.0 is required. You are using ${process.version}.`)
|
|
20
|
+
process.exit(1)
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
const outputFileName = "MyTestDirectory.ts"
|
|
13
24
|
|
|
14
25
|
/** The cwd in the user's directory when they are running this script. Not the
|
|
@@ -40,6 +51,10 @@ switch (command?.action) {
|
|
|
40
51
|
await commandTuiStart()
|
|
41
52
|
break
|
|
42
53
|
}
|
|
54
|
+
case "run": {
|
|
55
|
+
await commandRun()
|
|
56
|
+
break
|
|
57
|
+
}
|
|
43
58
|
default: {
|
|
44
59
|
command satisfies undefined
|
|
45
60
|
showUsageAndExit()
|