@prisma/cli 2.20.1 → 3.0.0-alpha.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.
- package/LICENSE +158 -0
- package/README.md +29 -28
- package/dist/adapters/config.js +74 -0
- package/dist/adapters/local-state.js +98 -0
- package/dist/adapters/mock-api.js +57 -0
- package/dist/adapters/token-storage.js +43 -0
- package/dist/cli.js +9 -0
- package/dist/cli2.js +59 -0
- package/dist/commands/app/index.js +216 -0
- package/dist/commands/auth/index.js +42 -0
- package/dist/commands/branch/index.js +51 -0
- package/dist/commands/project/index.js +45 -0
- package/dist/controllers/app.js +834 -0
- package/dist/controllers/auth.js +107 -0
- package/dist/controllers/branch.js +73 -0
- package/dist/controllers/project.js +214 -0
- package/dist/controllers/select-prompt-port.js +12 -0
- package/dist/lib/app/bun-project.js +39 -0
- package/dist/lib/app/env-vars.js +24 -0
- package/dist/lib/app/local-dev.js +150 -0
- package/dist/lib/app/preview-build.js +142 -0
- package/dist/lib/app/preview-interaction.js +38 -0
- package/dist/lib/app/preview-progress.js +139 -0
- package/dist/lib/app/preview-provider.js +232 -0
- package/dist/lib/auth/auth-ops.js +57 -0
- package/dist/lib/auth/client.js +22 -0
- package/dist/lib/auth/guard.js +34 -0
- package/dist/lib/auth/login.js +117 -0
- package/dist/output/patterns.js +93 -0
- package/dist/presenters/app.js +405 -0
- package/dist/presenters/auth.js +73 -0
- package/dist/presenters/branch.js +111 -0
- package/dist/presenters/project.js +84 -0
- package/dist/shell/command-meta.js +329 -0
- package/dist/shell/command-runner.js +33 -0
- package/dist/shell/errors.js +66 -0
- package/dist/shell/global-flags.js +25 -0
- package/dist/shell/help.js +78 -0
- package/dist/shell/output.js +54 -0
- package/dist/shell/prompt.js +31 -0
- package/dist/shell/runtime.js +51 -0
- package/dist/shell/ui.js +59 -0
- package/dist/use-cases/auth.js +70 -0
- package/dist/use-cases/branch.js +95 -0
- package/dist/use-cases/create-cli-gateways.js +93 -0
- package/dist/use-cases/project.js +75 -0
- package/package.json +49 -137
- package/build/child.js +0 -4110
- package/build/index.js +0 -104447
- package/build/public/.DS_Store +0 -0
- package/build/public/assets/alert.60ea9f84.svg +0 -5
- package/build/public/assets/array.1a36c222.svg +0 -4
- package/build/public/assets/boolean.9188b434.svg +0 -4
- package/build/public/assets/browser.21a575be.js +0 -1
- package/build/public/assets/browser.38b7fdb1.js +0 -1
- package/build/public/assets/browser.cdd2249a.js +0 -1
- package/build/public/assets/chevron-down.24f76e3c.svg +0 -3
- package/build/public/assets/cross.c2610cf5.svg +0 -11
- package/build/public/assets/datetime.a3bf710a.svg +0 -4
- package/build/public/assets/download.8d34b65a.svg +0 -4
- package/build/public/assets/ellipsis.a8c5a34a.svg +0 -10
- package/build/public/assets/enum.7ec0b64c.svg +0 -6
- package/build/public/assets/folder.d77b8eaf.svg +0 -6
- package/build/public/assets/hamburger.5fdadeac.svg +0 -4
- package/build/public/assets/logotype.a960b169.svg +0 -4
- package/build/public/assets/number.85ddf96b.svg +0 -7
- package/build/public/assets/object.0ba944a6.svg +0 -5
- package/build/public/assets/play.8811691e.svg +0 -6
- package/build/public/assets/plus.8fbf7ad3.svg +0 -4
- package/build/public/assets/read.79154521.svg +0 -1
- package/build/public/assets/refresh.d5448ccc.svg +0 -4
- package/build/public/assets/search.2ed766ce.svg +0 -7
- package/build/public/assets/settings.5ad25af2.svg +0 -8
- package/build/public/assets/string.ea615a24.svg +0 -4
- package/build/public/assets/tick-indeterminate.aec8a44d.svg +0 -3
- package/build/public/assets/tick.8cbb6a93.svg +0 -4
- package/build/public/assets/vendor.c4d0f081.js +0 -354
- package/build/public/demo.html +0 -17
- package/build/public/demoChunk.js +0 -2
- package/build/public/electron-darwin.html +0 -19
- package/build/public/electron-linux.html +0 -18
- package/build/public/electron-mac.html +0 -18
- package/build/public/electron-win.html +0 -17
- package/build/public/electron-win32.html +0 -18
- package/build/public/electron.html +0 -17
- package/build/public/electronBus.js +0 -2
- package/build/public/electronChunk.js +0 -2
- package/build/public/favicon/apple-touch-icon.png +0 -0
- package/build/public/favicon/favicon-16x16.png +0 -0
- package/build/public/favicon/favicon-32x32.png +0 -0
- package/build/public/favicon/prisma.png +0 -0
- package/build/public/favicon.svg +0 -5
- package/build/public/fonts/.DS_Store +0 -0
- package/build/public/fonts/Inter.ttf +0 -0
- package/build/public/fonts/RobotoMono.ttf +0 -0
- package/build/public/icons/.DS_Store +0 -0
- package/build/public/icons/alert.svg +0 -5
- package/build/public/icons/array.svg +0 -4
- package/build/public/icons/bin.svg +0 -37
- package/build/public/icons/boolean.svg +0 -4
- package/build/public/icons/check.svg +0 -3
- package/build/public/icons/chevron-down.svg +0 -3
- package/build/public/icons/code.svg +0 -4
- package/build/public/icons/cross.svg +0 -11
- package/build/public/icons/data-tool.svg +0 -5
- package/build/public/icons/database.svg +0 -4
- package/build/public/icons/datetime.svg +0 -4
- package/build/public/icons/double-arrow-right.svg +0 -4
- package/build/public/icons/download.svg +0 -4
- package/build/public/icons/ellipsis.svg +0 -10
- package/build/public/icons/enum.svg +0 -6
- package/build/public/icons/expand.svg +0 -4
- package/build/public/icons/eye.svg +0 -20
- package/build/public/icons/filters.svg +0 -5
- package/build/public/icons/folder.svg +0 -6
- package/build/public/icons/hamburger.svg +0 -4
- package/build/public/icons/icon.svg +0 -199
- package/build/public/icons/logo.svg +0 -199
- package/build/public/icons/logotype.svg +0 -4
- package/build/public/icons/number.svg +0 -7
- package/build/public/icons/object.svg +0 -5
- package/build/public/icons/play.svg +0 -6
- package/build/public/icons/plus.svg +0 -4
- package/build/public/icons/refresh.svg +0 -4
- package/build/public/icons/search.svg +0 -7
- package/build/public/icons/settings.svg +0 -8
- package/build/public/icons/string.svg +0 -4
- package/build/public/icons/tick-indeterminate.svg +0 -3
- package/build/public/icons/tick.svg +0 -4
- package/build/public/illustrations/.DS_Store +0 -0
- package/build/public/illustrations/empty.svg +0 -1
- package/build/public/illustrations/read.svg +0 -1
- package/build/public/illustrations/searching.svg +0 -1
- package/build/public/images/.DS_Store +0 -0
- package/build/public/images/icon-1024.png +0 -0
- package/build/public/index.css +0 -1
- package/build/public/index.html +0 -49
- package/build/public/index.js +0 -1
- package/build/public/main.31f688a6254e294d9128.css +0 -118
- package/build/public/main.31f688a6254e294d9128.css.map +0 -1
- package/build/public/main.364c712f32662ff0e43d.css +0 -116
- package/build/public/main.364c712f32662ff0e43d.css.map +0 -1
- package/build/public/main.42ef3fe7e97347765c91.css +0 -118
- package/build/public/main.42ef3fe7e97347765c91.css.map +0 -1
- package/build/public/main.503446defafe7aeca2f3.css +0 -116
- package/build/public/main.503446defafe7aeca2f3.css.map +0 -1
- package/build/public/main.c50a3b5980fe26f78b65.css +0 -118
- package/build/public/main.c50a3b5980fe26f78b65.css.map +0 -1
- package/build/public/main.cda25e5813776c2af295.css +0 -116
- package/build/public/main.cda25e5813776c2af295.css.map +0 -1
- package/build/public/main.dbac3b290f78404ff579.css +0 -116
- package/build/public/main.dbac3b290f78404ff579.css.map +0 -1
- package/build/public/main.f8ce44e122e5e2b8f778.css +0 -118
- package/build/public/main.f8ce44e122e5e2b8f778.css.map +0 -1
- package/build/public/main.fc9ea7521a4aecce1a77.css +0 -118
- package/build/public/main.fc9ea7521a4aecce1a77.css.map +0 -1
- package/build/public/main.js +0 -403
- package/build/public/main.js.map +0 -1
- package/build/public/mainChunk.0a84f3ba4d2ab481e877.css +0 -116
- package/build/public/mainChunk.1b327d58afbddc917bce.css +0 -118
- package/build/public/mainChunk.2cdf583b2bd51aa67587.css +0 -118
- package/build/public/mainChunk.544af00f7e9ffcbe782c.css +0 -118
- package/build/public/mainChunk.56f96a13868b2b4a53be.css +0 -118
- package/build/public/mainChunk.5cee429bfbf06e7ecb39.css +0 -118
- package/build/public/mainChunk.a862474ed4cdb421ffa2.css +0 -118
- package/build/public/mainChunk.ada34153c4911b5ac22b.css +0 -118
- package/build/public/mainChunk.c16a8d01b2c49b2f2751.css +0 -118
- package/build/public/mainChunk.ca4a878d5478b9320be8.css +0 -116
- package/build/public/mainChunk.e3adc8758b4395546cef.css +0 -116
- package/build/public/mainChunk.f2c59fcbfc455d8b9de5.css +0 -118
- package/build/public/mainChunk.js +0 -396
- package/build/public/manifest.json +0 -34
- package/build/public/preview.html +0 -16
- package/build/public/previewBus.js +0 -2
- package/build/public/previewChunk.js +0 -2
- package/build/public/projects.html +0 -86
- package/build/public/server.html +0 -16
- package/build/public/serverBus.js +0 -2
- package/build/public/serverChunk.js +0 -2
- package/build/public/splash.html +0 -17
- package/build/public/studioBundle.828f34b1781061528841.css +0 -118
- package/build/public/studioBundle.bfe9138b2e0293fcb7da.css +0 -118
- package/build/public/studioBundle.c5b256eede880e502aac.css +0 -118
- package/build/public/studioBundle.e43df511c8e2e368900a.css +0 -118
- package/build/public/studioBundle.e69382554c2a2942ae32.css +0 -118
- package/build/public/studioBundle.ee21aa56a3999a2b380b.css +0 -118
- package/build/public/studioBundle.js +0 -396
- package/build/public/vercel.html +0 -16
- package/build/public/vercelChunk.js +0 -2
- package/build/public/views/index.pug +0 -89
- package/build/xdg-open +0 -1066
- package/install/index.js +0 -5
- package/preinstall/index.js +0 -46
- package/prisma-client/README.md +0 -27
- package/prisma-client/generator-build/.DS_Store +0 -0
- package/prisma-client/generator-build/index.js +0 -79697
- package/prisma-client/index-browser.js +0 -3
- package/prisma-client/index.d.ts +0 -1
- package/prisma-client/index.js +0 -11
- package/prisma-client/package.json +0 -138
- package/prisma-client/runtime/index-browser.d.ts +0 -267
- package/prisma-client/runtime/index-browser.js +0 -2273
- package/prisma-client/runtime/index.d.ts +0 -1018
- package/prisma-client/runtime/index.js +0 -35028
- package/prisma-client/scripts/backup-index-browser.js +0 -3
- package/prisma-client/scripts/backup-index.d.ts +0 -1
- package/prisma-client/scripts/backup-index.js +0 -11
- package/prisma-client/scripts/colors.js +0 -180
- package/prisma-client/scripts/default-index-browser.js +0 -12
- package/prisma-client/scripts/default-index.d.ts +0 -47
- package/prisma-client/scripts/default-index.js +0 -12
- package/prisma-client/scripts/get-packed-client.js +0 -12
- package/prisma-client/scripts/mock-fs.js +0 -14
- package/prisma-client/scripts/postinstall.d.ts +0 -5
- package/prisma-client/scripts/postinstall.js +0 -398
- package/scripts/install-entry.js +0 -8
- package/scripts/preinstall-entry.js +0 -9
|
@@ -0,0 +1,216 @@
|
|
|
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 { PREVIEW_BUILD_TYPES } from "../../lib/app/preview-build.js";
|
|
5
|
+
import { runAppBuild, runAppDeploy, runAppListDeploys, runAppListEnv, runAppLogs, runAppOpen, runAppPromote, runAppRemove, runAppRollback, runAppRun, runAppShow, runAppShowDeploy, runAppUpdateEnv } from "../../controllers/app.js";
|
|
6
|
+
import { renderAppBuild, renderAppDeploy, renderAppListDeploys, renderAppListEnv, renderAppOpen, renderAppPromote, renderAppRemove, renderAppRollback, renderAppRun, renderAppShow, renderAppShowDeploy, renderAppUpdateEnv, serializeAppBuild, serializeAppDeploy, serializeAppListDeploys, serializeAppListEnv, serializeAppOpen, serializeAppPromote, serializeAppRemove, serializeAppRollback, serializeAppRun, serializeAppShow, serializeAppShowDeploy, serializeAppUpdateEnv } from "../../presenters/app.js";
|
|
7
|
+
import { runCommand } from "../../shell/command-runner.js";
|
|
8
|
+
import { Command, Option } from "commander";
|
|
9
|
+
//#region src/commands/app/index.ts
|
|
10
|
+
function createAppCommand(runtime) {
|
|
11
|
+
const app = attachCommandDescriptor(configureRuntimeCommand(new Command("app"), runtime), "app");
|
|
12
|
+
app.addCommand(createBuildCommand(runtime));
|
|
13
|
+
app.addCommand(createRunCommand(runtime));
|
|
14
|
+
app.addCommand(createDeployCommand(runtime));
|
|
15
|
+
app.addCommand(createUpdateEnvCommand(runtime));
|
|
16
|
+
app.addCommand(createListEnvCommand(runtime));
|
|
17
|
+
app.addCommand(createShowCommand(runtime));
|
|
18
|
+
app.addCommand(createOpenCommand(runtime));
|
|
19
|
+
app.addCommand(createLogsCommand(runtime));
|
|
20
|
+
app.addCommand(createListDeploysCommand(runtime));
|
|
21
|
+
app.addCommand(createShowDeployCommand(runtime));
|
|
22
|
+
app.addCommand(createPromoteCommand(runtime));
|
|
23
|
+
app.addCommand(createRollbackCommand(runtime));
|
|
24
|
+
app.addCommand(createRemoveCommand(runtime));
|
|
25
|
+
return app;
|
|
26
|
+
}
|
|
27
|
+
function createBuildCommand(runtime) {
|
|
28
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("build"), runtime), "app.build");
|
|
29
|
+
command.addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto builds")).addOption(new Option("--build-type <type>", "Local build type").choices([...PREVIEW_BUILD_TYPES]).default("auto"));
|
|
30
|
+
addGlobalFlags(command);
|
|
31
|
+
command.action(async (options) => {
|
|
32
|
+
const entry = options.entry;
|
|
33
|
+
const buildType = options.buildType;
|
|
34
|
+
await runCommand(runtime, "app.build", options, (context) => runAppBuild(context, entry, buildType), {
|
|
35
|
+
renderHuman: (context, descriptor, result) => renderAppBuild(context, descriptor, result),
|
|
36
|
+
renderJson: (result) => serializeAppBuild(result)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return command;
|
|
40
|
+
}
|
|
41
|
+
function createRunCommand(runtime) {
|
|
42
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("run"), runtime), "app.run");
|
|
43
|
+
command.addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto runs")).addOption(new Option("--build-type <type>", "Local framework type").choices([
|
|
44
|
+
"auto",
|
|
45
|
+
"bun",
|
|
46
|
+
"nextjs"
|
|
47
|
+
]).default("auto")).addOption(new Option("--port <port>", "Local port"));
|
|
48
|
+
addGlobalFlags(command);
|
|
49
|
+
command.action(async (options) => {
|
|
50
|
+
const entry = options.entry;
|
|
51
|
+
const buildType = options.buildType;
|
|
52
|
+
const port = options.port;
|
|
53
|
+
await runCommand(runtime, "app.run", options, (context) => runAppRun(context, entry, buildType, port), {
|
|
54
|
+
renderHuman: (context, descriptor, result) => renderAppRun(context, descriptor, result),
|
|
55
|
+
renderJson: (result) => serializeAppRun(result)
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return command;
|
|
59
|
+
}
|
|
60
|
+
function createDeployCommand(runtime) {
|
|
61
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("deploy"), runtime), "app.deploy");
|
|
62
|
+
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto deploys")).addOption(new Option("--build-type <type>", "Deploy build type").choices([...PREVIEW_BUILD_TYPES]).default("auto")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
|
|
63
|
+
addGlobalFlags(command);
|
|
64
|
+
command.action(async (options) => {
|
|
65
|
+
const appName = options.app;
|
|
66
|
+
const entry = options.entry;
|
|
67
|
+
const buildType = options.buildType;
|
|
68
|
+
const httpPort = options.httpPort;
|
|
69
|
+
const envAssignments = options.env;
|
|
70
|
+
await runCommand(runtime, "app.deploy", options, (context) => runAppDeploy(context, appName, {
|
|
71
|
+
entrypoint: entry,
|
|
72
|
+
buildType,
|
|
73
|
+
httpPort,
|
|
74
|
+
envAssignments
|
|
75
|
+
}), {
|
|
76
|
+
renderHuman: (context, descriptor, result) => renderAppDeploy(context, descriptor, result),
|
|
77
|
+
renderJson: (result) => serializeAppDeploy(result)
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
return command;
|
|
81
|
+
}
|
|
82
|
+
function createUpdateEnvCommand(runtime) {
|
|
83
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("update-env"), runtime), "app.update-env");
|
|
84
|
+
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--env <name=value>", "Environment variable").argParser(collectRepeatableValues));
|
|
85
|
+
addGlobalFlags(command);
|
|
86
|
+
command.action(async (options) => {
|
|
87
|
+
const appName = options.app;
|
|
88
|
+
const envAssignments = options.env;
|
|
89
|
+
await runCommand(runtime, "app.update-env", options, (context) => runAppUpdateEnv(context, appName, envAssignments), {
|
|
90
|
+
renderHuman: (context, descriptor, result) => renderAppUpdateEnv(context, descriptor, result),
|
|
91
|
+
renderJson: (result) => serializeAppUpdateEnv(result)
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
return command;
|
|
95
|
+
}
|
|
96
|
+
function createListEnvCommand(runtime) {
|
|
97
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list-env"), runtime), "app.list-env");
|
|
98
|
+
command.addOption(new Option("--app <name>", "App name"));
|
|
99
|
+
addGlobalFlags(command);
|
|
100
|
+
command.action(async (options) => {
|
|
101
|
+
const appName = options.app;
|
|
102
|
+
await runCommand(runtime, "app.list-env", options, (context) => runAppListEnv(context, appName), {
|
|
103
|
+
renderHuman: (context, descriptor, result) => renderAppListEnv(context, descriptor, result),
|
|
104
|
+
renderJson: (result) => serializeAppListEnv(result)
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
return command;
|
|
108
|
+
}
|
|
109
|
+
function createShowCommand(runtime) {
|
|
110
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "app.show");
|
|
111
|
+
command.addOption(new Option("--app <name>", "App name"));
|
|
112
|
+
addGlobalFlags(command);
|
|
113
|
+
command.action(async (options) => {
|
|
114
|
+
const appName = options.app;
|
|
115
|
+
await runCommand(runtime, "app.show", options, (context) => runAppShow(context, appName), {
|
|
116
|
+
renderHuman: (context, descriptor, result) => renderAppShow(context, descriptor, result),
|
|
117
|
+
renderJson: (result) => serializeAppShow(result)
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
return command;
|
|
121
|
+
}
|
|
122
|
+
function createOpenCommand(runtime) {
|
|
123
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("open"), runtime), "app.open");
|
|
124
|
+
command.addOption(new Option("--app <name>", "App name"));
|
|
125
|
+
addGlobalFlags(command);
|
|
126
|
+
command.action(async (options) => {
|
|
127
|
+
const appName = options.app;
|
|
128
|
+
await runCommand(runtime, "app.open", options, (context) => runAppOpen(context, appName), {
|
|
129
|
+
renderHuman: (context, descriptor, result) => renderAppOpen(context, descriptor, result),
|
|
130
|
+
renderJson: (result) => serializeAppOpen(result)
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
return command;
|
|
134
|
+
}
|
|
135
|
+
function createLogsCommand(runtime) {
|
|
136
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logs"), runtime), "app.logs");
|
|
137
|
+
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--deployment <id>", "Deployment id"));
|
|
138
|
+
addGlobalFlags(command);
|
|
139
|
+
command.action(async (options) => {
|
|
140
|
+
const appName = options.app;
|
|
141
|
+
const deploymentId = options.deployment;
|
|
142
|
+
await runCommand(runtime, "app.logs", options, (context) => runAppLogs(context, appName, deploymentId), { renderHuman: () => [] });
|
|
143
|
+
});
|
|
144
|
+
return command;
|
|
145
|
+
}
|
|
146
|
+
function collectRepeatableValues(value, previous) {
|
|
147
|
+
return [...previous ?? [], value];
|
|
148
|
+
}
|
|
149
|
+
function createListDeploysCommand(runtime) {
|
|
150
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list-deploys"), runtime), "app.list-deploys");
|
|
151
|
+
command.addOption(new Option("--app <name>", "App name"));
|
|
152
|
+
addGlobalFlags(command);
|
|
153
|
+
command.action(async (options) => {
|
|
154
|
+
const appName = options.app;
|
|
155
|
+
await runCommand(runtime, "app.list-deploys", options, (context) => runAppListDeploys(context, appName), {
|
|
156
|
+
renderHuman: (context, descriptor, result) => renderAppListDeploys(context, descriptor, result),
|
|
157
|
+
renderJson: (result) => serializeAppListDeploys(result)
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
return command;
|
|
161
|
+
}
|
|
162
|
+
function createShowDeployCommand(runtime) {
|
|
163
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show-deploy"), runtime), "app.show-deploy");
|
|
164
|
+
command.argument("<deployment>", "Deployment id");
|
|
165
|
+
addGlobalFlags(command);
|
|
166
|
+
command.action(async (deploymentId, options) => {
|
|
167
|
+
await runCommand(runtime, "app.show-deploy", options, (context) => runAppShowDeploy(context, deploymentId), {
|
|
168
|
+
renderHuman: (context, descriptor, result) => renderAppShowDeploy(context, descriptor, result),
|
|
169
|
+
renderJson: (result) => serializeAppShowDeploy(result)
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
return command;
|
|
173
|
+
}
|
|
174
|
+
function createPromoteCommand(runtime) {
|
|
175
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("promote"), runtime), "app.promote");
|
|
176
|
+
command.argument("<deployment>", "Deployment id");
|
|
177
|
+
command.addOption(new Option("--app <name>", "App name"));
|
|
178
|
+
addGlobalFlags(command);
|
|
179
|
+
command.action(async (deploymentId, options) => {
|
|
180
|
+
const appName = options.app;
|
|
181
|
+
await runCommand(runtime, "app.promote", options, (context) => runAppPromote(context, deploymentId, appName), {
|
|
182
|
+
renderHuman: (context, descriptor, result) => renderAppPromote(context, descriptor, result),
|
|
183
|
+
renderJson: (result) => serializeAppPromote(result)
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
return command;
|
|
187
|
+
}
|
|
188
|
+
function createRollbackCommand(runtime) {
|
|
189
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("rollback"), runtime), "app.rollback");
|
|
190
|
+
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--to <deployment>", "Deployment id"));
|
|
191
|
+
addGlobalFlags(command);
|
|
192
|
+
command.action(async (options) => {
|
|
193
|
+
const appName = options.app;
|
|
194
|
+
const deploymentId = options.to;
|
|
195
|
+
await runCommand(runtime, "app.rollback", options, (context) => runAppRollback(context, appName, deploymentId), {
|
|
196
|
+
renderHuman: (context, descriptor, result) => renderAppRollback(context, descriptor, result),
|
|
197
|
+
renderJson: (result) => serializeAppRollback(result)
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
return command;
|
|
201
|
+
}
|
|
202
|
+
function createRemoveCommand(runtime) {
|
|
203
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.remove");
|
|
204
|
+
command.addOption(new Option("--app <name>", "App name"));
|
|
205
|
+
addGlobalFlags(command);
|
|
206
|
+
command.action(async (options) => {
|
|
207
|
+
const appName = options.app;
|
|
208
|
+
await runCommand(runtime, "app.remove", options, (context) => runAppRemove(context, appName), {
|
|
209
|
+
renderHuman: (context, descriptor, result) => renderAppRemove(context, descriptor, result),
|
|
210
|
+
renderJson: (result) => serializeAppRemove(result)
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
return command;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
export { createAppCommand };
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { runAuthLogin, runAuthLogout, runAuthWhoAmI } from "../../controllers/auth.js";
|
|
6
|
+
import { renderAuthSuccess } from "../../presenters/auth.js";
|
|
7
|
+
import { Command, Option } from "commander";
|
|
8
|
+
//#region src/commands/auth/index.ts
|
|
9
|
+
function createAuthCommand(runtime) {
|
|
10
|
+
const auth = attachCommandDescriptor(configureRuntimeCommand(new Command("auth"), runtime), "auth");
|
|
11
|
+
auth.addCommand(createAuthLoginCommand(runtime));
|
|
12
|
+
auth.addCommand(createAuthLogoutCommand(runtime));
|
|
13
|
+
auth.addCommand(createAuthWhoAmICommand(runtime));
|
|
14
|
+
return auth;
|
|
15
|
+
}
|
|
16
|
+
function createAuthLoginCommand(runtime) {
|
|
17
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("login"), runtime), "auth.login");
|
|
18
|
+
command.addOption(new Option("--provider <provider>").hideHelp()).addOption(new Option("--user <id>").hideHelp()).addOption(new Option("--workspace <id>").hideHelp());
|
|
19
|
+
addGlobalFlags(command);
|
|
20
|
+
command.action(async (options) => {
|
|
21
|
+
await runCommand(runtime, "auth.login", options, (context) => runAuthLogin(context, options), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.login", result) });
|
|
22
|
+
});
|
|
23
|
+
return command;
|
|
24
|
+
}
|
|
25
|
+
function createAuthLogoutCommand(runtime) {
|
|
26
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logout"), runtime), "auth.logout");
|
|
27
|
+
addGlobalFlags(command);
|
|
28
|
+
command.action(async (options) => {
|
|
29
|
+
await runCommand(runtime, "auth.logout", options, (context) => runAuthLogout(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.logout", result) });
|
|
30
|
+
});
|
|
31
|
+
return command;
|
|
32
|
+
}
|
|
33
|
+
function createAuthWhoAmICommand(runtime) {
|
|
34
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("whoami"), runtime), "auth.whoami");
|
|
35
|
+
addGlobalFlags(command);
|
|
36
|
+
command.action(async (options) => {
|
|
37
|
+
await runCommand(runtime, "auth.whoami", options, (context) => runAuthWhoAmI(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.whoami", result) });
|
|
38
|
+
});
|
|
39
|
+
return command;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { createAuthCommand };
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { runBranchList, runBranchShow, runBranchUse } from "../../controllers/branch.js";
|
|
6
|
+
import { renderBranchList, renderBranchShow, renderBranchUse, serializeBranchList, serializeBranchShow } from "../../presenters/branch.js";
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
//#region src/commands/branch/index.ts
|
|
9
|
+
function createBranchCommand(runtime) {
|
|
10
|
+
const branch = attachCommandDescriptor(configureRuntimeCommand(new Command("branch"), runtime), "branch");
|
|
11
|
+
branch.addCommand(createBranchListCommand(runtime));
|
|
12
|
+
branch.addCommand(createBranchShowCommand(runtime));
|
|
13
|
+
branch.addCommand(createBranchUseCommand(runtime));
|
|
14
|
+
return branch;
|
|
15
|
+
}
|
|
16
|
+
function createBranchListCommand(runtime) {
|
|
17
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "branch.list");
|
|
18
|
+
addGlobalFlags(command);
|
|
19
|
+
command.action(async (options) => {
|
|
20
|
+
await runCommand(runtime, "branch.list", options, (context) => runBranchList(context), {
|
|
21
|
+
renderHuman: (context, descriptor, result) => renderBranchList(context, descriptor, result),
|
|
22
|
+
renderJson: (result) => serializeBranchList(result)
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return command;
|
|
26
|
+
}
|
|
27
|
+
function createBranchShowCommand(runtime) {
|
|
28
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "branch.show");
|
|
29
|
+
addGlobalFlags(command);
|
|
30
|
+
command.action(async (options) => {
|
|
31
|
+
await runCommand(runtime, "branch.show", options, (context) => runBranchShow(context), {
|
|
32
|
+
renderHuman: (context, descriptor, result) => renderBranchShow(context, descriptor, result),
|
|
33
|
+
renderJson: (result) => serializeBranchShow(result)
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return command;
|
|
37
|
+
}
|
|
38
|
+
function createBranchUseCommand(runtime) {
|
|
39
|
+
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("use"), runtime), "branch.use");
|
|
40
|
+
command.argument("[name]", "Branch name");
|
|
41
|
+
addGlobalFlags(command);
|
|
42
|
+
command.action(async (branchName, options) => {
|
|
43
|
+
await runCommand(runtime, "branch.use", options, (context) => runBranchUse(context, branchName), {
|
|
44
|
+
renderHuman: (context, descriptor, result) => renderBranchUse(context, descriptor, result),
|
|
45
|
+
renderJson: (result) => serializeBranchShow(result)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
return command;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { createBranchCommand };
|
|
@@ -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 };
|