@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.
Files changed (50) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/LICENSE +22 -0
  3. package/README.md +773 -0
  4. package/bin/migronaut.js +36 -0
  5. package/index.d.ts +903 -0
  6. package/index.js +1 -0
  7. package/migronaut.schema.json +135 -0
  8. package/package.json +105 -0
  9. package/src/cli/args.js +314 -0
  10. package/src/cli/commands/audit.js +40 -0
  11. package/src/cli/commands/create.js +29 -0
  12. package/src/cli/commands/down.js +30 -0
  13. package/src/cli/commands/dry-run.js +36 -0
  14. package/src/cli/commands/import.js +33 -0
  15. package/src/cli/commands/init.js +64 -0
  16. package/src/cli/commands/list.js +19 -0
  17. package/src/cli/commands/lock.js +35 -0
  18. package/src/cli/commands/redo.js +16 -0
  19. package/src/cli/commands/status.js +52 -0
  20. package/src/cli/commands/unlock.js +43 -0
  21. package/src/cli/commands/up.js +53 -0
  22. package/src/cli/exit-codes.js +38 -0
  23. package/src/cli/index.js +91 -0
  24. package/src/cli/shared.js +343 -0
  25. package/src/cli/spinner.js +59 -0
  26. package/src/cli/table.js +259 -0
  27. package/src/core/audit.js +152 -0
  28. package/src/core/changelog.js +231 -0
  29. package/src/core/config.js +479 -0
  30. package/src/core/context.js +16 -0
  31. package/src/core/import-runner.js +164 -0
  32. package/src/core/import.js +60 -0
  33. package/src/core/lock.js +348 -0
  34. package/src/core/migrator.js +1475 -0
  35. package/src/core/run.js +144 -0
  36. package/src/core/runner.js +150 -0
  37. package/src/errors/index.js +215 -0
  38. package/src/index.js +59 -0
  39. package/src/utils/checksum.js +23 -0
  40. package/src/utils/colors.js +68 -0
  41. package/src/utils/concurrency.js +32 -0
  42. package/src/utils/date.js +28 -0
  43. package/src/utils/env.js +51 -0
  44. package/src/utils/error.js +11 -0
  45. package/src/utils/loader.js +131 -0
  46. package/src/utils/logger.js +109 -0
  47. package/src/utils/redact.js +39 -0
  48. package/src/utils/sanitize.js +43 -0
  49. package/src/utils/template.js +615 -0
  50. package/src/utils/user.js +25 -0
@@ -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
+ });