@tui-sandbox/library 11.9.1 → 11.10.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/browser/assets/{index-BOBslGJV.js → index-DCtcQK5s.js} +2 -2
  3. package/dist/browser/index.html +1 -1
  4. package/dist/src/client/neovim-terminal-client.js +1 -1
  5. package/dist/src/client/neovim-terminal-client.js.map +1 -1
  6. package/dist/src/scripts/resolveConfig.test.js +1 -0
  7. package/dist/src/scripts/resolveConfig.test.js.map +1 -1
  8. package/dist/src/server/applications/neovim/environment/createTempDir.js +20 -2
  9. package/dist/src/server/applications/neovim/environment/createTempDir.js.map +1 -1
  10. package/dist/src/server/applications/neovim/environment/createTempDir.test.js +1 -0
  11. package/dist/src/server/applications/neovim/environment/createTempDir.test.js.map +1 -1
  12. package/dist/src/server/applications/neovim/neovimRouter.d.ts +1 -9
  13. package/dist/src/server/applications/neovim/neovimRouter.js +0 -3
  14. package/dist/src/server/applications/neovim/neovimRouter.js.map +1 -1
  15. package/dist/src/server/applications/neovim/prepareNewTestDirectory.test.js +1 -0
  16. package/dist/src/server/applications/neovim/prepareNewTestDirectory.test.js.map +1 -1
  17. package/dist/src/server/applications/terminal/terminalRouter.d.ts +1 -0
  18. package/dist/src/server/config.js +1 -0
  19. package/dist/src/server/config.js.map +1 -1
  20. package/dist/src/server/server.d.ts +2 -9
  21. package/dist/src/server/types.d.ts +2 -0
  22. package/dist/src/server/types.js +1 -0
  23. package/dist/src/server/types.js.map +1 -1
  24. package/dist/src/server/updateTestdirectorySchemaFile.d.ts +1 -0
  25. package/dist/src/server/updateTestdirectorySchemaFile.js +1 -0
  26. package/dist/src/server/updateTestdirectorySchemaFile.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +9 -9
  29. package/src/client/neovim-terminal-client.ts +1 -1
  30. package/src/scripts/resolveConfig.test.ts +1 -0
  31. package/src/server/applications/neovim/environment/createTempDir.test.ts +1 -0
  32. package/src/server/applications/neovim/environment/createTempDir.ts +26 -2
  33. package/src/server/applications/neovim/neovimRouter.ts +1 -4
  34. package/src/server/applications/neovim/prepareNewTestDirectory.test.ts +1 -0
  35. package/src/server/config.ts +1 -0
  36. package/src/server/types.ts +3 -0
  37. package/src/server/updateTestdirectorySchemaFile.ts +1 -0
  38. package/vite.config.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-sandbox/library",
3
- "version": "11.9.1",
3
+ "version": "11.10.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mikavilpas/tui-sandbox"
@@ -12,8 +12,8 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@catppuccin/palette": "1.7.1",
15
- "@trpc/client": "11.6.0",
16
- "@trpc/server": "11.6.0",
15
+ "@trpc/client": "11.7.0",
16
+ "@trpc/server": "11.7.0",
17
17
  "@xterm/addon-fit": "0.10.0",
18
18
  "@xterm/addon-unicode11": "0.8.0",
19
19
  "@xterm/xterm": "5.5.0",
@@ -31,13 +31,13 @@
31
31
  "devDependencies": {
32
32
  "@types/command-exists": "1.2.3",
33
33
  "@types/cors": "2.8.19",
34
- "@types/express": "5.0.3",
35
- "@types/node": "24.7.1",
36
- "cypress": "15.4.0",
34
+ "@types/express": "5.0.4",
35
+ "@types/node": "24.9.1",
36
+ "cypress": "15.5.0",
37
37
  "nodemon": "3.1.10",
38
- "type-fest": "5.0.1",
39
- "vite": "7.1.9",
40
- "vitest": "3.2.4"
38
+ "type-fest": "5.1.0",
39
+ "vite": "7.1.12",
40
+ "vitest": "4.0.3"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "cypress": "^13 || ^14 || ^15",
@@ -62,7 +62,7 @@ export class NeovimTerminalClient {
62
62
  // time to complete
63
63
  this.ready = new Promise<void>(resolve => {
64
64
  console.log("Subscribing to stdout")
65
- trpc.neovim.initializeStdout.subscribe(
65
+ trpc.neovim.onStdout.subscribe(
66
66
  { client: tabId },
67
67
  {
68
68
  onStarted() {
@@ -22,6 +22,7 @@ it("loads a custom configuration file if it exists", async () => {
22
22
  directories: {
23
23
  testEnvironmentPath: "./test-environment2/",
24
24
  outputFilePath: "./output.ts",
25
+ latestSymlinkName: "latest",
25
26
  },
26
27
  integrations: { neovim: { NVIM_APPNAMEs: ["nvim", "nvim_2"] } },
27
28
  port: 12345,
@@ -18,6 +18,7 @@ it("should create a temp dir with no contents", async () => {
18
18
  directories: {
19
19
  testEnvironmentPath: dir.path,
20
20
  outputFilePath: nodePath.join(dir.path, "MyTestDirectory.ts"),
21
+ latestSymlinkName: "latest",
21
22
  },
22
23
  } satisfies PartialDeep<TestServerConfig>)
23
24
 
@@ -1,7 +1,7 @@
1
1
  import assert from "assert"
2
2
  import { execSync } from "child_process"
3
3
  import { constants, readdirSync, statSync } from "fs"
4
- import { access, mkdir, mkdtemp } from "fs/promises"
4
+ import { access, mkdir, mkdtemp, symlink } from "fs/promises"
5
5
  import path from "path"
6
6
  import { debuglog } from "util"
7
7
  import { convertDree, getDirectoryTree } from "../../../dirtree/index.js"
@@ -28,12 +28,16 @@ export async function createTempDir(config: TestServerConfig): Promise<TestDirec
28
28
  const tree = convertDree(getDirectoryTree(dir).dree)
29
29
  assert(tree.type === "directory")
30
30
 
31
- await updateTestdirectorySchemaFile(config)
31
+ const [_, latestEnvironmentSymlink] = await Promise.all([
32
+ updateTestdirectorySchemaFile(config),
33
+ createLatestSymlink(config, dir),
34
+ ])
32
35
  return {
33
36
  rootPathAbsolute: dir,
34
37
  contents: tree.contents,
35
38
  testEnvironmentPath: config.directories.testEnvironmentPath,
36
39
  testEnvironmentPathRelative: path.relative(config.directories.testEnvironmentPath, dir),
40
+ latestEnvironmentSymlink,
37
41
  }
38
42
  } catch (err) {
39
43
  console.error(err)
@@ -56,6 +60,26 @@ async function createUniqueDirectory(testEnvironmentPath: string): Promise<strin
56
60
  return dir
57
61
  }
58
62
 
63
+ async function createLatestSymlink(config: TestServerConfig, uniqueTestDirectory: string): Promise<string> {
64
+ const latestSymlinkPath = path.join(
65
+ config.directories.testEnvironmentPath,
66
+ "testdirs" satisfies TestDirsPath,
67
+ config.directories.latestSymlinkName
68
+ )
69
+ try {
70
+ await access(latestSymlinkPath, constants.F_OK)
71
+ // If it already exists, remove it
72
+ execSync(`rm -f '${latestSymlinkPath}'`)
73
+ } catch {
74
+ // It doesn't exist, that's fine
75
+ }
76
+
77
+ // recreate it
78
+ await symlink(uniqueTestDirectory, latestSymlinkPath, "junction")
79
+
80
+ return latestSymlinkPath
81
+ }
82
+
59
83
  export async function removeTestDirectories(testEnvironmentPath: string): Promise<void> {
60
84
  try {
61
85
  const testdirs = path.join(testEnvironmentPath, "testdirs" satisfies TestDirsPath)
@@ -72,11 +72,8 @@ export function createNeovimRouter(config: TestServerConfig) {
72
72
  config
73
73
  )
74
74
  }),
75
- onStdout: trpc.procedure.input(z.object({ client: tabIdSchema })).subscription(options => {
76
- return neovim.initializeStdout(options.input, options.signal, config.directories.testEnvironmentPath)
77
- }),
78
75
 
79
- initializeStdout: trpc.procedure.input(z.object({ client: tabIdSchema })).subscription(options => {
76
+ onStdout: trpc.procedure.input(z.object({ client: tabIdSchema })).subscription(options => {
80
77
  return neovim.initializeStdout(options.input, options.signal, config.directories.testEnvironmentPath)
81
78
  }),
82
79
  sendStdin: trpc.procedure.input(z.object({ tabId: tabIdSchema, data: z.string() })).mutation(options => {
@@ -16,6 +16,7 @@ describe("prepareNewTestDirectory when the testEnvironmentPath does not exist",
16
16
  directories: {
17
17
  outputFilePath: path.join(testEnvironmentPath, "foo.ts"),
18
18
  testEnvironmentPath,
19
+ latestSymlinkName: "latest",
19
20
  },
20
21
  } satisfies PartialDeep<TestServerConfig>)
21
22
 
@@ -6,6 +6,7 @@ export const createDefaultConfig = (cwd: string, environment: NodeJS.ProcessEnv)
6
6
  directories: {
7
7
  testEnvironmentPath: path.join(cwd, "test-environment/"),
8
8
  outputFilePath: path.join(cwd, "MyTestDirectory.ts"),
9
+ latestSymlinkName: "latest",
9
10
  },
10
11
  port: environment["PORT"] ? parseInt(environment["PORT"]) : 3000,
11
12
  integrations: {
@@ -29,6 +29,8 @@ export type TestDirectory<TContents extends Record<string, unknown> = Record<str
29
29
  */
30
30
  testEnvironmentPathRelative: string
31
31
 
32
+ latestEnvironmentSymlink: string
33
+
32
34
  contents: TContents
33
35
  }
34
36
 
@@ -36,6 +38,7 @@ export const serverTestDirectorySchema = z.object({
36
38
  rootPathAbsolute: z.string(),
37
39
  testEnvironmentPath: z.string(),
38
40
  testEnvironmentPathRelative: z.string(),
41
+ latestEnvironmentSymlink: z.string(),
39
42
  contents: z.record(z.string(), z.unknown()),
40
43
  })
41
44
  export type ServerTestDirectory = z.infer<typeof serverTestDirectorySchema>
@@ -37,6 +37,7 @@ export const testServerConfigSchema = z.strictObject({
37
37
  directories: z.object({
38
38
  testEnvironmentPath: z.string(),
39
39
  outputFilePath: z.string(),
40
+ latestSymlinkName: z.string().optional().default("latest"),
40
41
  }),
41
42
  port: z.number().int().min(1).max(65535),
42
43
  integrations: z.strictObject({
package/vite.config.js CHANGED
@@ -19,6 +19,7 @@ export default defineConfig({
19
19
  outDir: "./dist/browser/",
20
20
  },
21
21
  test: {
22
+ exclude: ["node_modules", "dist"],
22
23
  globals: true, // This will make describe, it, etc. available globally
23
24
  environment: "node",
24
25
  mockReset: true,