@tscircuit/cli 0.0.393 → 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.
- package/.github/workflows/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-pver-release.yml +25 -0
- package/.github/workflows/{typecheck.yml → bun-typecheck.yml} +0 -3
- package/LICENSE +21 -0
- package/README.md +30 -36
- package/biome.json +9 -9
- package/bun.lockb +0 -0
- package/cli/CliContext.ts +8 -0
- package/cli/auth/login/register.ts +73 -0
- package/cli/auth/logout/register.ts +11 -0
- package/cli/auth/register.ts +5 -0
- package/cli/config/print/register.ts +12 -0
- package/cli/config/register.ts +5 -0
- package/cli/dev/register.ts +111 -0
- package/cli/main.ts +31 -0
- package/dist/main.js +473 -0
- package/docs/file-server-api-usage.md +57 -0
- package/docs/run-frame-usage.md +14 -0
- package/example-dir/manual-edits.json +1 -0
- package/example-dir/snippet.d.ts +13 -0
- package/example-dir/snippet.tsx +20 -0
- package/example-dir/types.d.ts +11 -0
- package/lib/cli-config/TypedConfigStore.ts +50 -0
- package/lib/cli-config/index.ts +16 -0
- package/lib/dependency-analysis/DependencyAnalyzer.ts +129 -0
- package/lib/dependency-analysis/getLocalFileDependencies.ts +101 -0
- package/lib/dependency-analysis/installNodeModuleTypes.ts +74 -0
- package/lib/index.ts +2 -0
- package/lib/project-config/index.ts +5 -0
- package/lib/registry-api/endpoint-types.ts +20 -0
- package/lib/registry-api/get-ky.ts +30 -0
- package/lib/server/EventsWatcher.ts +75 -0
- package/lib/server/createServer.ts +62 -0
- package/lib/site/getIndex.ts +18 -0
- package/package.json +27 -144
- package/tsconfig.json +25 -22
- package/.github/workflows/formatbot.yml +0 -63
- package/.github/workflows/release.yml +0 -40
- package/.github/workflows/test.yml +0 -32
- package/.github/workflows/windows-tests.yml +0 -32
- package/.prettierrc +0 -1
- package/DEVELOPMENT.md +0 -7
- package/api/README.md +0 -3
- package/api/db/generic-json-level.ts +0 -123
- package/api/db/get-db.ts +0 -26
- package/api/db/schema.ts +0 -65
- package/api/db/zod-level-db.ts +0 -148
- package/api/index.ts +0 -4
- package/api/lib/middlewares/with-db.ts +0 -18
- package/api/lib/middlewares/with-debug-request-logging.ts +0 -13
- package/api/lib/middlewares/with-error-response.ts +0 -37
- package/api/lib/with-winter-spec.ts +0 -9
- package/api/lib/zod/export_parameters.ts +0 -25
- package/api/routes/api/db/download.ts +0 -25
- package/api/routes/api/dev_package_examples/create.ts +0 -43
- package/api/routes/api/dev_package_examples/get.ts +0 -46
- package/api/routes/api/dev_package_examples/list.ts +0 -36
- package/api/routes/api/dev_package_examples/update.ts +0 -59
- package/api/routes/api/dev_server/reset.ts +0 -13
- package/api/routes/api/export_files/create.ts +0 -27
- package/api/routes/api/export_files/download.ts +0 -25
- package/api/routes/api/export_requests/create.ts +0 -30
- package/api/routes/api/export_requests/get.ts +0 -43
- package/api/routes/api/export_requests/list.ts +0 -26
- package/api/routes/api/export_requests/update.ts +0 -34
- package/api/routes/api/health.ts +0 -11
- package/api/routes/api/package_info/create.ts +0 -26
- package/api/routes/api/package_info/get.ts +0 -16
- package/api/routes/health.ts +0 -11
- package/api/routes/index.ts +0 -16
- package/api/server.ts +0 -20
- package/api/static-routes.ts +0 -24
- package/api/tests/fixtures/get-test-server.ts +0 -31
- package/api/tests/fixtures/start-server.ts +0 -41
- package/api/tests/routes/dev_package_examples/create.test.ts +0 -19
- package/api/tests/routes/dev_package_examples/get.test.ts +0 -25
- package/api/tests/routes/dev_package_examples/list.test.ts +0 -32
- package/api/tests/routes/dev_package_examples/update.test.ts +0 -38
- package/api/tests/routes/export_files/create.test.ts +0 -18
- package/api/tests/routes/export_files/download.test.ts +0 -29
- package/api/tests/routes/export_requests/create.test.ts +0 -24
- package/api/tests/routes/export_requests/get.test.ts +0 -41
- package/api/tests/routes/export_requests/list.test.ts +0 -35
- package/api/tests/routes/export_requests/update.test.ts +0 -50
- package/api/tests/routes/health.test.ts +0 -10
- package/bunfig.toml +0 -2
- package/cli/cli.ts +0 -13
- package/cli/lib/cmd-fns/add.ts +0 -34
- package/cli/lib/cmd-fns/auth-login.ts +0 -59
- package/cli/lib/cmd-fns/auth-logout.ts +0 -7
- package/cli/lib/cmd-fns/auth-sessions-create.ts +0 -3
- package/cli/lib/cmd-fns/auth-sessions-get.ts +0 -3
- package/cli/lib/cmd-fns/auth-sessions-list.ts +0 -5
- package/cli/lib/cmd-fns/config-clear.ts +0 -5
- package/cli/lib/cmd-fns/config-print-config.ts +0 -6
- package/cli/lib/cmd-fns/config-reveal-location.ts +0 -5
- package/cli/lib/cmd-fns/config-set-log-requests.ts +0 -7
- package/cli/lib/cmd-fns/config-set-registry.ts +0 -9
- package/cli/lib/cmd-fns/config-set-runtime.ts +0 -7
- package/cli/lib/cmd-fns/config-set-session.ts +0 -7
- package/cli/lib/cmd-fns/dev/check-if-initialized.ts +0 -22
- package/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -23
- package/cli/lib/cmd-fns/dev/dev-server-request-handler.ts +0 -61
- package/cli/lib/cmd-fns/dev/find-available-port.ts +0 -32
- package/cli/lib/cmd-fns/dev/fulfill-export-requests.ts +0 -162
- package/cli/lib/cmd-fns/dev/get-dev-server-axios.ts +0 -29
- package/cli/lib/cmd-fns/dev/index.ts +0 -168
- package/cli/lib/cmd-fns/dev/infer-export-name-from-source.ts +0 -17
- package/cli/lib/cmd-fns/dev/mark-all-examples-loading.ts +0 -18
- package/cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +0 -62
- package/cli/lib/cmd-fns/dev/start-dev-server.ts +0 -34
- package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +0 -347
- package/cli/lib/cmd-fns/dev/start-export-request-watcher.ts +0 -33
- package/cli/lib/cmd-fns/dev/start-fs-watcher.ts +0 -54
- package/cli/lib/cmd-fns/dev/upload-examples-from-directory.ts +0 -42
- package/cli/lib/cmd-fns/dev-server-fulfill-export-requests.ts +0 -43
- package/cli/lib/cmd-fns/dev-server-upload.ts +0 -56
- package/cli/lib/cmd-fns/export-gerbers.ts +0 -28
- package/cli/lib/cmd-fns/export-kicad-pcb.ts +0 -36
- package/cli/lib/cmd-fns/export-pnp-csv.ts +0 -32
- package/cli/lib/cmd-fns/gen-jlcpcb-component.ts +0 -64
- package/cli/lib/cmd-fns/go.ts +0 -14
- package/cli/lib/cmd-fns/index.ts +0 -46
- package/cli/lib/cmd-fns/init/create-or-modify-npmrc.ts +0 -21
- package/cli/lib/cmd-fns/init/get-generated-npmrc.ts +0 -8
- package/cli/lib/cmd-fns/init/get-generated-readme.ts +0 -41
- package/cli/lib/cmd-fns/init/get-generated-tsconfig.ts +0 -34
- package/cli/lib/cmd-fns/init/index.ts +0 -193
- package/cli/lib/cmd-fns/install.ts +0 -34
- package/cli/lib/cmd-fns/lint.ts +0 -43
- package/cli/lib/cmd-fns/open.ts +0 -19
- package/cli/lib/cmd-fns/package-examples-create.ts +0 -36
- package/cli/lib/cmd-fns/package-examples-get.ts +0 -20
- package/cli/lib/cmd-fns/package-examples-list.ts +0 -18
- package/cli/lib/cmd-fns/package-files-create.ts +0 -31
- package/cli/lib/cmd-fns/package-files-download.ts +0 -29
- package/cli/lib/cmd-fns/package-files-get.ts +0 -3
- package/cli/lib/cmd-fns/package-files-list.ts +0 -28
- package/cli/lib/cmd-fns/package-files-upload-directory.ts +0 -6
- package/cli/lib/cmd-fns/package-releases-create.ts +0 -35
- package/cli/lib/cmd-fns/package-releases-get.ts +0 -3
- package/cli/lib/cmd-fns/package-releases-list.ts +0 -32
- package/cli/lib/cmd-fns/package-releases-update.ts +0 -45
- package/cli/lib/cmd-fns/packages-create.ts +0 -16
- package/cli/lib/cmd-fns/packages-get.ts +0 -16
- package/cli/lib/cmd-fns/packages-list.ts +0 -16
- package/cli/lib/cmd-fns/publish/index.ts +0 -336
- package/cli/lib/cmd-fns/remove.ts +0 -31
- package/cli/lib/cmd-fns/render.ts +0 -45
- package/cli/lib/cmd-fns/soupify.ts +0 -31
- package/cli/lib/cmd-fns/uninstall.ts +0 -31
- package/cli/lib/cmd-fns/version.ts +0 -38
- package/cli/lib/create-config-manager.ts +0 -97
- package/cli/lib/export-fns/export-bom-csv.ts +0 -32
- package/cli/lib/export-fns/export-gerbers.ts +0 -108
- package/cli/lib/export-fns/export-kicad-pcb.ts +0 -32
- package/cli/lib/export-fns/export-pnp-csv.ts +0 -31
- package/cli/lib/get-program.ts +0 -387
- package/cli/lib/param-handlers/index.ts +0 -21
- package/cli/lib/param-handlers/interact-for-local-directory.ts +0 -58
- package/cli/lib/param-handlers/interact-for-local-file.ts +0 -59
- package/cli/lib/param-handlers/interact-for-package-example-id.ts +0 -25
- package/cli/lib/param-handlers/interact-for-package-name-with-version.ts +0 -63
- package/cli/lib/param-handlers/interact-for-package-name.ts +0 -45
- package/cli/lib/param-handlers/interact-for-package-release-id.ts +0 -15
- package/cli/lib/param-handlers/interact-for-registry-url.ts +0 -27
- package/cli/lib/param-handlers/interact-for-runtime.ts +0 -33
- package/cli/lib/param-handlers/param-handler-type.ts +0 -7
- package/cli/lib/posthog.ts +0 -23
- package/cli/lib/soupify/get-export-name-from-file.ts +0 -29
- package/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +0 -15
- package/cli/lib/soupify/index.ts +0 -1
- package/cli/lib/soupify/run-entrypoint-file.ts +0 -59
- package/cli/lib/soupify/soupify-with-core.ts +0 -74
- package/cli/lib/soupify/soupify.ts +0 -6
- package/cli/lib/util/app-context.ts +0 -17
- package/cli/lib/util/create-context-and-run-program.ts +0 -168
- package/cli/lib/util/get-all-package-files.ts +0 -66
- package/cli/lib/util/lint-project.ts +0 -137
- package/cli/tests/export-gerber-keyboard.test.ts +0 -16
- package/cli/tests/export-gerber.test.ts +0 -49
- package/cli/tests/export-kicad-pcb.test.ts +0 -23
- package/cli/tests/export-pnp-csv.test.ts +0 -24
- package/cli/tests/fixtures/preload.ts +0 -54
- package/cli/tests/init.test.ts +0 -9
- package/cli/tests/open.test.ts +0 -9
- package/cli/tests/soupify-builder.test.ts +0 -9
- package/cli/tests/soupify-core.test.ts +0 -9
- package/dist/cli.js +0 -3676
- package/docs/EDIT_EVENT_PIPELINE.md +0 -34
- package/example-project/README.md +0 -18
- package/example-project/examples/basic-capacitor.tsx +0 -5
- package/example-project/examples/basic-chip.tsx +0 -26
- package/example-project/examples/basic-resistor.tsx +0 -3
- package/example-project/examples/macrokeypad.tsx +0 -59
- package/example-project/index.ts +0 -1
- package/example-project/package.json +0 -5
- package/example-project/src/ArduinoProMicroBreakout.tsx +0 -37
- package/example-project/src/Key.tsx +0 -46
- package/example-project/src/Keyswitch.tsx +0 -26
- package/example-project/src/KeyswitchSocket.tsx +0 -56
- package/example-project/src/MyCircuit.tsx +0 -38
- package/example-project/src/manual-edits.ts +0 -93
- package/frontend/README.md +0 -3
- package/frontend/bun.lockb +0 -0
- package/frontend/components/command-k.tsx +0 -86
- package/frontend/components/dialogs/generic-export-dialog.tsx +0 -189
- package/frontend/components/dialogs/gerber-export-dialog.tsx +0 -168
- package/frontend/components/global-context-providers.tsx +0 -11
- package/frontend/components/select-example-search.tsx +0 -118
- package/frontend/components/ui/alert-dialog.tsx +0 -139
- package/frontend/components/ui/alert.tsx +0 -59
- package/frontend/components/ui/breadcrumb.tsx +0 -115
- package/frontend/components/ui/button.tsx +0 -57
- package/frontend/components/ui/card.tsx +0 -76
- package/frontend/components/ui/command.tsx +0 -153
- package/frontend/components/ui/context-menu.tsx +0 -202
- package/frontend/components/ui/dialog.tsx +0 -120
- package/frontend/components/ui/menubar.tsx +0 -238
- package/frontend/components/ui/navigation-menu.tsx +0 -128
- package/frontend/components/ui/popover.tsx +0 -31
- package/frontend/components/ui/select.tsx +0 -162
- package/frontend/components/ui/tabs.tsx +0 -53
- package/frontend/components/ui/toggle-group.tsx +0 -59
- package/frontend/components/ui/toggle.tsx +0 -43
- package/frontend/components/ui/tooltip.tsx +0 -28
- package/frontend/components.json +0 -17
- package/frontend/hooks/toast-if-api-not-connected.ts +0 -23
- package/frontend/hooks/use-active-dev-package-example-lite.ts +0 -39
- package/frontend/hooks/use-dev-package-examples.tsx +0 -18
- package/frontend/hooks/use-global-store.ts +0 -42
- package/frontend/index.css +0 -76
- package/frontend/index.html +0 -13
- package/frontend/lib/utils.ts +0 -6
- package/frontend/main.tsx +0 -13
- package/frontend/tailwind.config.js +0 -74
- package/frontend/views/App.tsx +0 -22
- package/frontend/views/Header.tsx +0 -55
- package/frontend/views/HeaderMenu.tsx +0 -326
- package/frontend/views/MainContentView.tsx +0 -172
- package/frontend/vite-env.d.ts +0 -1
- package/frontend/vite.config.ts +0 -50
- package/renovate.json +0 -15
- package/scripts/build-cli.ts +0 -12
- package/tsup.config.ts +0 -7
package/cli/lib/get-program.ts
DELETED
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander"
|
|
2
|
-
import * as CMDFN from "cli/lib/cmd-fns"
|
|
3
|
-
import type { AppContext } from "./util/app-context"
|
|
4
|
-
|
|
5
|
-
export const getProgram = (ctx: AppContext) => {
|
|
6
|
-
const cmd = new Command("tsci").description(
|
|
7
|
-
"Develop, test and manage tscircuit packages",
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
cmd
|
|
11
|
-
.command("dev")
|
|
12
|
-
.description("Run development server in current directory")
|
|
13
|
-
.option("--cwd <cwd>", "Current working directory")
|
|
14
|
-
.option("--port <port>", "Port to run dev server on")
|
|
15
|
-
.option("--no-core", "Use @tscircuit/core beta", false)
|
|
16
|
-
.option("--no-cleanup", "Don't cleanup temporary files (for debugging)")
|
|
17
|
-
.action((args) => CMDFN.dev(ctx, args))
|
|
18
|
-
|
|
19
|
-
cmd
|
|
20
|
-
.command("init")
|
|
21
|
-
.description("Initialize a new tscircuit project")
|
|
22
|
-
.option("--name <name>", "Name of the project")
|
|
23
|
-
.option(
|
|
24
|
-
"--runtime <runtime>",
|
|
25
|
-
"Runtime to use (attempts to bun, otherwise node/tsx)",
|
|
26
|
-
)
|
|
27
|
-
.option(
|
|
28
|
-
"--dir <dir>",
|
|
29
|
-
"Directory to initialize (defaults to ./<name> or . if name not provided)",
|
|
30
|
-
)
|
|
31
|
-
.action((args) => CMDFN.init(ctx, args))
|
|
32
|
-
|
|
33
|
-
cmd
|
|
34
|
-
.command("add")
|
|
35
|
-
.description("Add a package from the tscircuit registry")
|
|
36
|
-
.argument(
|
|
37
|
-
"<packages...>",
|
|
38
|
-
"Packages to install from registry.tscircuit.com, optionally with version",
|
|
39
|
-
)
|
|
40
|
-
.option("-D, --dev", "Add to devDependencies")
|
|
41
|
-
.action((packages, flags) => CMDFN.add(ctx, { packages, flags }))
|
|
42
|
-
|
|
43
|
-
cmd
|
|
44
|
-
.command("remove")
|
|
45
|
-
.description("Remove/uninstall a package")
|
|
46
|
-
.argument("<packages...>", "Packages to remove")
|
|
47
|
-
.action((packages, flags) => CMDFN.remove(ctx, { packages, flags }))
|
|
48
|
-
|
|
49
|
-
cmd
|
|
50
|
-
.command("lint")
|
|
51
|
-
.description("Lint all TypeScript files in the project")
|
|
52
|
-
.option("--fix", "Automatically fix problems")
|
|
53
|
-
.action((args) => CMDFN.lint(ctx, args))
|
|
54
|
-
|
|
55
|
-
cmd
|
|
56
|
-
.command("go")
|
|
57
|
-
.description("Open browser to the TSCircuit Get Started tutorial")
|
|
58
|
-
.action((args) => CMDFN.go(ctx, args))
|
|
59
|
-
|
|
60
|
-
cmd
|
|
61
|
-
.command("render")
|
|
62
|
-
.description("Render circuit as image")
|
|
63
|
-
.requiredOption("--input <input>", "Input TypeScript file path")
|
|
64
|
-
.option("--pcb", "Render PCB view")
|
|
65
|
-
.option("--schematic", "Render schematic view")
|
|
66
|
-
.option("--output <output>", "Output file path")
|
|
67
|
-
.option("-t, --type <type>", "Output file type (png or svg)")
|
|
68
|
-
.action((args) => CMDFN.render(ctx, args))
|
|
69
|
-
|
|
70
|
-
const genCmd = cmd.command("gen").description("Generate components")
|
|
71
|
-
genCmd
|
|
72
|
-
.command("jlcpcb <jlcpcbPartNumberOrUrl>")
|
|
73
|
-
.description("Generate JLCPCB-specific files")
|
|
74
|
-
.action((partNumberOrUrl, args) =>
|
|
75
|
-
CMDFN.genJlcpcbComponent(ctx, { partNumberOrUrl, ...args }),
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
const authCmd = cmd.command("auth").description("Login/logout")
|
|
79
|
-
authCmd
|
|
80
|
-
.command("login")
|
|
81
|
-
.description("Authenticate CLI, login to registry")
|
|
82
|
-
.action((args) => CMDFN.authLogin(ctx, args))
|
|
83
|
-
authCmd
|
|
84
|
-
.command("logout")
|
|
85
|
-
.description("Clear local authentication")
|
|
86
|
-
.action((args) => CMDFN.authLogout(ctx, args))
|
|
87
|
-
|
|
88
|
-
const configCmd = cmd
|
|
89
|
-
.command("config")
|
|
90
|
-
.description("Manage the local tsci configuration")
|
|
91
|
-
|
|
92
|
-
configCmd
|
|
93
|
-
.command("reveal-location")
|
|
94
|
-
.description("Log the location of the config file")
|
|
95
|
-
.action((args) => CMDFN.configRevealLocation(ctx, args))
|
|
96
|
-
configCmd
|
|
97
|
-
.command("set-registry")
|
|
98
|
-
.description("Set the registry API url")
|
|
99
|
-
.requiredOption("--server <server>", "Registry URL")
|
|
100
|
-
.action((args) => CMDFN.configSetRegistry(ctx, args))
|
|
101
|
-
configCmd
|
|
102
|
-
.command("set-session")
|
|
103
|
-
.description("Set the session token manually")
|
|
104
|
-
.requiredOption("--session-token <session_token>", "Session Token")
|
|
105
|
-
.action((args) => CMDFN.configSetSession(ctx, args))
|
|
106
|
-
configCmd
|
|
107
|
-
.command("set-runtime")
|
|
108
|
-
.description("Set runtime to use, bun or node")
|
|
109
|
-
.requiredOption(
|
|
110
|
-
"--runtime <runtime>",
|
|
111
|
-
"Bun or node. Setting to bun generally doubles soupification speed.",
|
|
112
|
-
)
|
|
113
|
-
.action((args) => CMDFN.configSetRuntime(ctx, args))
|
|
114
|
-
configCmd
|
|
115
|
-
.command("set-log-requests")
|
|
116
|
-
.description("Set whether to log requests to registry (noisy)")
|
|
117
|
-
.requiredOption("--log-requests", "Should log requests to registry")
|
|
118
|
-
.action((args) => CMDFN.configSetLogRequests(ctx, args))
|
|
119
|
-
configCmd
|
|
120
|
-
.command("print-config")
|
|
121
|
-
.description("Print the current config")
|
|
122
|
-
.action((args) => CMDFN.configPrintConfig(ctx, args))
|
|
123
|
-
configCmd
|
|
124
|
-
.command("clear")
|
|
125
|
-
|
|
126
|
-
.action((args) => CMDFN.configClear(ctx, args))
|
|
127
|
-
|
|
128
|
-
// const authSessionsCmd = authCmd.command("sessions")
|
|
129
|
-
// authSessionsCmd
|
|
130
|
-
// .command("create")
|
|
131
|
-
// .action((args) => CMDFN.authSessionsCreate(ctx, args))
|
|
132
|
-
// authSessionsCmd
|
|
133
|
-
// .command("list")
|
|
134
|
-
// .action((args) => CMDFN.authSessionsList(ctx, args))
|
|
135
|
-
// authSessionsCmd
|
|
136
|
-
// .command("get")
|
|
137
|
-
// .action((args) => CMDFN.authSessionsGet(ctx, args))
|
|
138
|
-
|
|
139
|
-
const packagesCmd = cmd.command("packages").description("Manage packages")
|
|
140
|
-
|
|
141
|
-
packagesCmd.command("list").action((args) => CMDFN.packagesList(ctx, args))
|
|
142
|
-
packagesCmd
|
|
143
|
-
.command("get")
|
|
144
|
-
.description("Get information about a package")
|
|
145
|
-
.option("--package-id <package_id>", "Package Id")
|
|
146
|
-
.option("--name <name>", "Package name")
|
|
147
|
-
.action((args) => CMDFN.packagesGet(ctx, args))
|
|
148
|
-
packagesCmd
|
|
149
|
-
.command("create")
|
|
150
|
-
.description("Create a new package")
|
|
151
|
-
.requiredOption("--name <name>", "Package name")
|
|
152
|
-
.option("--author-id <author_account_id>", "Author Id")
|
|
153
|
-
.option("--description <description>", "Package description")
|
|
154
|
-
.action((args) => CMDFN.packagesCreate(ctx, args))
|
|
155
|
-
|
|
156
|
-
const packageReleases = cmd.command("package_releases")
|
|
157
|
-
|
|
158
|
-
packageReleases
|
|
159
|
-
.command("list")
|
|
160
|
-
.description("List all package releases for a package")
|
|
161
|
-
.requiredOption("--package-name <package_name>", "Package name")
|
|
162
|
-
.option("--verbose", "Verbose objects (includes uuids)")
|
|
163
|
-
.action((args) => CMDFN.packageReleasesList(ctx, args))
|
|
164
|
-
// packageReleases
|
|
165
|
-
// .command("get")
|
|
166
|
-
// .description("Get information about a package release")
|
|
167
|
-
// .action((args) => CMDFN.packageReleasesGet(ctx, args))
|
|
168
|
-
packageReleases
|
|
169
|
-
.command("create")
|
|
170
|
-
.description("Create a new package release")
|
|
171
|
-
.option(
|
|
172
|
-
"-p, --package-name-with-version <package_name_with_version>",
|
|
173
|
-
"Package name and version",
|
|
174
|
-
)
|
|
175
|
-
.option("--package-name <package_name>", "Package name")
|
|
176
|
-
.option("--release-version <release_version>", "Version to publish")
|
|
177
|
-
.action((args) => CMDFN.packageReleasesCreate(ctx, args))
|
|
178
|
-
packageReleases
|
|
179
|
-
.command("update")
|
|
180
|
-
.description("Update a package release")
|
|
181
|
-
.option(
|
|
182
|
-
"-p, --package-name-with-version <package_name_with_version>",
|
|
183
|
-
"Package name and version",
|
|
184
|
-
)
|
|
185
|
-
.option("--is-latest", "Make package release the latest version")
|
|
186
|
-
.option("--is-locked", "Lock the release")
|
|
187
|
-
.action((args) => CMDFN.packageReleasesUpdate(ctx, args))
|
|
188
|
-
|
|
189
|
-
const packageFiles = cmd
|
|
190
|
-
.command("package_files")
|
|
191
|
-
.description("Manage package release files")
|
|
192
|
-
|
|
193
|
-
packageFiles
|
|
194
|
-
.command("list")
|
|
195
|
-
.description("List all files for a package release")
|
|
196
|
-
.option(
|
|
197
|
-
"--package-name-with-version <package_name_with_version>",
|
|
198
|
-
"Package name with version",
|
|
199
|
-
)
|
|
200
|
-
.option(
|
|
201
|
-
"--package-name <package_name>",
|
|
202
|
-
"Package name (use latest version)",
|
|
203
|
-
)
|
|
204
|
-
.option("--package-release-id <package_release_id>", "Package Release Id")
|
|
205
|
-
.action((args) => CMDFN.packageFilesList(ctx, args))
|
|
206
|
-
// packageFiles.command("get").action((args) => CMDFN.packageFilesGet(ctx, args))
|
|
207
|
-
packageFiles
|
|
208
|
-
.command("download")
|
|
209
|
-
.description("Download a file from a package release")
|
|
210
|
-
.requiredOption(
|
|
211
|
-
"--package-name-with-version <package_name_with_version>",
|
|
212
|
-
"Package name and version",
|
|
213
|
-
)
|
|
214
|
-
.requiredOption("--remote-file-path <remote_file_path>", "Remote file path")
|
|
215
|
-
.option(
|
|
216
|
-
"--output <output>",
|
|
217
|
-
"Output file path (optional), prints to stdout if not provided",
|
|
218
|
-
)
|
|
219
|
-
.action((args) => CMDFN.packageFilesDownload(ctx, args))
|
|
220
|
-
packageFiles
|
|
221
|
-
.command("create")
|
|
222
|
-
.description("Create/upload a new package file")
|
|
223
|
-
.option(
|
|
224
|
-
"-p, --package-release-id <package_release_id>",
|
|
225
|
-
"Package Release Id",
|
|
226
|
-
)
|
|
227
|
-
.option(
|
|
228
|
-
"--package-name-with-version <package_name_with_version>",
|
|
229
|
-
"Package name with version e.g. @tscircuit/arduino@1.2.3",
|
|
230
|
-
)
|
|
231
|
-
.requiredOption("--file <file>", "File to upload")
|
|
232
|
-
.action((args) => CMDFN.packageFilesCreate(ctx, args))
|
|
233
|
-
|
|
234
|
-
// packageFiles
|
|
235
|
-
// .command("upload-directory")
|
|
236
|
-
// .description("Upload a directory of files to a package release")
|
|
237
|
-
// .requiredOption("--dir <dir>", "Directory to upload")
|
|
238
|
-
// .action((args) => CMDFN.packageFilesUploadDirectory(ctx, args))
|
|
239
|
-
|
|
240
|
-
const packageExamples = cmd
|
|
241
|
-
.command("package_examples")
|
|
242
|
-
.description("Manage package release examples")
|
|
243
|
-
|
|
244
|
-
packageExamples
|
|
245
|
-
.command("list")
|
|
246
|
-
.description("List all examples for a package")
|
|
247
|
-
.requiredOption("--package-name-with-version <package_name_with_version>")
|
|
248
|
-
.action((args) => CMDFN.packageExamplesList(ctx, args))
|
|
249
|
-
packageExamples
|
|
250
|
-
.command("get")
|
|
251
|
-
.description("Get information about a package example")
|
|
252
|
-
.requiredOption("--package-example-id <package_example_id>")
|
|
253
|
-
.action((args) => CMDFN.packageExamplesGet(ctx, args))
|
|
254
|
-
packageExamples
|
|
255
|
-
.command("create")
|
|
256
|
-
.description("Create a new package example")
|
|
257
|
-
.requiredOption("--package-name-with-version <package_name_with_version>")
|
|
258
|
-
.requiredOption("--file <file>")
|
|
259
|
-
.option("--export <export>", "Name of export to soupify")
|
|
260
|
-
.action((args) => CMDFN.packageExamplesCreate(ctx, args))
|
|
261
|
-
|
|
262
|
-
cmd
|
|
263
|
-
.command("publish")
|
|
264
|
-
.description("Publish a package release to the tscircuit registry")
|
|
265
|
-
.option("--increment", "Increase patch version", true)
|
|
266
|
-
.option("--patch", "Increase patch version")
|
|
267
|
-
.option("--lock", "Lock the release after publishing to prevent changes")
|
|
268
|
-
.action((args) => CMDFN.publish(ctx, args))
|
|
269
|
-
|
|
270
|
-
cmd
|
|
271
|
-
.command("version")
|
|
272
|
-
.description("Print current version")
|
|
273
|
-
.option("--show-latest", "Show latest versions of dependencies")
|
|
274
|
-
.action((args) => CMDFN.version(ctx, args))
|
|
275
|
-
|
|
276
|
-
cmd
|
|
277
|
-
.command("login")
|
|
278
|
-
.description("Authenticate CLI, login to registry")
|
|
279
|
-
.action((args) => CMDFN.authLogin(ctx, args))
|
|
280
|
-
cmd
|
|
281
|
-
.command("logout")
|
|
282
|
-
.description("Clear your local authentication")
|
|
283
|
-
.action((args) => CMDFN.authLogout(ctx, args))
|
|
284
|
-
|
|
285
|
-
const exportCmd = cmd
|
|
286
|
-
.command("export")
|
|
287
|
-
.description("Export Gerbers, Drill Files, Netlists and more")
|
|
288
|
-
|
|
289
|
-
exportCmd
|
|
290
|
-
.command("gerbers")
|
|
291
|
-
.description("Export Gerber files from an example file")
|
|
292
|
-
.option(
|
|
293
|
-
"--file <file>",
|
|
294
|
-
"Input example file (deprecated, use --input instead)",
|
|
295
|
-
)
|
|
296
|
-
.option("--input <input>", "Input example file")
|
|
297
|
-
.option(
|
|
298
|
-
"--export <export_name>",
|
|
299
|
-
"Name of export to soupify, if not specified, soupify the default/only export",
|
|
300
|
-
)
|
|
301
|
-
.option("--outputfile <outputfile>", "Output file name", "gerbers.zip")
|
|
302
|
-
.action((args) => CMDFN.exportGerbers(ctx, args))
|
|
303
|
-
|
|
304
|
-
exportCmd
|
|
305
|
-
.command("kicad_pcb")
|
|
306
|
-
.description("Export KiCad PCB file from an example file")
|
|
307
|
-
.option("--input <input>", "Input example file")
|
|
308
|
-
.option(
|
|
309
|
-
"--export <export_name>",
|
|
310
|
-
"Name of export to soupify, if not specified, soupify the default/only export",
|
|
311
|
-
)
|
|
312
|
-
.option("--outputfile <outputfile>", "Output file name", "output.kicad_pcb")
|
|
313
|
-
.action((args) => CMDFN.exportKicadPcb(ctx, args))
|
|
314
|
-
|
|
315
|
-
exportCmd
|
|
316
|
-
.command("pnp_csv")
|
|
317
|
-
.description("Export Plug n Play CSV file from an example file")
|
|
318
|
-
.option("--input <input>", "Input example file")
|
|
319
|
-
.option(
|
|
320
|
-
"--export <export_name>",
|
|
321
|
-
"Name of export to soupify, if not specified, soupify the default/only export",
|
|
322
|
-
)
|
|
323
|
-
.option("--outputfile <outputfile>", "Output file name", "pnp.csv")
|
|
324
|
-
.action((args) => CMDFN.exportPnpCsv(ctx, args))
|
|
325
|
-
|
|
326
|
-
cmd
|
|
327
|
-
.command("soupify")
|
|
328
|
-
.description("Convert an example file to tscircuit soup")
|
|
329
|
-
.requiredOption("--file <file>", "Input example files")
|
|
330
|
-
.option("--output <output.json>", "Output file")
|
|
331
|
-
.option("--no-core", "Use @tscircuit/core to build (future version)", false)
|
|
332
|
-
.option(
|
|
333
|
-
"--export <export_name>",
|
|
334
|
-
"Name of export to soupify, if not specified, soupify the default/only export",
|
|
335
|
-
)
|
|
336
|
-
.action((args) => CMDFN.soupify(ctx, args))
|
|
337
|
-
|
|
338
|
-
cmd
|
|
339
|
-
.command("install")
|
|
340
|
-
.description("Install a package from the tscircuit registry")
|
|
341
|
-
.argument(
|
|
342
|
-
"<packages...>",
|
|
343
|
-
"Packages to install from registry.tscircuit.com, optionally with version",
|
|
344
|
-
)
|
|
345
|
-
.option("-D, --dev", "Add to devDependencies")
|
|
346
|
-
.action((packages, flags) => CMDFN.install(ctx, { packages, flags }))
|
|
347
|
-
|
|
348
|
-
cmd
|
|
349
|
-
.command("uninstall")
|
|
350
|
-
.description("Uninstall a package")
|
|
351
|
-
.argument("<packages...>", "Packages to uninstall")
|
|
352
|
-
.action((packages, flags) => CMDFN.install(ctx, { packages, flags }))
|
|
353
|
-
|
|
354
|
-
const devServerCmd = cmd
|
|
355
|
-
.command("dev-server")
|
|
356
|
-
.description("(Advanced) Manage the development server")
|
|
357
|
-
|
|
358
|
-
devServerCmd
|
|
359
|
-
.command("upload")
|
|
360
|
-
.description("Upload a directory to the dev server")
|
|
361
|
-
.option(
|
|
362
|
-
"--dir <dir>",
|
|
363
|
-
"Directory to upload (defaults to current directory)",
|
|
364
|
-
)
|
|
365
|
-
.option("-w, --watch", "Watch for changes")
|
|
366
|
-
.option("-p, --port", "Port dev server is running on (default: 3020)")
|
|
367
|
-
.action((args) => CMDFN.devServerUpload(ctx, args))
|
|
368
|
-
|
|
369
|
-
devServerCmd
|
|
370
|
-
.command("fulfill-export-requests")
|
|
371
|
-
.action((args) => CMDFN.devServerFulfillExportRequests(ctx, args))
|
|
372
|
-
|
|
373
|
-
cmd
|
|
374
|
-
.command("open")
|
|
375
|
-
.description("Open browser to package on tscircuit registry")
|
|
376
|
-
.action((args) => CMDFN.open(ctx, args))
|
|
377
|
-
|
|
378
|
-
function recursiveUnhelp(cmd: Command) {
|
|
379
|
-
cmd.helpCommand(false)
|
|
380
|
-
for (const c of cmd.commands) {
|
|
381
|
-
recursiveUnhelp(c)
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
recursiveUnhelp(cmd)
|
|
385
|
-
|
|
386
|
-
return cmd
|
|
387
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { interactForLocalDirectory } from "./interact-for-local-directory"
|
|
2
|
-
import { interactForLocalFile } from "./interact-for-local-file"
|
|
3
|
-
import { interactForPackageExampleId } from "./interact-for-package-example-id"
|
|
4
|
-
import { interactForPackageName } from "./interact-for-package-name"
|
|
5
|
-
import { interactForPackageNameWithVersion } from "./interact-for-package-name-with-version"
|
|
6
|
-
import { interactForPackageReleaseId } from "./interact-for-package-release-id"
|
|
7
|
-
import { interactForRegistryUrl } from "./interact-for-registry-url"
|
|
8
|
-
import { interactForRuntime } from "./interact-for-runtime"
|
|
9
|
-
import { ParamHandler } from "./param-handler-type"
|
|
10
|
-
|
|
11
|
-
export const PARAM_HANDLERS_BY_PARAM_NAME: Record<string, ParamHandler> = {
|
|
12
|
-
file: interactForLocalFile,
|
|
13
|
-
cwd: interactForLocalDirectory,
|
|
14
|
-
dir: interactForLocalDirectory,
|
|
15
|
-
registry_url: interactForRegistryUrl,
|
|
16
|
-
runtime: interactForRuntime,
|
|
17
|
-
package_release_id: interactForPackageReleaseId,
|
|
18
|
-
package_name: interactForPackageName,
|
|
19
|
-
package_name_with_version: interactForPackageNameWithVersion,
|
|
20
|
-
package_example_id: interactForPackageExampleId,
|
|
21
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ParamHandler } from "./param-handler-type"
|
|
2
|
-
import * as fs from "fs/promises"
|
|
3
|
-
|
|
4
|
-
export const interactForLocalDirectory: ParamHandler = async ({ prompts }) => {
|
|
5
|
-
const { selectionMode } = await prompts({
|
|
6
|
-
type: "select",
|
|
7
|
-
name: "selectionMode",
|
|
8
|
-
message: "Select a directory",
|
|
9
|
-
choices: [
|
|
10
|
-
{ title: "Manually Enter Path", value: "manual" },
|
|
11
|
-
{ title: "Browse for Directory", value: "browse" },
|
|
12
|
-
],
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
if (selectionMode === "manual") {
|
|
16
|
-
const { manualPath } = await prompts({
|
|
17
|
-
type: "text",
|
|
18
|
-
name: "manualPath",
|
|
19
|
-
message: "Enter the path to the directory",
|
|
20
|
-
})
|
|
21
|
-
return manualPath
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let currentDirectory = "."
|
|
25
|
-
while (true) {
|
|
26
|
-
const files = await fs.readdir(currentDirectory)
|
|
27
|
-
const dirChoices = files
|
|
28
|
-
.filter((d) => !d.includes("."))
|
|
29
|
-
.map((file) => ({ title: file, value: file }))
|
|
30
|
-
const { selectedDir } = await prompts({
|
|
31
|
-
type: "autocomplete",
|
|
32
|
-
name: "selectedDir",
|
|
33
|
-
message: "Select a directory",
|
|
34
|
-
initial: "__select__",
|
|
35
|
-
choices: [
|
|
36
|
-
{ title: ".. (Go Up)", value: ".." },
|
|
37
|
-
{ title: `["${currentDirectory}"]`, value: "__select__" },
|
|
38
|
-
...dirChoices,
|
|
39
|
-
],
|
|
40
|
-
})
|
|
41
|
-
if (selectedDir === "..") {
|
|
42
|
-
// Go up one directory
|
|
43
|
-
const lastIndex = currentDirectory.lastIndexOf("/")
|
|
44
|
-
currentDirectory = currentDirectory.substring(0, lastIndex)
|
|
45
|
-
} else if (selectedDir === "__select__") {
|
|
46
|
-
return currentDirectory
|
|
47
|
-
} else {
|
|
48
|
-
// Check if selectedFile is a file or directory
|
|
49
|
-
const stats = await fs.stat(`${currentDirectory}/${selectedDir}`)
|
|
50
|
-
if (stats.isFile()) {
|
|
51
|
-
throw new Error("Selected file is a file, not a directory")
|
|
52
|
-
} else {
|
|
53
|
-
// Go into the selected directory
|
|
54
|
-
currentDirectory = `${currentDirectory}/${selectedDir}`
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ParamHandler } from "./param-handler-type"
|
|
2
|
-
import * as fs from "fs/promises"
|
|
3
|
-
|
|
4
|
-
// Use prompts to allow searching for a file
|
|
5
|
-
// 1. Show a prompt with two options
|
|
6
|
-
// - "Manually Enter Path"
|
|
7
|
-
// - "Browse for File"
|
|
8
|
-
// 2. If Browse for File is selected, show all the files in the current
|
|
9
|
-
// directory with the "autocomplete" prompts type, then allow the user
|
|
10
|
-
// to select a file or directory
|
|
11
|
-
export const interactForLocalFile: ParamHandler = async ({ prompts }) => {
|
|
12
|
-
const { selectionMode } = await prompts({
|
|
13
|
-
type: "select",
|
|
14
|
-
name: "selectionMode",
|
|
15
|
-
message: "Select a file",
|
|
16
|
-
choices: [
|
|
17
|
-
{ title: "Manually Enter Path", value: "manual" },
|
|
18
|
-
{ title: "Browse for File", value: "browse" },
|
|
19
|
-
],
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
if (selectionMode === "manual") {
|
|
23
|
-
const { manualPath } = await prompts({
|
|
24
|
-
type: "text",
|
|
25
|
-
name: "manualPath",
|
|
26
|
-
message: "Enter the path to the file",
|
|
27
|
-
})
|
|
28
|
-
return manualPath
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let currentDirectory = "."
|
|
32
|
-
while (true) {
|
|
33
|
-
const files = await fs.readdir(currentDirectory)
|
|
34
|
-
const { selectedFile } = await prompts({
|
|
35
|
-
type: "autocomplete",
|
|
36
|
-
name: "selectedFile",
|
|
37
|
-
message: "Select a file or directory",
|
|
38
|
-
choices: [
|
|
39
|
-
{ title: ".. (Go Up)", value: ".." },
|
|
40
|
-
...files.map((file) => ({ title: file, value: file })),
|
|
41
|
-
],
|
|
42
|
-
})
|
|
43
|
-
if (selectedFile === "..") {
|
|
44
|
-
// Go up one directory
|
|
45
|
-
const lastIndex = currentDirectory.lastIndexOf("/")
|
|
46
|
-
currentDirectory = currentDirectory.substring(0, lastIndex)
|
|
47
|
-
} else {
|
|
48
|
-
// Check if selectedFile is a file or directory
|
|
49
|
-
const stats = await fs.stat(`${currentDirectory}/${selectedFile}`)
|
|
50
|
-
if (stats.isFile()) {
|
|
51
|
-
// Break out of the loop and return the selected file
|
|
52
|
-
return `${currentDirectory}/${selectedFile}`
|
|
53
|
-
} else {
|
|
54
|
-
// Go into the selected directory
|
|
55
|
-
currentDirectory = `${currentDirectory}/${selectedFile}`
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { interactForPackageReleaseId } from "./interact-for-package-release-id"
|
|
2
|
-
import { ParamHandler } from "./param-handler-type"
|
|
3
|
-
|
|
4
|
-
export const interactForPackageExampleId: ParamHandler = async (params) => {
|
|
5
|
-
const { prompts, ctx } = params
|
|
6
|
-
const package_release_id = await interactForPackageReleaseId(params)
|
|
7
|
-
|
|
8
|
-
const package_examples = await ctx.axios
|
|
9
|
-
.post("/package_examples/list", {
|
|
10
|
-
package_release_id,
|
|
11
|
-
})
|
|
12
|
-
.then((r) => r.data.package_examples)
|
|
13
|
-
|
|
14
|
-
const { package_example_id } = await prompts({
|
|
15
|
-
type: "autocomplete",
|
|
16
|
-
name: "package_example_id",
|
|
17
|
-
message: "Select a package example",
|
|
18
|
-
choices: package_examples.map((p: any) => ({
|
|
19
|
-
title: `${p.file_path} (${p.export_name})`,
|
|
20
|
-
value: p.package_example_id,
|
|
21
|
-
})),
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
return package_example_id
|
|
25
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { ParamHandler } from "./param-handler-type"
|
|
2
|
-
|
|
3
|
-
export const interactForPackageNameWithVersion: ParamHandler = async ({
|
|
4
|
-
prompts,
|
|
5
|
-
ctx,
|
|
6
|
-
}) => {
|
|
7
|
-
// Find all package names by this user
|
|
8
|
-
const myPackages: Array<{ name: string; latest_version: string }> =
|
|
9
|
-
await ctx.axios
|
|
10
|
-
.post("/packages/list", {
|
|
11
|
-
is_writable: true,
|
|
12
|
-
})
|
|
13
|
-
.then((r) => r.data.packages)
|
|
14
|
-
|
|
15
|
-
// Autocomplete prompts with all packages, first option is "Enter Manually"
|
|
16
|
-
const { selectedPackage } = await prompts({
|
|
17
|
-
type: "autocomplete",
|
|
18
|
-
name: "selectedPackage",
|
|
19
|
-
message: "Select a package",
|
|
20
|
-
choices: [
|
|
21
|
-
{
|
|
22
|
-
title: "Enter Manually",
|
|
23
|
-
value: null,
|
|
24
|
-
},
|
|
25
|
-
...myPackages.flatMap((p) => [
|
|
26
|
-
{
|
|
27
|
-
title: `${p.name}@${p.latest_version}`,
|
|
28
|
-
value: `${p.name}@${p.latest_version}`,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
title: `${p.name}@...`,
|
|
32
|
-
value: `${p.name}@...`,
|
|
33
|
-
},
|
|
34
|
-
]),
|
|
35
|
-
],
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
if (selectedPackage.endsWith("@...")) {
|
|
39
|
-
// TODO Poll for all versions available
|
|
40
|
-
|
|
41
|
-
const { version } = await prompts({
|
|
42
|
-
type: "text",
|
|
43
|
-
name: "version",
|
|
44
|
-
message: "Enter the version",
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
return selectedPackage.replace("@...", `@${version}`)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (selectedPackage === "Enter Manually") {
|
|
51
|
-
const { packageName } = await prompts({
|
|
52
|
-
type: "text",
|
|
53
|
-
name: "packageName",
|
|
54
|
-
message: "Enter the package name",
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
return packageName
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// TODO cache recently selected packages
|
|
61
|
-
|
|
62
|
-
return selectedPackage
|
|
63
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ParamHandler } from "./param-handler-type"
|
|
2
|
-
import * as fs from "fs/promises"
|
|
3
|
-
|
|
4
|
-
export const interactForPackageName: ParamHandler = async ({
|
|
5
|
-
prompts,
|
|
6
|
-
ctx,
|
|
7
|
-
}) => {
|
|
8
|
-
// Find all package names by this user
|
|
9
|
-
const myPackages: Array<{ name: string }> = await ctx.axios
|
|
10
|
-
.post("/packages/list", {
|
|
11
|
-
is_writable: true,
|
|
12
|
-
})
|
|
13
|
-
.then((r) => r.data.packages)
|
|
14
|
-
|
|
15
|
-
// Autocomplete prompts with all packages, first option is "Enter Manually"
|
|
16
|
-
const { selectedPackage } = await prompts({
|
|
17
|
-
type: "autocomplete",
|
|
18
|
-
name: "selectedPackage",
|
|
19
|
-
message: "Select a package",
|
|
20
|
-
choices: [
|
|
21
|
-
{
|
|
22
|
-
title: "Enter Manually",
|
|
23
|
-
value: null,
|
|
24
|
-
},
|
|
25
|
-
...myPackages.map((p) => ({
|
|
26
|
-
title: p.name,
|
|
27
|
-
value: p.name,
|
|
28
|
-
})),
|
|
29
|
-
],
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
if (selectedPackage === "Enter Manually") {
|
|
33
|
-
const { packageName } = await prompts({
|
|
34
|
-
type: "text",
|
|
35
|
-
name: "packageName",
|
|
36
|
-
message: "Enter the package name",
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return packageName
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// TODO cache recently selected packages
|
|
43
|
-
|
|
44
|
-
return selectedPackage
|
|
45
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { interactForPackageNameWithVersion } from "./interact-for-package-name-with-version"
|
|
2
|
-
import { ParamHandler } from "./param-handler-type"
|
|
3
|
-
|
|
4
|
-
export const interactForPackageReleaseId: ParamHandler = async (params) => {
|
|
5
|
-
const { ctx, prompts } = params
|
|
6
|
-
|
|
7
|
-
const package_name_with_version =
|
|
8
|
-
await interactForPackageNameWithVersion(params)
|
|
9
|
-
|
|
10
|
-
return await ctx.axios
|
|
11
|
-
.post("/package_releases/get", {
|
|
12
|
-
package_name_with_version,
|
|
13
|
-
})
|
|
14
|
-
.then((r) => r.data.package_release.package_release_id)
|
|
15
|
-
}
|