@tscircuit/cli 0.0.74 → 0.0.76

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.
@@ -91,6 +91,7 @@ export const initCmd = async (ctx: AppContext, args: any) => {
91
91
  packageJson.scripts ??= {}
92
92
  packageJson.scripts.start = "npm run dev"
93
93
  packageJson.scripts.dev = "tsci dev"
94
+ packageJson.scripts.build = "tsup ./index.ts --sourcemap --dts"
94
95
  writeFileSync("package.json", JSON.stringify(packageJson, null, 2))
95
96
 
96
97
  console.log(`Adding ".tscircuit" to .gitignore`)
@@ -44,15 +44,38 @@ export const publish = async (ctx: AppContext, args: any) => {
44
44
  )
45
45
  }
46
46
 
47
- await esbuild.build({
48
- entryPoints: ["index.ts"], // TODO dynamically determine entrypoint
49
- bundle: true,
50
- platform: "node",
51
- packages: "external",
52
- outdir: "dist",
53
- })
47
+ // This works but doesn't emit types, we're just going to build somewhat
48
+ // normally for now
49
+ // await esbuild.build({
50
+ // entryPoints: ["index.ts"], // TODO dynamically determine entrypoint
51
+ // bundle: true,
52
+ // platform: "node",
53
+ // packages: "external",
54
+ // outdir: "dist",
55
+ // })
56
+ await $`npm run build`
57
+
58
+ if (packageJson.module) {
59
+ console.log(kleur.yellow("package.json module field detected. Removing..."))
60
+ delete packageJson.module
61
+ await fs.writeFile(
62
+ Path.join(ctx.cwd, "package.json"),
63
+ JSON.stringify(packageJson, null, 2)
64
+ )
65
+ }
54
66
 
55
- // Publish to npm??
67
+ if (packageJson.main !== "./dist/index.cjs") {
68
+ console.log(
69
+ kleur.yellow(
70
+ `package.json main field is not set to "./dist/index.cjs". Setting it...`
71
+ )
72
+ )
73
+ packageJson.main = "./dist/index.cjs"
74
+ await fs.writeFile(
75
+ Path.join(ctx.cwd, "package.json"),
76
+ JSON.stringify(packageJson, null, 2)
77
+ )
78
+ }
56
79
 
57
80
  // Upload to tscircuit registry
58
81
  // 1. Get the package name and version from package.json
@@ -31,12 +31,15 @@ export const exportGerbersToFile = async (
31
31
  )
32
32
 
33
33
  console.log(kleur.gray("[soup to gerber json]..."))
34
- const gerber_layer_cmds = convertSoupToGerberCommands(soup)
34
+ const gerber_layer_cmds = convertSoupToGerberCommands(soup, {
35
+ flip_y_axis: true,
36
+ })
35
37
 
36
38
  console.log(kleur.gray("[soup to drl json]..."))
37
39
  const drill_cmds = convertSoupToExcellonDrillCommands({
38
40
  soup,
39
41
  is_plated: true,
42
+ flip_y_axis: true,
40
43
  })
41
44
 
42
45
  console.log(kleur.gray("[stringify gerber json]..."))
@@ -48,6 +51,7 @@ export const exportGerbersToFile = async (
48
51
 
49
52
  console.log(kleur.gray("[writing gerbers to tmp dir]..."))
50
53
  const tempDir = Path.join(".tscircuit", "tmp-gerber-export")
54
+ fs.rmSync(tempDir, { recursive: true, force: true })
51
55
  fs.mkdirSync(tempDir, { recursive: true })
52
56
  for (const [fileName, fileContents] of Object.entries(gerber_file_contents)) {
53
57
  const filePath = Path.join(tempDir, fileName)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Command line tool for developing, publishing and installing tscircuit circuits",
@@ -63,6 +63,7 @@
63
63
  "prompts": "^2.4.2",
64
64
  "react": "^18.2.0",
65
65
  "semver": "^7.6.0",
66
+ "tsup": "^8.0.2",
66
67
  "zod": "latest"
67
68
  },
68
69
  "devDependencies": {