@alexify/migronaut 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/CHANGELOG.md +128 -0
- package/LICENSE +22 -0
- package/README.md +773 -0
- package/bin/migronaut.js +36 -0
- package/index.d.ts +903 -0
- package/index.js +1 -0
- package/migronaut.schema.json +135 -0
- package/package.json +105 -0
- package/src/cli/args.js +314 -0
- package/src/cli/commands/audit.js +40 -0
- package/src/cli/commands/create.js +29 -0
- package/src/cli/commands/down.js +30 -0
- package/src/cli/commands/dry-run.js +36 -0
- package/src/cli/commands/import.js +33 -0
- package/src/cli/commands/init.js +64 -0
- package/src/cli/commands/list.js +19 -0
- package/src/cli/commands/lock.js +35 -0
- package/src/cli/commands/redo.js +16 -0
- package/src/cli/commands/status.js +52 -0
- package/src/cli/commands/unlock.js +43 -0
- package/src/cli/commands/up.js +53 -0
- package/src/cli/exit-codes.js +38 -0
- package/src/cli/index.js +91 -0
- package/src/cli/shared.js +343 -0
- package/src/cli/spinner.js +59 -0
- package/src/cli/table.js +259 -0
- package/src/core/audit.js +152 -0
- package/src/core/changelog.js +231 -0
- package/src/core/config.js +479 -0
- package/src/core/context.js +16 -0
- package/src/core/import-runner.js +164 -0
- package/src/core/import.js +60 -0
- package/src/core/lock.js +348 -0
- package/src/core/migrator.js +1475 -0
- package/src/core/run.js +144 -0
- package/src/core/runner.js +150 -0
- package/src/errors/index.js +215 -0
- package/src/index.js +59 -0
- package/src/utils/checksum.js +23 -0
- package/src/utils/colors.js +68 -0
- package/src/utils/concurrency.js +32 -0
- package/src/utils/date.js +28 -0
- package/src/utils/env.js +51 -0
- package/src/utils/error.js +11 -0
- package/src/utils/loader.js +131 -0
- package/src/utils/logger.js +109 -0
- package/src/utils/redact.js +39 -0
- package/src/utils/sanitize.js +43 -0
- package/src/utils/template.js +615 -0
- package/src/utils/user.js +25 -0
package/bin/migronaut.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { errorText } = require('../src/utils/error.js');
|
|
3
|
+
|
|
4
|
+
// `status --json | head` closes the pipe early; the resulting EPIPE arrives as
|
|
5
|
+
// a stream 'error' event, not a promise rejection, and would otherwise crash
|
|
6
|
+
// with a raw Node stack. A closed pipe after we printed what fit is success.
|
|
7
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
8
|
+
stream.on('error', (error) => {
|
|
9
|
+
if (error?.code === 'EPIPE') process.exit(0);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// A rejection escaping the CLI's own handling still gets the project's error
|
|
14
|
+
// format instead of Node's default trace.
|
|
15
|
+
process.on('unhandledRejection', (error) => {
|
|
16
|
+
process.stderr.write(`✖ ${errorText(error)}\n`);
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// A synchronous throw (signal handler, timer callback) bypasses the promise
|
|
21
|
+
// chain — without this, Node prints a raw stack, the one output path that
|
|
22
|
+
// skips errorText's URI redaction. exit(1), not exitCode: after an uncaught
|
|
23
|
+
// throw the process state is not trustworthy enough to keep draining.
|
|
24
|
+
process.on('uncaughtException', (error) => {
|
|
25
|
+
process.stderr.write(`✖ ${errorText(error)}\n`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const { run } = require('../src/cli/index.js');
|
|
30
|
+
|
|
31
|
+
run(process.argv).catch((error) => {
|
|
32
|
+
process.stderr.write(`✖ ${errorText(error)}\n`);
|
|
33
|
+
// exitCode, not exit(): letting the event loop drain flushes buffered
|
|
34
|
+
// stdout/stderr writes that process.exit() would truncate on a pipe.
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
});
|