@reventlessdev/reventless-seed 1.0.0-alpha.5 → 1.0.0-alpha.6
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 +8 -0
- package/lib/bs/.compiler.log +2 -2
- package/lib/bs/.sourcedirs.json +1 -1
- package/lib/bs/compiler-info.json +2 -2
- package/lib/bs/src/Seed-ReventlessSeed.cmi +0 -0
- package/lib/bs/src/Seed-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Client-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Connect-ReventlessSeed.cmi +0 -0
- package/lib/bs/src/Seed_Connect-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Prompt-ReventlessSeed.cmi +0 -0
- package/lib/bs/src/Seed_Prompt-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Prompt.ast +0 -0
- package/lib/bs/src/Seed_Prompt.res +10 -20
- package/lib/bs/src/Seed_Prompt.res.mjs +1 -1
- package/lib/bs/src/Seed_Random-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Runner-ReventlessSeed.cmi +0 -0
- package/lib/bs/src/Seed_Runner-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Runner.ast +0 -0
- package/lib/bs/src/Seed_Runner.res +5 -7
- package/lib/bs/src/Seed_Types-ReventlessSeed.cmt +0 -0
- package/lib/bs/src/Seed_Upload-ReventlessSeed.cmi +0 -0
- package/lib/bs/src/Seed_Upload-ReventlessSeed.cmt +0 -0
- package/lib/bs/tests/UploadEndpointResolutionTest-ReventlessSeed.cmi +0 -0
- package/lib/bs/tests/UploadEndpointResolutionTest-ReventlessSeed.cmt +0 -0
- package/lib/bs/tests/UploadEndpointResolutionTest.ast +0 -0
- package/lib/bs/tests/UploadEndpointResolutionTest.res +2 -3
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/Seed-ReventlessSeed.cmi +0 -0
- package/lib/ocaml/Seed-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Client-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Connect-ReventlessSeed.cmi +0 -0
- package/lib/ocaml/Seed_Connect-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Prompt-ReventlessSeed.cmi +0 -0
- package/lib/ocaml/Seed_Prompt-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Prompt.ast +0 -0
- package/lib/ocaml/Seed_Prompt.res +10 -20
- package/lib/ocaml/Seed_Random-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Runner-ReventlessSeed.cmi +0 -0
- package/lib/ocaml/Seed_Runner-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Runner.ast +0 -0
- package/lib/ocaml/Seed_Runner.res +5 -7
- package/lib/ocaml/Seed_Types-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/Seed_Upload-ReventlessSeed.cmi +0 -0
- package/lib/ocaml/Seed_Upload-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/UploadEndpointResolutionTest-ReventlessSeed.cmi +0 -0
- package/lib/ocaml/UploadEndpointResolutionTest-ReventlessSeed.cmt +0 -0
- package/lib/ocaml/UploadEndpointResolutionTest.ast +0 -0
- package/lib/ocaml/UploadEndpointResolutionTest.res +2 -3
- package/package.json +5 -2
- package/rescript.json +1 -0
- package/src/Seed_Prompt.res +10 -20
- package/src/Seed_Prompt.res.mjs +1 -1
- package/src/Seed_Runner.res +5 -7
- package/tests/UploadEndpointResolutionTest.res +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.0.0-alpha.6 (2026-07-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @reventlessdev/reventless-seed
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# 1.0.0-alpha.5 (2026-07-31)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/lib/bs/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1785535393042)
|
|
2
|
+
#Done(1785535393072)
|
package/lib/bs/.sourcedirs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"cmt_scan":[{"also_scan_build_root":true,"build_root":"lib/bs","scan_dirs":["src","tests"]}],"dirs":["src","tests"],"generated":[],"pkgs":[["@reventlessdev/rescript-jest","/home/runner/work/reventless-core/reventless-core/rescript/jest"]],"version":2}
|
|
1
|
+
{"cmt_scan":[{"also_scan_build_root":true,"build_root":"lib/bs","scan_dirs":["src","tests"]}],"dirs":["src","tests"],"generated":[],"pkgs":[["@reventlessdev/rescript-jest","/home/runner/work/reventless-core/reventless-core/rescript/jest"],["@reventlessdev/rescript-node","/home/runner/work/reventless-core/reventless-core/rescript/node"]],"version":2}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "12.3.0",
|
|
3
3
|
"bsc_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/linux-x64/bin/bsc.exe",
|
|
4
4
|
"bsc_hash": "75e3a59c95cc953608fd3dd6ea6ed68141bba4414a20a52f114261b8a48385fa",
|
|
5
|
-
"rescript_config_hash": "
|
|
5
|
+
"rescript_config_hash": "25cfff836d200084949fdfdfec2f6875901bfee1f04d84634eca252ef1ca1ef1",
|
|
6
6
|
"runtime_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/runtime",
|
|
7
|
-
"generated_at": "
|
|
7
|
+
"generated_at": "1785535393075"
|
|
8
8
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// One shared readline interface for every interactive prompt in a seed run.
|
|
2
2
|
//
|
|
3
3
|
// The reason this module exists: creating and closing a fresh `readline`
|
|
4
|
-
// interface per prompt leaves stdin paused after the first `close`, so the
|
|
4
|
+
// interface per prompt leaves NodeProcess.stdin paused after the first `close`, so the
|
|
5
5
|
// second prompt (password after username) never fires and the run hangs. A
|
|
6
6
|
// single interface, created lazily and closed exactly once, avoids that — and a
|
|
7
7
|
// `muted` gate on its output lets password entry reuse the same interface
|
|
@@ -14,18 +14,8 @@ open Seed_Types
|
|
|
14
14
|
|
|
15
15
|
// ── Node bindings ─────────────────────────────────────────────────────────────
|
|
16
16
|
|
|
17
|
-
type stream
|
|
18
|
-
@val @scope("process") external stdin: stream = "stdin"
|
|
19
|
-
@val @scope("process") external stdout: stream = "stdout"
|
|
20
|
-
@send external writeStream: (stream, string) => unit = "write"
|
|
21
|
-
@get external isTTY: stream => bool = "isTTY"
|
|
22
|
-
@send external pauseStream: stream => unit = "pause"
|
|
23
|
-
@send external unrefStream: stream => unit = "unref"
|
|
24
|
-
|
|
25
|
-
@scope("process") @val external processEnv: dict<string> = "env"
|
|
26
|
-
|
|
27
17
|
type rl
|
|
28
|
-
type rlOptions = {input: stream, output: stream, terminal?: bool}
|
|
18
|
+
type rlOptions = {input: NodeProcess.stream, output: NodeProcess.stream, terminal?: bool}
|
|
29
19
|
@module("node:readline") external createInterface: rlOptions => rl = "createInterface"
|
|
30
20
|
@send external question: (rl, string, string => unit) => unit = "question"
|
|
31
21
|
@send external closeRl: rl => unit = "close"
|
|
@@ -42,10 +32,10 @@ let iface = (): rl =>
|
|
|
42
32
|
switch rlRef.contents {
|
|
43
33
|
| Some(rl) => rl
|
|
44
34
|
| None =>
|
|
45
|
-
let rl = createInterface({input: stdin, output: stdout, terminal: true})
|
|
35
|
+
let rl = createInterface({input: NodeProcess.stdin, output: NodeProcess.stdout, terminal: true})
|
|
46
36
|
rl->setWriteToOutput(s =>
|
|
47
37
|
if !muted.contents {
|
|
48
|
-
stdout->
|
|
38
|
+
NodeProcess.stdout->NodeProcess.write(s)
|
|
49
39
|
}
|
|
50
40
|
)
|
|
51
41
|
rlRef := Some(rl)
|
|
@@ -58,23 +48,23 @@ let close = (): unit =>
|
|
|
58
48
|
rl->closeRl
|
|
59
49
|
rlRef := None
|
|
60
50
|
// Closing the interface is not enough: a terminal-mode readline leaves
|
|
61
|
-
// stdin resumed and reffed, which keeps the event loop alive so the CLI
|
|
51
|
+
// NodeProcess.stdin resumed and reffed, which keeps the event loop alive so the CLI
|
|
62
52
|
// never exits after seeding. Release it explicitly.
|
|
63
|
-
stdin->
|
|
64
|
-
stdin->
|
|
53
|
+
NodeProcess.stdin->NodeProcess.pause
|
|
54
|
+
NodeProcess.stdin->NodeProcess.unref
|
|
65
55
|
| None => ()
|
|
66
56
|
}
|
|
67
57
|
|
|
68
58
|
// ── Env + TTY ─────────────────────────────────────────────────────────────────
|
|
69
59
|
|
|
70
60
|
let envValue = (key: string): option<string> =>
|
|
71
|
-
switch
|
|
61
|
+
switch NodeProcess.env->Dict.get(key) {
|
|
72
62
|
| Some(v) if v->String.trim != "" => Some(v->String.trim)
|
|
73
63
|
| _ => None
|
|
74
64
|
}
|
|
75
65
|
|
|
76
66
|
let requireTty = (): unit =>
|
|
77
|
-
if !(stdin->isTTY) {
|
|
67
|
+
if !(NodeProcess.stdin->NodeProcess.isTTY->Option.getOr(false)) {
|
|
78
68
|
throw(
|
|
79
69
|
Failed(
|
|
80
70
|
"no TTY for an interactive prompt — set the documented SEED_* / REVENTLESS_DEMO_* " ++
|
|
@@ -101,7 +91,7 @@ let askHidden = (query: string): promise<string> =>
|
|
|
101
91
|
let rl = iface()
|
|
102
92
|
rl->question(query, answer => {
|
|
103
93
|
muted := false
|
|
104
|
-
stdout->
|
|
94
|
+
NodeProcess.stdout->NodeProcess.write("\n")
|
|
105
95
|
resolve(answer)
|
|
106
96
|
})
|
|
107
97
|
muted := true
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
open Seed_Types
|
|
4
4
|
|
|
5
|
-
@scope("process") @val external exit: int => unit = "exit"
|
|
6
|
-
@scope("process") @val external env: dict<string> = "env"
|
|
7
5
|
|
|
8
6
|
let envOr = (key: string, fallback: string): string =>
|
|
9
|
-
env->Dict.get(key)->Option.getOr(fallback)
|
|
7
|
+
NodeProcess.env->Dict.get(key)->Option.getOr(fallback)
|
|
10
8
|
|
|
11
9
|
/** One line of progress per phase, so a slow run never looks hung. */
|
|
12
10
|
let report = (line: string): unit => Console.log(` ${line}`)
|
|
@@ -127,7 +125,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
127
125
|
// Exit cleanly: HTTP keep-alive sockets (and, on the interactive path, the
|
|
128
126
|
// readline/stdin handle) can otherwise keep the event loop alive so the CLI
|
|
129
127
|
// appears to hang after a successful run.
|
|
130
|
-
exit(0)
|
|
128
|
+
NodeProcess.exit(0)
|
|
131
129
|
} catch {
|
|
132
130
|
| Failed(message) =>
|
|
133
131
|
Console.error("")
|
|
@@ -135,7 +133,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
135
133
|
Console.error("fresh store once the cause below is fixed.")
|
|
136
134
|
Console.error("")
|
|
137
135
|
Console.error(message)
|
|
138
|
-
exit(1)
|
|
136
|
+
NodeProcess.exit(1)
|
|
139
137
|
| exn =>
|
|
140
138
|
Console.error("")
|
|
141
139
|
Console.error("Seeding aborted with an unexpected error:")
|
|
@@ -143,7 +141,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
143
141
|
Console.error(
|
|
144
142
|
exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown"),
|
|
145
143
|
)
|
|
146
|
-
exit(1)
|
|
144
|
+
NodeProcess.exit(1)
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
/**
|
|
@@ -172,7 +170,7 @@ let abortStartup = (message: string): unit => {
|
|
|
172
170
|
Console.error("Seeding did not start — nothing was written. Fix the cause below and re-run.")
|
|
173
171
|
Console.error("")
|
|
174
172
|
Console.error(message)
|
|
175
|
-
exit(1)
|
|
173
|
+
NodeProcess.exit(1)
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
/**
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
open JestGlobals
|
|
12
12
|
|
|
13
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
14
13
|
|
|
15
14
|
// `unresolvedReason` reads the knob, so the ambient environment has to be quiet.
|
|
16
|
-
let clearSkip = () =>
|
|
15
|
+
let clearSkip = () => NodeProcess.env->Dict.set("SEED_SKIP_UPLOADS", "")
|
|
17
16
|
|
|
18
17
|
let perStore = Dict.fromArray([
|
|
19
18
|
("Catalog.productImages", "https://catalog.example/"),
|
|
@@ -93,7 +92,7 @@ describe("Seed.Upload.unresolvedReason", () => {
|
|
|
93
92
|
})
|
|
94
93
|
|
|
95
94
|
testSync("the knob outranks both, so a skipped run is never read as a broken one", () => {
|
|
96
|
-
|
|
95
|
+
NodeProcess.env->Dict.set("SEED_SKIP_UPLOADS", "1")
|
|
97
96
|
expect(
|
|
98
97
|
Seed.Upload.unresolvedReason(~store="Catalog.productImages", ~uploadEndpoints=perStore),
|
|
99
98
|
)->toBe("SEED_SKIP_UPLOADS is set")
|
package/lib/ocaml/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1785535393042)
|
|
2
|
+
#Done(1785535393072)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// One shared readline interface for every interactive prompt in a seed run.
|
|
2
2
|
//
|
|
3
3
|
// The reason this module exists: creating and closing a fresh `readline`
|
|
4
|
-
// interface per prompt leaves stdin paused after the first `close`, so the
|
|
4
|
+
// interface per prompt leaves NodeProcess.stdin paused after the first `close`, so the
|
|
5
5
|
// second prompt (password after username) never fires and the run hangs. A
|
|
6
6
|
// single interface, created lazily and closed exactly once, avoids that — and a
|
|
7
7
|
// `muted` gate on its output lets password entry reuse the same interface
|
|
@@ -14,18 +14,8 @@ open Seed_Types
|
|
|
14
14
|
|
|
15
15
|
// ── Node bindings ─────────────────────────────────────────────────────────────
|
|
16
16
|
|
|
17
|
-
type stream
|
|
18
|
-
@val @scope("process") external stdin: stream = "stdin"
|
|
19
|
-
@val @scope("process") external stdout: stream = "stdout"
|
|
20
|
-
@send external writeStream: (stream, string) => unit = "write"
|
|
21
|
-
@get external isTTY: stream => bool = "isTTY"
|
|
22
|
-
@send external pauseStream: stream => unit = "pause"
|
|
23
|
-
@send external unrefStream: stream => unit = "unref"
|
|
24
|
-
|
|
25
|
-
@scope("process") @val external processEnv: dict<string> = "env"
|
|
26
|
-
|
|
27
17
|
type rl
|
|
28
|
-
type rlOptions = {input: stream, output: stream, terminal?: bool}
|
|
18
|
+
type rlOptions = {input: NodeProcess.stream, output: NodeProcess.stream, terminal?: bool}
|
|
29
19
|
@module("node:readline") external createInterface: rlOptions => rl = "createInterface"
|
|
30
20
|
@send external question: (rl, string, string => unit) => unit = "question"
|
|
31
21
|
@send external closeRl: rl => unit = "close"
|
|
@@ -42,10 +32,10 @@ let iface = (): rl =>
|
|
|
42
32
|
switch rlRef.contents {
|
|
43
33
|
| Some(rl) => rl
|
|
44
34
|
| None =>
|
|
45
|
-
let rl = createInterface({input: stdin, output: stdout, terminal: true})
|
|
35
|
+
let rl = createInterface({input: NodeProcess.stdin, output: NodeProcess.stdout, terminal: true})
|
|
46
36
|
rl->setWriteToOutput(s =>
|
|
47
37
|
if !muted.contents {
|
|
48
|
-
stdout->
|
|
38
|
+
NodeProcess.stdout->NodeProcess.write(s)
|
|
49
39
|
}
|
|
50
40
|
)
|
|
51
41
|
rlRef := Some(rl)
|
|
@@ -58,23 +48,23 @@ let close = (): unit =>
|
|
|
58
48
|
rl->closeRl
|
|
59
49
|
rlRef := None
|
|
60
50
|
// Closing the interface is not enough: a terminal-mode readline leaves
|
|
61
|
-
// stdin resumed and reffed, which keeps the event loop alive so the CLI
|
|
51
|
+
// NodeProcess.stdin resumed and reffed, which keeps the event loop alive so the CLI
|
|
62
52
|
// never exits after seeding. Release it explicitly.
|
|
63
|
-
stdin->
|
|
64
|
-
stdin->
|
|
53
|
+
NodeProcess.stdin->NodeProcess.pause
|
|
54
|
+
NodeProcess.stdin->NodeProcess.unref
|
|
65
55
|
| None => ()
|
|
66
56
|
}
|
|
67
57
|
|
|
68
58
|
// ── Env + TTY ─────────────────────────────────────────────────────────────────
|
|
69
59
|
|
|
70
60
|
let envValue = (key: string): option<string> =>
|
|
71
|
-
switch
|
|
61
|
+
switch NodeProcess.env->Dict.get(key) {
|
|
72
62
|
| Some(v) if v->String.trim != "" => Some(v->String.trim)
|
|
73
63
|
| _ => None
|
|
74
64
|
}
|
|
75
65
|
|
|
76
66
|
let requireTty = (): unit =>
|
|
77
|
-
if !(stdin->isTTY) {
|
|
67
|
+
if !(NodeProcess.stdin->NodeProcess.isTTY->Option.getOr(false)) {
|
|
78
68
|
throw(
|
|
79
69
|
Failed(
|
|
80
70
|
"no TTY for an interactive prompt — set the documented SEED_* / REVENTLESS_DEMO_* " ++
|
|
@@ -101,7 +91,7 @@ let askHidden = (query: string): promise<string> =>
|
|
|
101
91
|
let rl = iface()
|
|
102
92
|
rl->question(query, answer => {
|
|
103
93
|
muted := false
|
|
104
|
-
stdout->
|
|
94
|
+
NodeProcess.stdout->NodeProcess.write("\n")
|
|
105
95
|
resolve(answer)
|
|
106
96
|
})
|
|
107
97
|
muted := true
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
open Seed_Types
|
|
4
4
|
|
|
5
|
-
@scope("process") @val external exit: int => unit = "exit"
|
|
6
|
-
@scope("process") @val external env: dict<string> = "env"
|
|
7
5
|
|
|
8
6
|
let envOr = (key: string, fallback: string): string =>
|
|
9
|
-
env->Dict.get(key)->Option.getOr(fallback)
|
|
7
|
+
NodeProcess.env->Dict.get(key)->Option.getOr(fallback)
|
|
10
8
|
|
|
11
9
|
/** One line of progress per phase, so a slow run never looks hung. */
|
|
12
10
|
let report = (line: string): unit => Console.log(` ${line}`)
|
|
@@ -127,7 +125,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
127
125
|
// Exit cleanly: HTTP keep-alive sockets (and, on the interactive path, the
|
|
128
126
|
// readline/stdin handle) can otherwise keep the event loop alive so the CLI
|
|
129
127
|
// appears to hang after a successful run.
|
|
130
|
-
exit(0)
|
|
128
|
+
NodeProcess.exit(0)
|
|
131
129
|
} catch {
|
|
132
130
|
| Failed(message) =>
|
|
133
131
|
Console.error("")
|
|
@@ -135,7 +133,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
135
133
|
Console.error("fresh store once the cause below is fixed.")
|
|
136
134
|
Console.error("")
|
|
137
135
|
Console.error(message)
|
|
138
|
-
exit(1)
|
|
136
|
+
NodeProcess.exit(1)
|
|
139
137
|
| exn =>
|
|
140
138
|
Console.error("")
|
|
141
139
|
Console.error("Seeding aborted with an unexpected error:")
|
|
@@ -143,7 +141,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
143
141
|
Console.error(
|
|
144
142
|
exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown"),
|
|
145
143
|
)
|
|
146
|
-
exit(1)
|
|
144
|
+
NodeProcess.exit(1)
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
/**
|
|
@@ -172,7 +170,7 @@ let abortStartup = (message: string): unit => {
|
|
|
172
170
|
Console.error("Seeding did not start — nothing was written. Fix the cause below and re-run.")
|
|
173
171
|
Console.error("")
|
|
174
172
|
Console.error(message)
|
|
175
|
-
exit(1)
|
|
173
|
+
NodeProcess.exit(1)
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
/**
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
open JestGlobals
|
|
12
12
|
|
|
13
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
14
13
|
|
|
15
14
|
// `unresolvedReason` reads the knob, so the ambient environment has to be quiet.
|
|
16
|
-
let clearSkip = () =>
|
|
15
|
+
let clearSkip = () => NodeProcess.env->Dict.set("SEED_SKIP_UPLOADS", "")
|
|
17
16
|
|
|
18
17
|
let perStore = Dict.fromArray([
|
|
19
18
|
("Catalog.productImages", "https://catalog.example/"),
|
|
@@ -93,7 +92,7 @@ describe("Seed.Upload.unresolvedReason", () => {
|
|
|
93
92
|
})
|
|
94
93
|
|
|
95
94
|
testSync("the knob outranks both, so a skipped run is never read as a broken one", () => {
|
|
96
|
-
|
|
95
|
+
NodeProcess.env->Dict.set("SEED_SKIP_UPLOADS", "1")
|
|
97
96
|
expect(
|
|
98
97
|
Seed.Upload.unresolvedReason(~store="Catalog.productImages", ~uploadEndpoints=perStore),
|
|
99
98
|
)->toBe("SEED_SKIP_UPLOADS is set")
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-seed",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"description": "Reusable harness for seeding a Reventless platform through its public GraphQL command API",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.0"
|
|
8
|
+
},
|
|
6
9
|
"devDependencies": {
|
|
7
10
|
"rescript": "12.3.0",
|
|
8
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.
|
|
11
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.10"
|
|
9
12
|
},
|
|
10
13
|
"peerDependencies": {
|
|
11
14
|
"rescript": "12.3.0"
|
package/rescript.json
CHANGED
package/src/Seed_Prompt.res
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// One shared readline interface for every interactive prompt in a seed run.
|
|
2
2
|
//
|
|
3
3
|
// The reason this module exists: creating and closing a fresh `readline`
|
|
4
|
-
// interface per prompt leaves stdin paused after the first `close`, so the
|
|
4
|
+
// interface per prompt leaves NodeProcess.stdin paused after the first `close`, so the
|
|
5
5
|
// second prompt (password after username) never fires and the run hangs. A
|
|
6
6
|
// single interface, created lazily and closed exactly once, avoids that — and a
|
|
7
7
|
// `muted` gate on its output lets password entry reuse the same interface
|
|
@@ -14,18 +14,8 @@ open Seed_Types
|
|
|
14
14
|
|
|
15
15
|
// ── Node bindings ─────────────────────────────────────────────────────────────
|
|
16
16
|
|
|
17
|
-
type stream
|
|
18
|
-
@val @scope("process") external stdin: stream = "stdin"
|
|
19
|
-
@val @scope("process") external stdout: stream = "stdout"
|
|
20
|
-
@send external writeStream: (stream, string) => unit = "write"
|
|
21
|
-
@get external isTTY: stream => bool = "isTTY"
|
|
22
|
-
@send external pauseStream: stream => unit = "pause"
|
|
23
|
-
@send external unrefStream: stream => unit = "unref"
|
|
24
|
-
|
|
25
|
-
@scope("process") @val external processEnv: dict<string> = "env"
|
|
26
|
-
|
|
27
17
|
type rl
|
|
28
|
-
type rlOptions = {input: stream, output: stream, terminal?: bool}
|
|
18
|
+
type rlOptions = {input: NodeProcess.stream, output: NodeProcess.stream, terminal?: bool}
|
|
29
19
|
@module("node:readline") external createInterface: rlOptions => rl = "createInterface"
|
|
30
20
|
@send external question: (rl, string, string => unit) => unit = "question"
|
|
31
21
|
@send external closeRl: rl => unit = "close"
|
|
@@ -42,10 +32,10 @@ let iface = (): rl =>
|
|
|
42
32
|
switch rlRef.contents {
|
|
43
33
|
| Some(rl) => rl
|
|
44
34
|
| None =>
|
|
45
|
-
let rl = createInterface({input: stdin, output: stdout, terminal: true})
|
|
35
|
+
let rl = createInterface({input: NodeProcess.stdin, output: NodeProcess.stdout, terminal: true})
|
|
46
36
|
rl->setWriteToOutput(s =>
|
|
47
37
|
if !muted.contents {
|
|
48
|
-
stdout->
|
|
38
|
+
NodeProcess.stdout->NodeProcess.write(s)
|
|
49
39
|
}
|
|
50
40
|
)
|
|
51
41
|
rlRef := Some(rl)
|
|
@@ -58,23 +48,23 @@ let close = (): unit =>
|
|
|
58
48
|
rl->closeRl
|
|
59
49
|
rlRef := None
|
|
60
50
|
// Closing the interface is not enough: a terminal-mode readline leaves
|
|
61
|
-
// stdin resumed and reffed, which keeps the event loop alive so the CLI
|
|
51
|
+
// NodeProcess.stdin resumed and reffed, which keeps the event loop alive so the CLI
|
|
62
52
|
// never exits after seeding. Release it explicitly.
|
|
63
|
-
stdin->
|
|
64
|
-
stdin->
|
|
53
|
+
NodeProcess.stdin->NodeProcess.pause
|
|
54
|
+
NodeProcess.stdin->NodeProcess.unref
|
|
65
55
|
| None => ()
|
|
66
56
|
}
|
|
67
57
|
|
|
68
58
|
// ── Env + TTY ─────────────────────────────────────────────────────────────────
|
|
69
59
|
|
|
70
60
|
let envValue = (key: string): option<string> =>
|
|
71
|
-
switch
|
|
61
|
+
switch NodeProcess.env->Dict.get(key) {
|
|
72
62
|
| Some(v) if v->String.trim != "" => Some(v->String.trim)
|
|
73
63
|
| _ => None
|
|
74
64
|
}
|
|
75
65
|
|
|
76
66
|
let requireTty = (): unit =>
|
|
77
|
-
if !(stdin->isTTY) {
|
|
67
|
+
if !(NodeProcess.stdin->NodeProcess.isTTY->Option.getOr(false)) {
|
|
78
68
|
throw(
|
|
79
69
|
Failed(
|
|
80
70
|
"no TTY for an interactive prompt — set the documented SEED_* / REVENTLESS_DEMO_* " ++
|
|
@@ -101,7 +91,7 @@ let askHidden = (query: string): promise<string> =>
|
|
|
101
91
|
let rl = iface()
|
|
102
92
|
rl->question(query, answer => {
|
|
103
93
|
muted := false
|
|
104
|
-
stdout->
|
|
94
|
+
NodeProcess.stdout->NodeProcess.write("\n")
|
|
105
95
|
resolve(answer)
|
|
106
96
|
})
|
|
107
97
|
muted := true
|
package/src/Seed_Prompt.res.mjs
CHANGED
package/src/Seed_Runner.res
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
open Seed_Types
|
|
4
4
|
|
|
5
|
-
@scope("process") @val external exit: int => unit = "exit"
|
|
6
|
-
@scope("process") @val external env: dict<string> = "env"
|
|
7
5
|
|
|
8
6
|
let envOr = (key: string, fallback: string): string =>
|
|
9
|
-
env->Dict.get(key)->Option.getOr(fallback)
|
|
7
|
+
NodeProcess.env->Dict.get(key)->Option.getOr(fallback)
|
|
10
8
|
|
|
11
9
|
/** One line of progress per phase, so a slow run never looks hung. */
|
|
12
10
|
let report = (line: string): unit => Console.log(` ${line}`)
|
|
@@ -127,7 +125,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
127
125
|
// Exit cleanly: HTTP keep-alive sockets (and, on the interactive path, the
|
|
128
126
|
// readline/stdin handle) can otherwise keep the event loop alive so the CLI
|
|
129
127
|
// appears to hang after a successful run.
|
|
130
|
-
exit(0)
|
|
128
|
+
NodeProcess.exit(0)
|
|
131
129
|
} catch {
|
|
132
130
|
| Failed(message) =>
|
|
133
131
|
Console.error("")
|
|
@@ -135,7 +133,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
135
133
|
Console.error("fresh store once the cause below is fixed.")
|
|
136
134
|
Console.error("")
|
|
137
135
|
Console.error(message)
|
|
138
|
-
exit(1)
|
|
136
|
+
NodeProcess.exit(1)
|
|
139
137
|
| exn =>
|
|
140
138
|
Console.error("")
|
|
141
139
|
Console.error("Seeding aborted with an unexpected error:")
|
|
@@ -143,7 +141,7 @@ let run = async (main: unit => promise<unit>): unit =>
|
|
|
143
141
|
Console.error(
|
|
144
142
|
exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown"),
|
|
145
143
|
)
|
|
146
|
-
exit(1)
|
|
144
|
+
NodeProcess.exit(1)
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
/**
|
|
@@ -172,7 +170,7 @@ let abortStartup = (message: string): unit => {
|
|
|
172
170
|
Console.error("Seeding did not start — nothing was written. Fix the cause below and re-run.")
|
|
173
171
|
Console.error("")
|
|
174
172
|
Console.error(message)
|
|
175
|
-
exit(1)
|
|
173
|
+
NodeProcess.exit(1)
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
/**
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
open JestGlobals
|
|
12
12
|
|
|
13
|
-
@val @scope("process") external processEnv: dict<string> = "env"
|
|
14
13
|
|
|
15
14
|
// `unresolvedReason` reads the knob, so the ambient environment has to be quiet.
|
|
16
|
-
let clearSkip = () =>
|
|
15
|
+
let clearSkip = () => NodeProcess.env->Dict.set("SEED_SKIP_UPLOADS", "")
|
|
17
16
|
|
|
18
17
|
let perStore = Dict.fromArray([
|
|
19
18
|
("Catalog.productImages", "https://catalog.example/"),
|
|
@@ -93,7 +92,7 @@ describe("Seed.Upload.unresolvedReason", () => {
|
|
|
93
92
|
})
|
|
94
93
|
|
|
95
94
|
testSync("the knob outranks both, so a skipped run is never read as a broken one", () => {
|
|
96
|
-
|
|
95
|
+
NodeProcess.env->Dict.set("SEED_SKIP_UPLOADS", "1")
|
|
97
96
|
expect(
|
|
98
97
|
Seed.Upload.unresolvedReason(~store="Catalog.productImages", ~uploadEndpoints=perStore),
|
|
99
98
|
)->toBe("SEED_SKIP_UPLOADS is set")
|