@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
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ParamHandler } from "./param-handler-type"
|
|
2
|
-
|
|
3
|
-
export const interactForRegistryUrl: ParamHandler = async (params) => {
|
|
4
|
-
const { prompts, ctx } = params
|
|
5
|
-
|
|
6
|
-
const { registry_url } = await prompts({
|
|
7
|
-
type: "select",
|
|
8
|
-
name: "registry_url",
|
|
9
|
-
message: "Select a package example",
|
|
10
|
-
choices: [
|
|
11
|
-
"https://registry-api.tscircuit.com",
|
|
12
|
-
"http://127.0.0.1:3100",
|
|
13
|
-
"other",
|
|
14
|
-
].map((a) => ({ title: a, value: a })),
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
if (registry_url === "other") {
|
|
18
|
-
const { registry_url } = await prompts({
|
|
19
|
-
type: "text",
|
|
20
|
-
name: "registry_url",
|
|
21
|
-
message: "Enter the registry url",
|
|
22
|
-
})
|
|
23
|
-
return registry_url
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return registry_url
|
|
27
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import kleur from "kleur"
|
|
2
|
-
import { ParamHandler } from "./param-handler-type"
|
|
3
|
-
import $ from "dax-sh"
|
|
4
|
-
|
|
5
|
-
export const interactForRuntime: ParamHandler = async (params) => {
|
|
6
|
-
const { prompts, ctx } = params
|
|
7
|
-
|
|
8
|
-
const bunVersion = await $`bun --version`.text().catch((e) => null)
|
|
9
|
-
|
|
10
|
-
if (!bunVersion) {
|
|
11
|
-
console.log(
|
|
12
|
-
kleur.red(`BUN IS NOT INSTALLED! Install bun first https://bun.sh/`),
|
|
13
|
-
)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const { runtime } = await prompts({
|
|
17
|
-
type: "select",
|
|
18
|
-
name: "runtime",
|
|
19
|
-
message: "Select a runtime",
|
|
20
|
-
choices: [
|
|
21
|
-
{
|
|
22
|
-
title: "bun",
|
|
23
|
-
value: "bun",
|
|
24
|
-
description: bunVersion
|
|
25
|
-
? `bun version: ${bunVersion}`
|
|
26
|
-
: "NOTE: bun not installed, install bun first!",
|
|
27
|
-
},
|
|
28
|
-
{ title: "node", value: "node" },
|
|
29
|
-
],
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
return runtime
|
|
33
|
-
}
|
package/cli/lib/posthog.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { PostHog } from "posthog-node"
|
|
2
|
-
|
|
3
|
-
const POSTHOG_API_KEY: string | undefined = process.env.POSTHOG_API_KEY
|
|
4
|
-
|
|
5
|
-
let posthogInstance: PostHog | null = null
|
|
6
|
-
|
|
7
|
-
if (POSTHOG_API_KEY) {
|
|
8
|
-
posthogInstance = new PostHog(POSTHOG_API_KEY, {
|
|
9
|
-
host: "https://us.i.posthog.com",
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const posthogProxy = new Proxy<PostHog>({} as PostHog, {
|
|
14
|
-
get(target, prop) {
|
|
15
|
-
if (posthogInstance) {
|
|
16
|
-
return Reflect.get(posthogInstance, prop)
|
|
17
|
-
}
|
|
18
|
-
// Return a no-op function for any method call if PostHog is not initialized
|
|
19
|
-
return () => {}
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export default posthogProxy
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises"
|
|
2
|
-
import Debug from "debug"
|
|
3
|
-
|
|
4
|
-
const debug = Debug("tscircuit:soupify")
|
|
5
|
-
|
|
6
|
-
export const getExportNameFromFile = async (filePath: string) => {
|
|
7
|
-
debug(`reading ${filePath}`)
|
|
8
|
-
const targetFileContent = await readFile(filePath, "utf-8")
|
|
9
|
-
|
|
10
|
-
let exportName: string | undefined
|
|
11
|
-
if (targetFileContent.includes("export default")) {
|
|
12
|
-
exportName = "default"
|
|
13
|
-
} else {
|
|
14
|
-
// Look for "export const <name>" or "export function <name>"
|
|
15
|
-
const exportRegex = /export\s+(?:const|function)\s+(\w+)/g
|
|
16
|
-
const match = exportRegex.exec(targetFileContent)
|
|
17
|
-
if (match) {
|
|
18
|
-
exportName = match[1]
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!exportName) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
`Couldn't derive an export name and didn't find default export in "${filePath}"`,
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return exportName
|
|
29
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Path from "node:path/posix"
|
|
2
|
-
import fs from "fs/promises"
|
|
3
|
-
|
|
4
|
-
export const getTmpEntrypointFilePath = async (filePath: string) => {
|
|
5
|
-
const tmpEntrypointPath = Path.resolve(
|
|
6
|
-
Path.dirname(filePath),
|
|
7
|
-
Path.basename(filePath).replace(/\.[^\.]+$/, "") + ".__tmp_entrypoint.tsx",
|
|
8
|
-
)
|
|
9
|
-
const tmpOutputPath = Path.resolve(
|
|
10
|
-
Path.dirname(filePath),
|
|
11
|
-
Path.basename(filePath).replace(/\.[^\.]+$/, "") + ".__tmp_output.json",
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
return { tmpEntrypointPath, tmpOutputPath }
|
|
15
|
-
}
|
package/cli/lib/soupify/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./soupify"
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import Debug from "debug"
|
|
2
|
-
import { writeFileSync } from "fs"
|
|
3
|
-
import { readFile, unlink } from "node:fs/promises"
|
|
4
|
-
import $ from "dax-sh"
|
|
5
|
-
import kleur from "kleur"
|
|
6
|
-
import { AppContext } from "../util/app-context"
|
|
7
|
-
|
|
8
|
-
const debug = Debug("tscircuit:soupify")
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Runs the entrypoint file to generate circuit json (soup) for a given file
|
|
12
|
-
*/
|
|
13
|
-
export const runEntrypointFile = async (
|
|
14
|
-
{
|
|
15
|
-
tmpEntrypointPath,
|
|
16
|
-
tmpOutputPath,
|
|
17
|
-
}: { tmpEntrypointPath: string; tmpOutputPath: string },
|
|
18
|
-
ctx: Pick<AppContext, "runtime" | "params">,
|
|
19
|
-
) => {
|
|
20
|
-
debug(`using runtime ${ctx.runtime}`)
|
|
21
|
-
const processCmdPart1 =
|
|
22
|
-
ctx.runtime === "node"
|
|
23
|
-
? $`npx tsx ${tmpEntrypointPath}`
|
|
24
|
-
: $`bun ${tmpEntrypointPath}`
|
|
25
|
-
debug(`starting process....`)
|
|
26
|
-
|
|
27
|
-
const processResult = await processCmdPart1
|
|
28
|
-
.stderr(debug.enabled ? "inheritPiped" : "piped")
|
|
29
|
-
.stdout(debug.enabled ? "inheritPiped" : "piped")
|
|
30
|
-
.noThrow()
|
|
31
|
-
|
|
32
|
-
const rawSoup = await readFile(tmpOutputPath, "utf-8")
|
|
33
|
-
const errText = processResult.stderr
|
|
34
|
-
|
|
35
|
-
if (ctx.params.cleanup !== false) {
|
|
36
|
-
debug(`deleting ${tmpEntrypointPath}`)
|
|
37
|
-
await unlink(tmpEntrypointPath)
|
|
38
|
-
debug(`deleting ${tmpOutputPath}`)
|
|
39
|
-
await unlink(tmpOutputPath)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
debug(`parsing result of soupify...`)
|
|
44
|
-
const soup = JSON.parse(rawSoup)
|
|
45
|
-
|
|
46
|
-
if (soup.COMPILE_ERROR) {
|
|
47
|
-
// console.log(kleur.red(`Failed to compile ${filePath}`))
|
|
48
|
-
console.log(kleur.red(soup.COMPILE_ERROR))
|
|
49
|
-
throw new Error(soup.COMPILE_ERROR)
|
|
50
|
-
}
|
|
51
|
-
return soup
|
|
52
|
-
} catch (e: any) {
|
|
53
|
-
// console.log(kleur.red(`Failed to parse result of soupify: ${e.toString()}`))
|
|
54
|
-
const t = Date.now()
|
|
55
|
-
console.log(`Dumping raw output to .tscircuit/err-${t}.log`)
|
|
56
|
-
writeFileSync(`.tscircuit/err-${t}.log`, rawSoup + "\n\n" + errText)
|
|
57
|
-
throw new Error(errText)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { AppContext } from "../util/app-context"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import $ from "dax-sh"
|
|
4
|
-
import * as Path from "path/posix"
|
|
5
|
-
import { unlink } from "node:fs/promises"
|
|
6
|
-
import kleur from "kleur"
|
|
7
|
-
import { writeFileSync } from "fs"
|
|
8
|
-
import { readFile } from "fs/promises"
|
|
9
|
-
import Debug from "debug"
|
|
10
|
-
import { getExportNameFromFile } from "./get-export-name-from-file"
|
|
11
|
-
import { getTmpEntrypointFilePath } from "./get-tmp-entrpoint-filepath"
|
|
12
|
-
import { runEntrypointFile } from "./run-entrypoint-file"
|
|
13
|
-
import fs from "node:fs/promises"
|
|
14
|
-
|
|
15
|
-
const debug = Debug("tscircuit:soupify")
|
|
16
|
-
|
|
17
|
-
export const soupifyWithCore = async (
|
|
18
|
-
params: {
|
|
19
|
-
filePath: string
|
|
20
|
-
exportName?: string
|
|
21
|
-
},
|
|
22
|
-
ctx: Pick<AppContext, "runtime" | "params">,
|
|
23
|
-
) => {
|
|
24
|
-
let { filePath, exportName } = params
|
|
25
|
-
|
|
26
|
-
exportName ??= await getExportNameFromFile(filePath)
|
|
27
|
-
|
|
28
|
-
const { tmpEntrypointPath, tmpOutputPath } =
|
|
29
|
-
await getTmpEntrypointFilePath(filePath)
|
|
30
|
-
|
|
31
|
-
// Remove existing entrypoint or tmp output files
|
|
32
|
-
await fs.unlink(tmpEntrypointPath).catch(() => {})
|
|
33
|
-
await fs.unlink(tmpOutputPath).catch(() => {})
|
|
34
|
-
|
|
35
|
-
debug(`writing to ${tmpEntrypointPath}`)
|
|
36
|
-
writeFileSync(
|
|
37
|
-
tmpEntrypointPath,
|
|
38
|
-
`
|
|
39
|
-
import React from "react"
|
|
40
|
-
import { Circuit } from "@tscircuit/core"
|
|
41
|
-
import * as EXPORTS from "./${Path.basename(filePath)}"
|
|
42
|
-
import { writeFileSync } from "node:fs"
|
|
43
|
-
|
|
44
|
-
const Component = EXPORTS["${exportName}"]
|
|
45
|
-
|
|
46
|
-
const project = new Circuit()
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
project.add(<Component />)
|
|
50
|
-
} catch (e: any) {
|
|
51
|
-
console.log("[during .add()] ", e.toString())
|
|
52
|
-
writeFileSync("${tmpOutputPath}", JSON.stringify({
|
|
53
|
-
COMPILE_ERROR: e.toString() + "\\n\\n" + e.stack,
|
|
54
|
-
}))
|
|
55
|
-
throw e
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
project.render()
|
|
60
|
-
} catch (e: any) {
|
|
61
|
-
console.log(e.toString())
|
|
62
|
-
writeFileSync("${tmpOutputPath}", JSON.stringify({
|
|
63
|
-
COMPILE_ERROR: e.toString() + "\\n\\n" + e.stack,
|
|
64
|
-
}))
|
|
65
|
-
throw e
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
writeFileSync("${tmpOutputPath}", JSON.stringify(project.getCircuitJson()))
|
|
70
|
-
`.trim(),
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
return await runEntrypointFile({ tmpEntrypointPath, tmpOutputPath }, ctx)
|
|
74
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from "axios"
|
|
2
|
-
import { ContextConfigProps } from "cli/lib/create-config-manager"
|
|
3
|
-
|
|
4
|
-
export type AppContext = {
|
|
5
|
-
args: {
|
|
6
|
-
cmd: string[]
|
|
7
|
-
yes: boolean
|
|
8
|
-
help: boolean | undefined
|
|
9
|
-
}
|
|
10
|
-
cwd: string
|
|
11
|
-
cmd: string[]
|
|
12
|
-
params: Record<string, any>
|
|
13
|
-
registry_url: string
|
|
14
|
-
axios: AxiosInstance
|
|
15
|
-
current_profile: string
|
|
16
|
-
runtime: "node" | "bun"
|
|
17
|
-
} & ContextConfigProps
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import Configstore from "configstore"
|
|
2
|
-
import type { AppContext } from "./app-context"
|
|
3
|
-
import minimist from "minimist"
|
|
4
|
-
import _ from "lodash"
|
|
5
|
-
import prompts from "prompts"
|
|
6
|
-
import { perfectCli } from "perfect-cli"
|
|
7
|
-
import { getProgram } from "../get-program"
|
|
8
|
-
import defaultAxios from "axios"
|
|
9
|
-
import kleur from "kleur"
|
|
10
|
-
import { PARAM_HANDLERS_BY_PARAM_NAME } from "cli/lib/param-handlers"
|
|
11
|
-
import { createConfigHandler } from "cli/lib/create-config-manager"
|
|
12
|
-
import dargs from "dargs"
|
|
13
|
-
import { versionCmd } from "cli/lib/cmd-fns/version"
|
|
14
|
-
|
|
15
|
-
export type CliArgs = {
|
|
16
|
-
cmd: string[]
|
|
17
|
-
yes?: boolean
|
|
18
|
-
help?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const createContextAndRunProgram = async (process_args: string[]) => {
|
|
22
|
-
const args = minimist(process_args)
|
|
23
|
-
|
|
24
|
-
const { global_config, profile_config, current_profile } =
|
|
25
|
-
createConfigHandler({
|
|
26
|
-
profile: args.profile,
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
// Load registry commands
|
|
30
|
-
const registry_url =
|
|
31
|
-
profile_config.get("registry_url") ?? "https://registry-api.tscircuit.com"
|
|
32
|
-
|
|
33
|
-
// TODO don't replace non-command args with underscores
|
|
34
|
-
args._ = args._.map((p: string) => p.toLowerCase().replace(/-/g, "_"))
|
|
35
|
-
|
|
36
|
-
// If flags are provided with dashes, switch them to underscores
|
|
37
|
-
for (const key in args) {
|
|
38
|
-
if (key.includes("-")) {
|
|
39
|
-
args[key.replace(/-/g, "_")] = args[key]
|
|
40
|
-
delete args[key]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const axios = defaultAxios.create({
|
|
45
|
-
baseURL: registry_url,
|
|
46
|
-
headers: {
|
|
47
|
-
Authorization: `Bearer ${profile_config.get("session_token")}`,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
// https://github.com/oven-sh/bun/issues/267
|
|
52
|
-
axios.defaults.headers.common["Accept-Encoding"] = "gzip"
|
|
53
|
-
|
|
54
|
-
if (global_config.get("log_requests")) {
|
|
55
|
-
console.log(`Using registry_url: ${registry_url}`)
|
|
56
|
-
axios.interceptors.request.use((req) => {
|
|
57
|
-
console.log(kleur.grey(`[REQ] ${req.method?.toUpperCase()} ${req.url}`))
|
|
58
|
-
return req
|
|
59
|
-
})
|
|
60
|
-
axios.interceptors.response.use((res) => {
|
|
61
|
-
console.log(
|
|
62
|
-
kleur.grey(
|
|
63
|
-
`[RES] ${res.status} ${res.config.method?.toUpperCase()} ${
|
|
64
|
-
res.config.url
|
|
65
|
-
}`,
|
|
66
|
-
),
|
|
67
|
-
)
|
|
68
|
-
return res
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
axios.interceptors.response.use(
|
|
73
|
-
(res) => res,
|
|
74
|
-
(err) => {
|
|
75
|
-
// ---- IGNORE LOGGING *_not_found --------
|
|
76
|
-
if (
|
|
77
|
-
err.config.data?.error?.error_code === "package_not_found" ||
|
|
78
|
-
err.config.data?.error?.error_code === "package_release_not_found"
|
|
79
|
-
) {
|
|
80
|
-
return Promise.reject(err)
|
|
81
|
-
}
|
|
82
|
-
// end ignores ---
|
|
83
|
-
|
|
84
|
-
if (err.response?.status === 401) {
|
|
85
|
-
console.log(
|
|
86
|
-
kleur.red(
|
|
87
|
-
"Authentication failed. Please run 'tsci login' to authenticate yourself.",
|
|
88
|
-
),
|
|
89
|
-
)
|
|
90
|
-
process.exit(1)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
console.log(
|
|
94
|
-
kleur.red(
|
|
95
|
-
`[ERR] ${err.response?.status} ${err.config.method?.toUpperCase()} ${
|
|
96
|
-
err.config.url
|
|
97
|
-
}\n\n${JSON.stringify(err.response?.data, null, " ")}`
|
|
98
|
-
.replace(/\\n/g, "\n")
|
|
99
|
-
.replace(/\\"/g, '"'),
|
|
100
|
-
),
|
|
101
|
-
)
|
|
102
|
-
console.log(kleur.yellow("[Request Body]:"), err.config.data)
|
|
103
|
-
return Promise.reject(err)
|
|
104
|
-
},
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
function isBunRuntime() {
|
|
108
|
-
return typeof process !== "undefined" && "isBun" in process
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const ctx: AppContext = {
|
|
112
|
-
cmd: args._,
|
|
113
|
-
cwd: args.cwd ?? process.cwd(),
|
|
114
|
-
current_profile,
|
|
115
|
-
registry_url,
|
|
116
|
-
axios,
|
|
117
|
-
global_config,
|
|
118
|
-
profile_config,
|
|
119
|
-
runtime: isBunRuntime() ? "bun" : (global_config.get("runtime") ?? "node"),
|
|
120
|
-
args: {
|
|
121
|
-
cmd: args._,
|
|
122
|
-
yes: args.y ?? args.yes,
|
|
123
|
-
help: undefined,
|
|
124
|
-
},
|
|
125
|
-
params: args,
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (args["color"] === false) {
|
|
129
|
-
kleur.enabled = false
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
delete args["cwd"]
|
|
133
|
-
delete args["color"]
|
|
134
|
-
|
|
135
|
-
const { _: positional, ...flagsAndParams } = args
|
|
136
|
-
const args_without_globals = positional.concat(dargs(flagsAndParams))
|
|
137
|
-
|
|
138
|
-
if (args["version"] && args._.length === 2) {
|
|
139
|
-
await versionCmd(ctx, {})
|
|
140
|
-
process.exit(0)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// HACK: Fixes issue with tsci version --show-latest
|
|
144
|
-
if (args_without_globals.includes("--show_latest")) {
|
|
145
|
-
args_without_globals[args_without_globals.indexOf("--show_latest")] =
|
|
146
|
-
"--show-latest"
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
await perfectCli(getProgram(ctx), args_without_globals, {
|
|
150
|
-
async customParamHandler({ commandPath, optionName }, { prompts }) {
|
|
151
|
-
let optionNameHandler =
|
|
152
|
-
PARAM_HANDLERS_BY_PARAM_NAME[_.snakeCase(optionName)]
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
commandPath.join(" ") === "config set-registry" &&
|
|
156
|
-
optionName === "server"
|
|
157
|
-
) {
|
|
158
|
-
optionNameHandler = PARAM_HANDLERS_BY_PARAM_NAME["registry_url"]
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (optionNameHandler) {
|
|
162
|
-
return optionNameHandler({ prompts, ctx })
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
return ctx
|
|
168
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs/promises"
|
|
2
|
-
import { AppContext } from "./app-context"
|
|
3
|
-
import * as Glob from "glob"
|
|
4
|
-
import ignore from "ignore"
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get all package files
|
|
8
|
-
*
|
|
9
|
-
* Package files are any files that aren't explicitly ignored in the
|
|
10
|
-
* .npmignore (or if that doesn't exist, the .gitignore). All package
|
|
11
|
-
* files must have a .ts or .tsx extension.
|
|
12
|
-
*
|
|
13
|
-
* Returns an array of files paths.
|
|
14
|
-
*/
|
|
15
|
-
export const getAllPackageFiles = async (
|
|
16
|
-
ctx: AppContext,
|
|
17
|
-
): Promise<Array<string>> => {
|
|
18
|
-
await ensureNodeModulesIgnored()
|
|
19
|
-
|
|
20
|
-
const [gitIgnore, promptIgnore, npmIgnore] = await Promise.all([
|
|
21
|
-
readIgnoreFile("./.gitignore"),
|
|
22
|
-
readIgnoreFile("./.promptignore"),
|
|
23
|
-
readIgnoreFile("./.npmignore"),
|
|
24
|
-
])
|
|
25
|
-
|
|
26
|
-
const npmAndPromptIgnoreFiles = [
|
|
27
|
-
...(promptIgnore ?? []),
|
|
28
|
-
...(npmIgnore ?? []),
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
const ig = ignore().add([
|
|
32
|
-
...(npmAndPromptIgnoreFiles.length > 0
|
|
33
|
-
? npmAndPromptIgnoreFiles
|
|
34
|
-
: (gitIgnore ?? [])),
|
|
35
|
-
".tscircuit",
|
|
36
|
-
"node_modules/*",
|
|
37
|
-
])
|
|
38
|
-
|
|
39
|
-
return Glob.globSync("**/*.{ts,tsx,md}", {}).filter((fp) => !ig.ignores(fp))
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const readIgnoreFile = async (filePath: string): Promise<string[] | null> =>
|
|
43
|
-
await fs
|
|
44
|
-
.readFile(filePath)
|
|
45
|
-
.then((b) => b.toString().split("\n").filter(Boolean))
|
|
46
|
-
.catch((e) => null)
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Ensure 'node_modules/' is in .gitignore
|
|
50
|
-
*/
|
|
51
|
-
const ensureNodeModulesIgnored = async () => {
|
|
52
|
-
const gitignorePath = "./.gitignore"
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
const gitignore = await fs.readFile(gitignorePath, "utf8")
|
|
56
|
-
if (!gitignore.includes("node_modules/")) {
|
|
57
|
-
await fs.appendFile(gitignorePath, "\nnode_modules/\n")
|
|
58
|
-
}
|
|
59
|
-
} catch (err) {
|
|
60
|
-
if ((err as NodeJS.ErrnoException).code === "ENOENT") {
|
|
61
|
-
await fs.writeFile(gitignorePath, "node_modules/\n")
|
|
62
|
-
} else {
|
|
63
|
-
console.error("Error while updating .gitignore:", err)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import * as ts from "typescript"
|
|
2
|
-
import * as fs from "fs"
|
|
3
|
-
import * as path from "path/posix"
|
|
4
|
-
|
|
5
|
-
interface LintResult {
|
|
6
|
-
filePath: string
|
|
7
|
-
messages: LintMessage[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface LintMessage {
|
|
11
|
-
line: number
|
|
12
|
-
column: number
|
|
13
|
-
message: string
|
|
14
|
-
fix?: {
|
|
15
|
-
range: [number, number]
|
|
16
|
-
text: string
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function lintProject(
|
|
21
|
-
projectPath: string,
|
|
22
|
-
fix: boolean = false,
|
|
23
|
-
): LintResult[] {
|
|
24
|
-
const results: LintResult[] = []
|
|
25
|
-
const files = getTypeScriptFiles(projectPath)
|
|
26
|
-
|
|
27
|
-
for (const file of files) {
|
|
28
|
-
const sourceFile = ts.createSourceFile(
|
|
29
|
-
file,
|
|
30
|
-
fs.readFileSync(file, "utf8"),
|
|
31
|
-
ts.ScriptTarget.Latest,
|
|
32
|
-
true,
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
const result = lintFile(sourceFile, fix)
|
|
36
|
-
if (result.messages.length > 0) {
|
|
37
|
-
results.push({ filePath: file, messages: result.messages })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (fix && result.messages.some((m) => m.fix)) {
|
|
41
|
-
const newContent = applyFixes(sourceFile.text, result.messages)
|
|
42
|
-
fs.writeFileSync(file, newContent)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return results
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function lintFile(
|
|
50
|
-
sourceFile: ts.SourceFile,
|
|
51
|
-
fix: boolean,
|
|
52
|
-
): { messages: LintMessage[] } {
|
|
53
|
-
const messages: LintMessage[] = []
|
|
54
|
-
|
|
55
|
-
function visit(node: ts.Node) {
|
|
56
|
-
if (
|
|
57
|
-
ts.isCallExpression(node) &&
|
|
58
|
-
ts.isIdentifier(node.expression) &&
|
|
59
|
-
node.expression.text === "capacitor"
|
|
60
|
-
) {
|
|
61
|
-
const valueArg = node.arguments.find((arg) =>
|
|
62
|
-
ts.isObjectLiteralExpression(arg),
|
|
63
|
-
)
|
|
64
|
-
if (valueArg && ts.isObjectLiteralExpression(valueArg)) {
|
|
65
|
-
const valueProp = valueArg.properties.find(
|
|
66
|
-
(prop) =>
|
|
67
|
-
ts.isPropertyAssignment(prop) &&
|
|
68
|
-
ts.isIdentifier(prop.name) &&
|
|
69
|
-
prop.name.text === "value",
|
|
70
|
-
)
|
|
71
|
-
if (
|
|
72
|
-
valueProp &&
|
|
73
|
-
ts.isPropertyAssignment(valueProp) &&
|
|
74
|
-
ts.isStringLiteral(valueProp.initializer)
|
|
75
|
-
) {
|
|
76
|
-
const value = valueProp.initializer.text
|
|
77
|
-
if (!value.match(/[µuμ]F$/)) {
|
|
78
|
-
const { line, character } =
|
|
79
|
-
sourceFile.getLineAndCharacterOfPosition(valueProp.getStart())
|
|
80
|
-
messages.push({
|
|
81
|
-
line: line + 1,
|
|
82
|
-
column: character + 1,
|
|
83
|
-
message: 'Capacitor value should include units (e.g., "100F")',
|
|
84
|
-
fix: fix
|
|
85
|
-
? {
|
|
86
|
-
range: [
|
|
87
|
-
valueProp.initializer.getStart(),
|
|
88
|
-
valueProp.initializer.getEnd(),
|
|
89
|
-
],
|
|
90
|
-
text: `"${value}F"`,
|
|
91
|
-
}
|
|
92
|
-
: undefined,
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
ts.forEachChild(node, visit)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
visit(sourceFile)
|
|
103
|
-
|
|
104
|
-
return { messages }
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function getTypeScriptFiles(dir: string): string[] {
|
|
108
|
-
const files: string[] = []
|
|
109
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
110
|
-
|
|
111
|
-
for (const entry of entries) {
|
|
112
|
-
const fullPath = path.join(dir, entry.name)
|
|
113
|
-
if (entry.isDirectory()) {
|
|
114
|
-
if (entry.name !== "node_modules" && entry.name !== "dist") {
|
|
115
|
-
files.push(...getTypeScriptFiles(fullPath))
|
|
116
|
-
}
|
|
117
|
-
} else if (entry.isFile() && /\.tsx?$/.test(entry.name)) {
|
|
118
|
-
files.push(fullPath)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return files
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function applyFixes(source: string, messages: LintMessage[]): string {
|
|
126
|
-
const fixes = messages
|
|
127
|
-
.filter((m) => m.fix)
|
|
128
|
-
.sort((a, b) => b.fix!.range[0] - a.fix!.range[0])
|
|
129
|
-
|
|
130
|
-
let result = source
|
|
131
|
-
for (const message of fixes) {
|
|
132
|
-
const [start, end] = message.fix!.range
|
|
133
|
-
result = result.slice(0, start) + message.fix!.text + result.slice(end)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return result
|
|
137
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { test, expect, describe } from "bun:test"
|
|
2
|
-
import { $ } from "bun"
|
|
3
|
-
import { temporaryDirectory } from "tempy"
|
|
4
|
-
import { join } from "path/posix"
|
|
5
|
-
import { existsSync } from "fs"
|
|
6
|
-
|
|
7
|
-
test("tsci export gerbers --input example-project/examples/macrokeypad.tsx", async () => {
|
|
8
|
-
const tempDir = temporaryDirectory()
|
|
9
|
-
const { stdout, stderr } =
|
|
10
|
-
await $`bun cli/cli.ts export gerbers --input example-project/examples/macrokeypad.tsx --outputfile ${join(tempDir, "gerbers.zip")} --no-color`
|
|
11
|
-
|
|
12
|
-
expect(stderr.toString()).toBe("")
|
|
13
|
-
expect(stdout.toString()).toContain("gerbers.zip")
|
|
14
|
-
|
|
15
|
-
expect(existsSync(join(tempDir, "gerbers.zip"))).toBe(true)
|
|
16
|
-
})
|