@tscircuit/cli 0.0.75 → 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.75",
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": {