vde-layout 0.1.1 → 1.0.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
@@ -15,8 +15,18 @@ vde-layout is a CLI that reproduces terminal layouts (tmux or WezTerm) from YAML
15
15
  npm install -g vde-layout
16
16
  # or
17
17
  pnpm add -g vde-layout
18
- # or
19
- bun add -g vde-layout
18
+ ```
19
+
20
+ ## Development
21
+ ```bash
22
+ pnpm install
23
+ pnpm run build
24
+ pnpm run format:check
25
+ pnpm run typecheck
26
+ pnpm run lint
27
+ pnpm run test
28
+ # run all checks in sequence
29
+ pnpm run ci
20
30
  ```
21
31
 
22
32
  ## Quick Start
@@ -92,6 +102,7 @@ presets:
92
102
  preset-key:
93
103
  name: "Display Name" # required
94
104
  description: "Summary" # optional
105
+ backend: wezterm # optional; "tmux" (default) or "wezterm"
95
106
  windowMode: new-window # optional; "new-window" (default) or "current-window"
96
107
  layout: # optional; omit for single command presets
97
108
  # see Layout Structure
package/bin/vde-layout CHANGED
@@ -1,10 +1,38 @@
1
1
  #!/usr/bin/env node
2
+
3
+ const isModuleNotFoundFor = (error, entryFile) => {
4
+ if (typeof error !== "object" || error === null) {
5
+ return false
6
+ }
7
+
8
+ const withMeta = /** @type {{ code?: string; url?: string; message?: string }} */ (error)
9
+ if (withMeta.code !== "ERR_MODULE_NOT_FOUND") {
10
+ return false
11
+ }
12
+
13
+ const expected = `dist/${entryFile}`
14
+ if (typeof withMeta.url === "string" && (withMeta.url.includes(expected) || withMeta.url.includes(`dist\\${entryFile}`))) {
15
+ return true
16
+ }
17
+
18
+ return typeof withMeta.message === "string" && withMeta.message.includes(expected)
19
+ }
20
+
2
21
  try {
3
- await import('../dist/index.js');
22
+ await import("../dist/index.mjs")
4
23
  } catch (error) {
5
- if (error && typeof error === 'object' && 'code' in error && error.code === 'ERR_MODULE_NOT_FOUND') {
6
- await import('../src/index.ts');
7
- } else {
8
- throw error;
24
+ if (!isModuleNotFoundFor(error, "index.mjs")) {
25
+ throw error
26
+ }
27
+
28
+ try {
29
+ await import("../dist/index.js")
30
+ } catch (fallbackError) {
31
+ if (isModuleNotFoundFor(fallbackError, "index.js")) {
32
+ console.error('Failed to load vde-layout entrypoint from dist. Run "pnpm run build" and try again.')
33
+ process.exit(1)
34
+ }
35
+
36
+ throw fallbackError
9
37
  }
10
38
  }
@@ -0,0 +1 @@
1
+ export { };