velocious 1.0.566 → 1.0.567
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 +2 -0
- package/bin/velocious.js +28 -1
- package/build/bin/velocious.js +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1180,6 +1180,8 @@ Evaluate inline JavaScript (Rails-style runner) with initialized app/database co
|
|
|
1180
1180
|
npx velocious runner "const users = await db.query('SELECT COUNT(*) AS count FROM users'); console.log(users[0].count)"
|
|
1181
1181
|
```
|
|
1182
1182
|
|
|
1183
|
+
Successful CLI commands exit with status `0`. If command execution rejects, Velocious marks the process failed and always runs final database cleanup. Successful cleanup preserves and rethrows the original command error unchanged; if cleanup also fails, an `AggregateError` retains the command error first and as its `cause`, followed by the cleanup error. Cleanup-only failures also exit nonzero. These failures therefore remain nonzero even when application code installs an `uncaughtException` listener that reports and consumes the error. See [CLI process exit behavior](docs/cli.md#process-exit-behavior).
|
|
1184
|
+
|
|
1183
1185
|
By default, migrations write `db/structure-<identifier>.sql` files for each database in non-test environments. Test skips these automatic writes unless you explicitly opt in. Configure allow/deny lists in your configuration:
|
|
1184
1186
|
|
|
1185
1187
|
```js
|
package/bin/velocious.js
CHANGED
|
@@ -39,10 +39,37 @@ const cli = new Cli({
|
|
|
39
39
|
processArgs
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
+
let commandError
|
|
43
|
+
let commandFailed = false
|
|
44
|
+
|
|
42
45
|
try {
|
|
43
46
|
await cli.execute()
|
|
44
|
-
}
|
|
47
|
+
} catch (error) {
|
|
48
|
+
commandError = error
|
|
49
|
+
commandFailed = true
|
|
50
|
+
process.exitCode = 1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let cleanupError
|
|
54
|
+
let cleanupFailed = false
|
|
55
|
+
|
|
56
|
+
try {
|
|
45
57
|
await configuration.closeDatabaseConnections()
|
|
58
|
+
} catch (error) {
|
|
59
|
+
cleanupError = error
|
|
60
|
+
cleanupFailed = true
|
|
61
|
+
process.exitCode = 1
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (commandFailed && cleanupFailed) {
|
|
65
|
+
throw new AggregateError(
|
|
66
|
+
[commandError, cleanupError],
|
|
67
|
+
"Velocious CLI command execution and database cleanup both failed",
|
|
68
|
+
{cause: commandError}
|
|
69
|
+
)
|
|
46
70
|
}
|
|
47
71
|
|
|
72
|
+
if (commandFailed) throw commandError
|
|
73
|
+
if (cleanupFailed) throw cleanupError
|
|
74
|
+
|
|
48
75
|
process.exit(0)
|
package/build/bin/velocious.js
CHANGED
|
@@ -39,10 +39,37 @@ const cli = new Cli({
|
|
|
39
39
|
processArgs
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
+
let commandError
|
|
43
|
+
let commandFailed = false
|
|
44
|
+
|
|
42
45
|
try {
|
|
43
46
|
await cli.execute()
|
|
44
|
-
}
|
|
47
|
+
} catch (error) {
|
|
48
|
+
commandError = error
|
|
49
|
+
commandFailed = true
|
|
50
|
+
process.exitCode = 1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let cleanupError
|
|
54
|
+
let cleanupFailed = false
|
|
55
|
+
|
|
56
|
+
try {
|
|
45
57
|
await configuration.closeDatabaseConnections()
|
|
58
|
+
} catch (error) {
|
|
59
|
+
cleanupError = error
|
|
60
|
+
cleanupFailed = true
|
|
61
|
+
process.exitCode = 1
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (commandFailed && cleanupFailed) {
|
|
65
|
+
throw new AggregateError(
|
|
66
|
+
[commandError, cleanupError],
|
|
67
|
+
"Velocious CLI command execution and database cleanup both failed",
|
|
68
|
+
{cause: commandError}
|
|
69
|
+
)
|
|
46
70
|
}
|
|
47
71
|
|
|
72
|
+
if (commandFailed) throw commandError
|
|
73
|
+
if (cleanupFailed) throw cleanupError
|
|
74
|
+
|
|
48
75
|
process.exit(0)
|