@looma/prisma-cli 0.1.1

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 (44) hide show
  1. package/README.md +39 -0
  2. package/dist/adapters/config.js +74 -0
  3. package/dist/adapters/local-state.js +98 -0
  4. package/dist/adapters/mock-api.js +57 -0
  5. package/dist/adapters/token-storage.js +43 -0
  6. package/dist/cli.js +9 -0
  7. package/dist/cli2.js +59 -0
  8. package/dist/commands/app/index.js +178 -0
  9. package/dist/commands/auth/index.js +42 -0
  10. package/dist/commands/env/index.js +51 -0
  11. package/dist/commands/project/index.js +45 -0
  12. package/dist/controllers/app.js +658 -0
  13. package/dist/controllers/auth.js +107 -0
  14. package/dist/controllers/env.js +73 -0
  15. package/dist/controllers/project.js +214 -0
  16. package/dist/controllers/select-prompt-port.js +12 -0
  17. package/dist/lib/app/local-dev.js +178 -0
  18. package/dist/lib/app/prototype-build.js +109 -0
  19. package/dist/lib/app/prototype-interaction.js +38 -0
  20. package/dist/lib/app/prototype-progress.js +115 -0
  21. package/dist/lib/app/prototype-provider.js +163 -0
  22. package/dist/lib/auth/auth-ops.js +57 -0
  23. package/dist/lib/auth/client.js +22 -0
  24. package/dist/lib/auth/guard.js +34 -0
  25. package/dist/lib/auth/login.js +117 -0
  26. package/dist/output/patterns.js +93 -0
  27. package/dist/presenters/app.js +333 -0
  28. package/dist/presenters/auth.js +73 -0
  29. package/dist/presenters/env.js +111 -0
  30. package/dist/presenters/project.js +84 -0
  31. package/dist/shell/command-meta.js +294 -0
  32. package/dist/shell/command-runner.js +33 -0
  33. package/dist/shell/errors.js +64 -0
  34. package/dist/shell/global-flags.js +25 -0
  35. package/dist/shell/help.js +78 -0
  36. package/dist/shell/output.js +48 -0
  37. package/dist/shell/prompt.js +31 -0
  38. package/dist/shell/runtime.js +51 -0
  39. package/dist/shell/ui.js +59 -0
  40. package/dist/use-cases/auth.js +70 -0
  41. package/dist/use-cases/create-cli-gateways.js +93 -0
  42. package/dist/use-cases/env.js +104 -0
  43. package/dist/use-cases/project.js +75 -0
  44. package/package.json +30 -0
@@ -0,0 +1,45 @@
1
+ import { attachCommandDescriptor } from "../../shell/command-meta.js";
2
+ import { addGlobalFlags } from "../../shell/global-flags.js";
3
+ import { configureRuntimeCommand } from "../../shell/runtime.js";
4
+ import { runCommand } from "../../shell/command-runner.js";
5
+ import { runProjectLink, runProjectList, runProjectShow } from "../../controllers/project.js";
6
+ import { renderProjectLink, renderProjectList, renderProjectShow, serializeProjectList } from "../../presenters/project.js";
7
+ import { Command } from "commander";
8
+ //#region src/commands/project/index.ts
9
+ function createProjectCommand(runtime) {
10
+ const project = attachCommandDescriptor(configureRuntimeCommand(new Command("project"), runtime), "project");
11
+ project.addCommand(createProjectListCommand(runtime));
12
+ project.addCommand(createProjectShowCommand(runtime));
13
+ project.addCommand(createProjectLinkCommand(runtime));
14
+ return project;
15
+ }
16
+ function createProjectListCommand(runtime) {
17
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "project.list");
18
+ addGlobalFlags(command);
19
+ command.action(async (options) => {
20
+ await runCommand(runtime, "project.list", options, (context) => runProjectList(context), {
21
+ renderHuman: (context, descriptor, result) => renderProjectList(context, descriptor, result),
22
+ renderJson: (result) => serializeProjectList(result)
23
+ });
24
+ });
25
+ return command;
26
+ }
27
+ function createProjectShowCommand(runtime) {
28
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "project.show");
29
+ addGlobalFlags(command);
30
+ command.action(async (options) => {
31
+ await runCommand(runtime, "project.show", options, (context) => runProjectShow(context), { renderHuman: (context, descriptor, result) => renderProjectShow(context, descriptor, result) });
32
+ });
33
+ return command;
34
+ }
35
+ function createProjectLinkCommand(runtime) {
36
+ const command = attachCommandDescriptor(configureRuntimeCommand(new Command("link"), runtime), "project.link");
37
+ command.argument("[project]", "Project id");
38
+ addGlobalFlags(command);
39
+ command.action(async (projectId, options) => {
40
+ await runCommand(runtime, "project.link", options, (context) => runProjectLink(context, projectId), { renderHuman: (context, descriptor, result) => renderProjectLink(context, descriptor, result) });
41
+ });
42
+ return command;
43
+ }
44
+ //#endregion
45
+ export { createProjectCommand };