Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
fixed the repo for windows
Browse files Browse the repository at this point in the history
* fixed filepath bug

* format

* export now works for windows

* building static-routes now works on windows

* cleanup

* cleanup 2
  • Loading branch information
ShiboSoftwareDev authored Sep 28, 2024
1 parent 1187321 commit 7ad4fc5
Show file tree
Hide file tree
Showing 25 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion api/db/generic-json-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
AbstractValueIterator,
} from "abstract-level"
import { promises as fs } from "fs"
import path from "path"
import path from "path/posix"

interface JSONLevelOptions {}

Expand Down
2 changes: 1 addition & 1 deletion api/db/get-db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mkdirSync } from "fs"
import * as Path from "path"
import * as Path from "path/posix"
import { ZodLevelDatabase } from "./zod-level-db"

let globalDb: ZodLevelDatabase | undefined
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/dev/check-if-initialized.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../../util/app-context"
import kleur from "kleur"
import * as Path from "path"
import * as Path from "path/posix"
import { existsSync, readFileSync } from "fs"

export const checkIfInitialized = async (ctx: AppContext) => {
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from "fs"
import kleur from "kleur"
import posthog from "cli/lib/posthog"
import open from "open"
import * as Path from "path"
import * as Path from "path/posix"
import prompts from "prompts"
import { z } from "zod"
import { AppContext } from "../../util/app-context"
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import kleur from "kleur"
import { join as joinPath } from "path"
import { join as joinPath } from "path/posix"
import { AxiosInstance } from "axios"
import { readdirSync, readFileSync } from "fs"
import { soupify } from "cli/lib/soupify"
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/dev/start-edit-event-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppContext } from "cli/lib/util/app-context"
import fg from "fast-glob"
import fs from "fs"
import { Project, ts } from "ts-morph"
import * as Path from "path"
import * as Path from "path/posix"
import { deriveSelectorFromPcbComponentId } from "./derive-selector-from-pcb-component-id"
import type { EditEvent } from "@tscircuit/manual-edit-events"
import {
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/dev/upload-examples-from-directory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import kleur from "kleur"
import { join as joinPath } from "path"
import { join as joinPath } from "path/posix"
import { AxiosInstance } from "axios"
import { readdirSync, readFileSync } from "fs"
import { soupify } from "cli/lib/soupify"
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/init/create-or-modify-npmrc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync, writeFileSync } from "fs"
import kleur from "kleur"
import * as Path from "path"
import * as Path from "path/posix"
import { getGeneratedNpmrc } from "./get-generated-npmrc"
import { AppContext } from "cli/lib/util/app-context"

Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
writeFile,
appendFileSync,
} from "fs"
import * as Path from "node:path"
import * as Path from "node:path/posix"
import $ from "dax-sh"
import { getGeneratedReadme } from "./get-generated-readme"
import { getGeneratedTsconfig } from "./get-generated-tsconfig"
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/open.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from "fs"
import kleur from "kleur"
import { AppContext } from "cli/lib/util/app-context"
import * as Path from "path"
import * as Path from "path/posix"
import open from "open"

export const openCmd = async (ctx: AppContext, args: any) => {
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/publish/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import kleur from "kleur"
import { z } from "zod"
import { AppContext } from "../../util/app-context"
import * as Path from "path"
import * as Path from "path/posix"
import * as fs from "fs/promises"
import { existsSync, readFileSync } from "fs"
import { getAllPackageFiles } from "cli/lib/util/get-all-package-files"
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/render.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { soupify } from "cli/lib/soupify"
import type { AppContext } from "cli/lib/util/app-context"
import fs from "fs"
import path from "path"
import path from "path/posix"

export const renderCmd = async (
ctx: AppContext,
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/soupify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../util/app-context"
import { z } from "zod"
import * as Path from "path"
import * as Path from "path/posix"
import { unlink } from "node:fs/promises"
import { soupify } from "cli/lib/soupify"
import { writeFileSync } from "fs"
Expand Down
3 changes: 1 addition & 2 deletions cli/lib/export-fns/export-gerbers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../util/app-context"
import { z } from "zod"
import * as Path from "path"
import * as Path from "path/posix"
import { unlink } from "node:fs/promises"
import { soupify } from "cli/lib/soupify"
import * as fs from "fs"
Expand Down Expand Up @@ -91,7 +91,6 @@ export const exportGerbersToZipBuffer = async (
) => {
const tempDir = Path.join(".tscircuit", "tmp-gerber-zip")
fs.mkdirSync(tempDir, { recursive: true })

await exportGerbersToFile(
{
example_file_path: params.example_file_path,
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/export-fns/export-pnp-csv.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppContext } from "../util/app-context"
import { z } from "zod"
import * as Path from "path"
import * as Path from "path/posix"
import { unlink } from "node:fs/promises"
import { soupify } from "cli/lib/soupify"
import { convertCircuitJsonToPickAndPlaceCsv } from "circuit-json-to-pnp-csv"
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/soupify/get-tmp-entrpoint-filepath.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Path from "node:path"
import Path from "node:path/posix"
import fs from "fs/promises"

export const getTmpEntrypointFilePath = async (filePath: string) => {
Expand Down
5 changes: 2 additions & 3 deletions cli/lib/soupify/run-entrypoint-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const runEntrypointFile = async (
ctx.runtime === "node"
? $`npx tsx ${tmpEntrypointPath}`
: $`bun ${tmpEntrypointPath}`

debug(`starting process....`)

const processResult = await processCmdPart1
.stdout(debug.enabled ? "inheritPiped" : "piped")
.stderr(debug.enabled ? "inheritPiped" : "piped")
.stdout(debug.enabled ? "inheritPiped" : "piped")
.noThrow()

const rawSoup = await readFile(tmpOutputPath, "utf-8")
Expand All @@ -48,7 +48,6 @@ export const runEntrypointFile = async (
console.log(kleur.red(soup.COMPILE_ERROR))
throw new Error(soup.COMPILE_ERROR)
}

return soup
} catch (e: any) {
// console.log(kleur.red(`Failed to parse result of soupify: ${e.toString()}`))
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/soupify/soupify-with-core.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AppContext } from "../util/app-context"
import { z } from "zod"
import $ from "dax-sh"
import * as Path from "path"
import * as Path from "path/posix"
import { unlink } from "node:fs/promises"
import kleur from "kleur"
import { writeFileSync } from "fs"
Expand Down
6 changes: 5 additions & 1 deletion cli/lib/util/create-context-and-run-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export const createContextAndRunProgram = async (process_args: any) => {
},
)

function isBunRuntime() {
return typeof process !== "undefined" && "isBun" in process
}

const ctx: AppContext = {
cmd: args._,
cwd: args.cwd ?? process.cwd(),
Expand All @@ -112,7 +116,7 @@ export const createContextAndRunProgram = async (process_args: any) => {
axios,
global_config,
profile_config,
runtime: global_config.get("runtime") ?? "node",
runtime: isBunRuntime() ? "bun" : (global_config.get("runtime") ?? "node"),
args: {
cmd: args._,
yes: args.y ?? args.yes,
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/util/lint-project.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ts from "typescript"
import * as fs from "fs"
import * as path from "path"
import * as path from "path/posix"

interface LintResult {
filePath: string
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/export-gerber-keyboard.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect, describe } from "bun:test"
import { $ } from "bun"
import { temporaryDirectory } from "tempy"
import { join } from "path"
import { join } from "path/posix"
import { existsSync } from "fs"

test("tsci export gerbers --input example-project/examples/macrokeypad.tsx", async () => {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/export-gerber.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect, describe } from "bun:test"
import { $ } from "bun"
import { temporaryDirectory } from "tempy"
import { join } from "path"
import { join } from "path/posix"
import { existsSync, readdirSync, readFileSync } from "fs"
import extract from "extract-zip"
import pcbStackup from "pcb-stackup"
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/export-kicad-pcb.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect, describe } from "bun:test"
import { $ } from "bun"
import { temporaryDirectory } from "tempy"
import { join } from "path"
import { join } from "path/posix"
import { existsSync, readFileSync } from "fs"

test("tsci export kicad_pcb --input example-project/examples/macrokeypad.tsx", async () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"tempy": "^3.1.0",
"ts-morph": "^22.0.0",
"tsup": "^8.0.2",
"winterspec": "0.0.86",
"winterspec": "0.0.89",
"zod": "^3.22.4"
},
"peerDependencies": {
Expand Down

0 comments on commit 7ad4fc5

Please sign in to comment.