@tscircuit/cli 0.0.144 → 0.0.145
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/formatbot.yml +41 -0
- package/biome.json +44 -0
- package/bun.lockb +0 -0
- package/dev-server-api/bun.lockb +0 -0
- package/dev-server-api/routes/api/db/download.ts +2 -2
- package/dev-server-api/routes/api/dev_package_examples/get.ts +1 -1
- package/dev-server-api/routes/api/dev_package_examples/list.ts +2 -2
- package/dev-server-api/routes/api/dev_package_examples/update.ts +1 -1
- package/dev-server-api/routes/api/export_requests/get.ts +2 -2
- package/dev-server-api/routes/index.ts +1 -1
- package/dev-server-api/server.ts +1 -1
- package/dev-server-api/src/db/create-schema.ts +4 -4
- package/dev-server-api/src/db/generic-json-level.ts +2 -2
- package/dev-server-api/src/db/zod-level-db.ts +9 -9
- package/dev-server-api/src/middlewares/with-debug-request-logging.ts +1 -1
- package/dev-server-api/src/middlewares/with-error-response.ts +2 -2
- package/dev-server-api/tests/fixtures/start-server.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/create.test.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/get.test.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/list.test.ts +1 -1
- package/dev-server-api/tests/routes/dev_package_examples/update.test.ts +2 -2
- package/dev-server-api/tests/routes/export_files/download.test.ts +2 -2
- package/dev-server-api/tests/routes/export_requests/create.test.ts +1 -1
- package/dev-server-api/tests/routes/export_requests/get.test.ts +1 -1
- package/dev-server-frontend/.eslintrc.cjs +10 -10
- package/dev-server-frontend/components.json +1 -1
- package/dev-server-frontend/src/ExampleContentView.tsx +2 -2
- package/dev-server-frontend/src/HeaderMenu.tsx +2 -7
- package/dev-server-frontend/src/components/command-k.tsx +1 -1
- package/dev-server-frontend/src/components/dialogs/generic-export-dialog.tsx +3 -3
- package/dev-server-frontend/src/components/dialogs/gerber-export-dialog.tsx +3 -3
- package/dev-server-frontend/src/components/select-example-search.tsx +1 -1
- package/dev-server-frontend/src/components/ui/alert-dialog.tsx +5 -5
- package/dev-server-frontend/src/components/ui/alert.tsx +1 -1
- package/dev-server-frontend/src/components/ui/breadcrumb.tsx +1 -1
- package/dev-server-frontend/src/components/ui/button.tsx +2 -2
- package/dev-server-frontend/src/components/ui/card.tsx +1 -1
- package/dev-server-frontend/src/components/ui/command.tsx +5 -5
- package/dev-server-frontend/src/components/ui/context-menu.tsx +8 -8
- package/dev-server-frontend/src/components/ui/dialog.tsx +5 -5
- package/dev-server-frontend/src/components/ui/menubar.tsx +12 -12
- package/dev-server-frontend/src/components/ui/navigation-menu.tsx +6 -6
- package/dev-server-frontend/src/components/ui/popover.tsx +1 -1
- package/dev-server-frontend/src/components/ui/select.tsx +6 -6
- package/dev-server-frontend/src/components/ui/tabs.tsx +3 -3
- package/dev-server-frontend/src/components/ui/toggle-group.tsx +1 -1
- package/dev-server-frontend/src/components/ui/toggle.tsx +1 -1
- package/dev-server-frontend/src/components/ui/tooltip.tsx +1 -1
- package/dev-server-frontend/src/hooks/use-active-dev-package-example-lite.ts +2 -2
- package/dev-server-frontend/src/main.tsx +1 -1
- package/dev-server-frontend/tailwind.config.js +5 -5
- package/dev-server-frontend/tsconfig.json +1 -1
- package/dist/cli.js +14 -7
- package/example-project/src/manual-edits.ts +34 -34
- package/lib/cmd-fns/add.ts +1 -1
- package/lib/cmd-fns/auth-login.ts +2 -2
- package/lib/cmd-fns/dev/check-if-initialized.ts +1 -1
- package/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +1 -1
- package/lib/cmd-fns/dev/dev-server-request-handler.ts +3 -3
- package/lib/cmd-fns/dev/find-available-port.ts +7 -5
- package/lib/cmd-fns/dev/fulfill-export-requests.ts +14 -14
- package/lib/cmd-fns/dev/get-dev-server-axios.ts +3 -3
- package/lib/cmd-fns/dev/index.ts +3 -3
- package/lib/cmd-fns/dev/infer-export-name-from-source.ts +2 -2
- package/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +4 -4
- package/lib/cmd-fns/dev/start-edit-event-watcher.ts +37 -38
- package/lib/cmd-fns/dev/start-export-request-watcher.ts +2 -3
- package/lib/cmd-fns/dev/start-fs-watcher.ts +1 -1
- package/lib/cmd-fns/dev/upload-examples-from-directory.ts +2 -2
- package/lib/cmd-fns/dev-server-fulfill-export-requests.ts +3 -3
- package/lib/cmd-fns/dev-server-upload.ts +3 -3
- package/lib/cmd-fns/export-gerbers.ts +1 -1
- package/lib/cmd-fns/init/create-or-modify-npmrc.ts +1 -1
- package/lib/cmd-fns/init/index.ts +12 -8
- package/lib/cmd-fns/lint.ts +15 -9
- package/lib/cmd-fns/package-examples-create.ts +1 -1
- package/lib/cmd-fns/package-files-create.ts +1 -1
- package/lib/cmd-fns/package-files-upload-directory.ts +1 -1
- package/lib/cmd-fns/package-releases-create.ts +1 -1
- package/lib/cmd-fns/package-releases-list.ts +1 -1
- package/lib/cmd-fns/publish/index.ts +33 -33
- package/lib/cmd-fns/remove.ts +1 -1
- package/lib/cmd-fns/soupify.ts +1 -1
- package/lib/cmd-fns/version.ts +1 -1
- package/lib/create-config-manager.ts +1 -1
- package/lib/export-fns/export-bom-csv.ts +2 -2
- package/lib/export-fns/export-gerbers.ts +5 -5
- package/lib/export-fns/export-pnp-csv.ts +2 -2
- package/lib/get-program.ts +17 -17
- package/lib/param-handlers/interact-for-package-release-id.ts +2 -3
- package/lib/param-handlers/interact-for-runtime.ts +1 -1
- package/lib/posthog.ts +6 -7
- package/lib/soupify.ts +4 -4
- package/lib/util/create-context-and-run-program.ts +10 -6
- package/lib/util/get-all-package-files.ts +1 -1
- package/lib/util/lint-project.ts +79 -54
- package/package.json +4 -2
- package/renovate.json +2 -4
- package/tests/init.test.ts +1 -1
- package/tsconfig.json +13 -13
- package/tsup.config.ts +3 -3
|
@@ -104,10 +104,14 @@ export const initCmd = async (ctx: AppContext, args: any) => {
|
|
|
104
104
|
writeFileSync("package.json", JSON.stringify(packageJson, null, 2))
|
|
105
105
|
|
|
106
106
|
console.log(`Adding ".tscircuit" to .gitignore`)
|
|
107
|
-
appendFileSync(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
appendFileSync(
|
|
108
|
+
".gitignore",
|
|
109
|
+
"\n.tscircuit\n*.__tmp_entrypoint.tsx\ndist\nnode_modules\n",
|
|
110
|
+
{
|
|
111
|
+
encoding: "utf-8",
|
|
112
|
+
flag: "a+",
|
|
113
|
+
},
|
|
114
|
+
)
|
|
111
115
|
|
|
112
116
|
console.log("Add .npmrc with tscircuit registry...")
|
|
113
117
|
await createOrModifyNpmrc({ quiet: false }, ctx)
|
|
@@ -137,7 +141,7 @@ export default {
|
|
|
137
141
|
// Manual pcb placements, added when you drag a footprint
|
|
138
142
|
pcb_placements: [],
|
|
139
143
|
}
|
|
140
|
-
`.trim()
|
|
144
|
+
`.trim(),
|
|
141
145
|
)
|
|
142
146
|
|
|
143
147
|
writeFileSync(
|
|
@@ -155,7 +159,7 @@ export default {
|
|
|
155
159
|
/>
|
|
156
160
|
</group>
|
|
157
161
|
)
|
|
158
|
-
`.trim()
|
|
162
|
+
`.trim(),
|
|
159
163
|
)
|
|
160
164
|
|
|
161
165
|
writeFileSync("index.ts", `export * from "./lib/MyCircuit"`)
|
|
@@ -170,7 +174,7 @@ export const MyExample = () => (
|
|
|
170
174
|
<MyCircuit />
|
|
171
175
|
</board>
|
|
172
176
|
)
|
|
173
|
-
`.trim()
|
|
177
|
+
`.trim(),
|
|
174
178
|
)
|
|
175
179
|
|
|
176
180
|
// Override the README file
|
|
@@ -179,7 +183,7 @@ export const MyExample = () => (
|
|
|
179
183
|
getGeneratedReadme({
|
|
180
184
|
name: params.name!,
|
|
181
185
|
shouldHaveProjectGeneratedNotice: true,
|
|
182
|
-
})
|
|
186
|
+
}),
|
|
183
187
|
)
|
|
184
188
|
|
|
185
189
|
// Open tsconfig.json and modify it to import the tscircuit types
|
package/lib/cmd-fns/lint.ts
CHANGED
|
@@ -15,23 +15,29 @@ export const lintCmd = async (ctx: AppContext, args: any) => {
|
|
|
15
15
|
|
|
16
16
|
console.log(kleur.blue("Running tscircuit linter..."))
|
|
17
17
|
|
|
18
|
-
const results = lintProject(cwd, fix)
|
|
18
|
+
const results = lintProject(cwd, fix)
|
|
19
19
|
|
|
20
|
-
let errorCount = 0
|
|
20
|
+
let errorCount = 0
|
|
21
21
|
for (const result of results) {
|
|
22
22
|
if (result.messages.length > 0) {
|
|
23
|
-
console.log(kleur.yellow(`\nFile: ${result.filePath}`))
|
|
23
|
+
console.log(kleur.yellow(`\nFile: ${result.filePath}`))
|
|
24
24
|
for (const message of result.messages) {
|
|
25
|
-
console.log(
|
|
26
|
-
|
|
25
|
+
console.log(
|
|
26
|
+
` Line ${message.line}, Column ${message.column}: ${message.message}`,
|
|
27
|
+
)
|
|
28
|
+
errorCount++
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
if (errorCount > 0) {
|
|
32
|
-
console.log(
|
|
33
|
-
|
|
34
|
+
console.log(
|
|
35
|
+
kleur.yellow(
|
|
36
|
+
`\nFound ${errorCount} issue${errorCount === 1 ? "" : "s"} in your tscircuit code.`,
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
process.exit(1)
|
|
34
40
|
} else {
|
|
35
|
-
console.log(kleur.green("\nNo tscircuit-specific issues found!"))
|
|
41
|
+
console.log(kleur.green("\nNo tscircuit-specific issues found!"))
|
|
36
42
|
}
|
|
37
|
-
}
|
|
43
|
+
}
|
|
@@ -26,6 +26,6 @@ export const packageFilesCreate = async (ctx: AppContext, args: any) => {
|
|
|
26
26
|
.then((r) => r.data.package_file)
|
|
27
27
|
|
|
28
28
|
console.log(
|
|
29
|
-
`Package file created ${kleur.gray(package_file.package_file_id)}
|
|
29
|
+
`Package file created ${kleur.gray(package_file.package_file_id)}`,
|
|
30
30
|
)
|
|
31
31
|
}
|
|
@@ -30,6 +30,6 @@ export const packageReleasesCreate = async (ctx: AppContext, args: any) => {
|
|
|
30
30
|
.then((r) => r.data.package_release)
|
|
31
31
|
|
|
32
32
|
console.log(
|
|
33
|
-
`Package release created! ${kleur.gray(package_release.package_release_id)}
|
|
33
|
+
`Package release created! ${kleur.gray(package_release.package_release_id)}`,
|
|
34
34
|
)
|
|
35
35
|
}
|
|
@@ -31,7 +31,7 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const packageJson = JSON.parse(
|
|
34
|
-
await readFileSync(Path.join(ctx.cwd, "package.json"), "utf-8")
|
|
34
|
+
await readFileSync(Path.join(ctx.cwd, "package.json"), "utf-8"),
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
if (!packageJson.version) {
|
|
@@ -40,7 +40,7 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
40
40
|
packageJson.version = "0.0.1"
|
|
41
41
|
await fs.writeFile(
|
|
42
42
|
Path.join(ctx.cwd, "package.json"),
|
|
43
|
-
JSON.stringify(packageJson, null, 2)
|
|
43
|
+
JSON.stringify(packageJson, null, 2),
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -60,44 +60,44 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
60
60
|
delete packageJson.module
|
|
61
61
|
await fs.writeFile(
|
|
62
62
|
Path.join(ctx.cwd, "package.json"),
|
|
63
|
-
JSON.stringify(packageJson, null, 2)
|
|
63
|
+
JSON.stringify(packageJson, null, 2),
|
|
64
64
|
)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (packageJson.main !== "./dist/index.cjs") {
|
|
68
68
|
console.log(
|
|
69
69
|
kleur.yellow(
|
|
70
|
-
`package.json "main" field is not set to "./dist/index.cjs". Setting it
|
|
71
|
-
)
|
|
70
|
+
`package.json "main" field is not set to "./dist/index.cjs". Setting it...`,
|
|
71
|
+
),
|
|
72
72
|
)
|
|
73
73
|
packageJson.main = "./dist/index.cjs"
|
|
74
74
|
await fs.writeFile(
|
|
75
75
|
Path.join(ctx.cwd, "package.json"),
|
|
76
|
-
JSON.stringify(packageJson, null, 2)
|
|
76
|
+
JSON.stringify(packageJson, null, 2),
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
if (packageJson.types !== "./index.ts") {
|
|
80
80
|
console.log(
|
|
81
81
|
kleur.yellow(
|
|
82
|
-
`package.json "types" field is not set to "./index.ts". Setting it
|
|
83
|
-
)
|
|
82
|
+
`package.json "types" field is not set to "./index.ts". Setting it...`,
|
|
83
|
+
),
|
|
84
84
|
)
|
|
85
85
|
packageJson.types = "./index.ts"
|
|
86
86
|
await fs.writeFile(
|
|
87
87
|
Path.join(ctx.cwd, "package.json"),
|
|
88
|
-
JSON.stringify(packageJson, null, 2)
|
|
88
|
+
JSON.stringify(packageJson, null, 2),
|
|
89
89
|
)
|
|
90
90
|
}
|
|
91
91
|
if (!packageJson.files) {
|
|
92
92
|
console.log(
|
|
93
93
|
kleur.yellow(
|
|
94
|
-
`package.json "files" field is not set. Setting it to ["./dist", "index.ts", "./lib"]
|
|
95
|
-
)
|
|
94
|
+
`package.json "files" field is not set. Setting it to ["./dist", "index.ts", "./lib"]...`,
|
|
95
|
+
),
|
|
96
96
|
)
|
|
97
97
|
packageJson.files = ["dist", "index.ts", "lib"]
|
|
98
98
|
await fs.writeFile(
|
|
99
99
|
Path.join(ctx.cwd, "package.json"),
|
|
100
|
-
JSON.stringify(packageJson, null, 2)
|
|
100
|
+
JSON.stringify(packageJson, null, 2),
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -119,8 +119,8 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
119
119
|
if (!packageJson.name.includes("/")) {
|
|
120
120
|
console.log(
|
|
121
121
|
kleur.yellow(
|
|
122
|
-
`Package name "${packageJson.name}" is not scoped. Scoped package names are recommended on the tscircuit registry
|
|
123
|
-
)
|
|
122
|
+
`Package name "${packageJson.name}" is not scoped. Scoped package names are recommended on the tscircuit registry.`,
|
|
123
|
+
),
|
|
124
124
|
)
|
|
125
125
|
const myAccount = await ctx.axios
|
|
126
126
|
.get("/accounts/get")
|
|
@@ -143,7 +143,7 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
143
143
|
packageJson.name = `@${newScopedName}`
|
|
144
144
|
await fs.writeFile(
|
|
145
145
|
Path.join(ctx.cwd, "package.json"),
|
|
146
|
-
JSON.stringify(packageJson, null, 2)
|
|
146
|
+
JSON.stringify(packageJson, null, 2),
|
|
147
147
|
)
|
|
148
148
|
name = newScopedName
|
|
149
149
|
}
|
|
@@ -151,8 +151,8 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
151
151
|
|
|
152
152
|
console.log(
|
|
153
153
|
kleur.green(
|
|
154
|
-
`Creating package "${packageJson.name}" on tscircuit registry
|
|
155
|
-
)
|
|
154
|
+
`Creating package "${packageJson.name}" on tscircuit registry...`,
|
|
155
|
+
),
|
|
156
156
|
)
|
|
157
157
|
let description = packageJson.description
|
|
158
158
|
if (!description) {
|
|
@@ -182,28 +182,28 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
182
182
|
// 3. If it does, ask to increment the version or update the existing release, if increment is specified, increment the version automatically
|
|
183
183
|
if (existingRelease) {
|
|
184
184
|
console.log(
|
|
185
|
-
kleur.gray(`Package release already exists: ${name}@${version}`)
|
|
185
|
+
kleur.gray(`Package release already exists: ${name}@${version}`),
|
|
186
186
|
)
|
|
187
187
|
if (shouldIncrement) {
|
|
188
188
|
console.log(
|
|
189
189
|
kleur.green(
|
|
190
190
|
`Incrementing version from ${version} to ${semver.inc(
|
|
191
191
|
version,
|
|
192
|
-
"patch"
|
|
193
|
-
)}
|
|
194
|
-
)
|
|
192
|
+
"patch",
|
|
193
|
+
)}...`,
|
|
194
|
+
),
|
|
195
195
|
)
|
|
196
196
|
version = semver.inc(version, "patch")
|
|
197
197
|
packageJson.version = version
|
|
198
198
|
await fs.writeFile(
|
|
199
199
|
Path.join(ctx.cwd, "package.json"),
|
|
200
|
-
JSON.stringify(packageJson, null, 2)
|
|
200
|
+
JSON.stringify(packageJson, null, 2),
|
|
201
201
|
)
|
|
202
202
|
} else {
|
|
203
203
|
console.log(
|
|
204
204
|
kleur.blue(
|
|
205
|
-
`Want to increment the version and publish a new release? Use "--increment"
|
|
206
|
-
)
|
|
205
|
+
`Want to increment the version and publish a new release? Use "--increment"!`,
|
|
206
|
+
),
|
|
207
207
|
)
|
|
208
208
|
|
|
209
209
|
throw new Error("Package release already exists")
|
|
@@ -221,8 +221,8 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
221
221
|
if (!filePaths.includes("README.md")) {
|
|
222
222
|
console.log(
|
|
223
223
|
kleur.yellow(
|
|
224
|
-
"No README.md found in package files. A README.md is recommended on the tscircuit registry."
|
|
225
|
-
)
|
|
224
|
+
"No README.md found in package files. A README.md is recommended on the tscircuit registry.",
|
|
225
|
+
),
|
|
226
226
|
)
|
|
227
227
|
const { confirmReadme } = await prompts({
|
|
228
228
|
type: "confirm",
|
|
@@ -239,7 +239,7 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
239
239
|
if (confirmReadme) {
|
|
240
240
|
await fs.writeFile(
|
|
241
241
|
Path.join(ctx.cwd, "README.md"),
|
|
242
|
-
getGeneratedReadme({ name })
|
|
242
|
+
getGeneratedReadme({ name }),
|
|
243
243
|
)
|
|
244
244
|
filePaths.push("README.md")
|
|
245
245
|
}
|
|
@@ -270,12 +270,12 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
270
270
|
filePath,
|
|
271
271
|
exportName,
|
|
272
272
|
},
|
|
273
|
-
ctx
|
|
273
|
+
ctx,
|
|
274
274
|
).catch((e) => e)
|
|
275
275
|
|
|
276
276
|
if (tscircuit_soup instanceof Error) {
|
|
277
277
|
console.log(
|
|
278
|
-
kleur.red(`Error soupifying ${filePath}: ${tscircuit_soup}, skipping`)
|
|
278
|
+
kleur.red(`Error soupifying ${filePath}: ${tscircuit_soup}, skipping`),
|
|
279
279
|
)
|
|
280
280
|
continue
|
|
281
281
|
}
|
|
@@ -295,13 +295,13 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
295
295
|
const tmpTarballPath = Path.join(
|
|
296
296
|
ctx.cwd,
|
|
297
297
|
".tscircuit/tmp",
|
|
298
|
-
`${name.replace(/\//g, "-")}-${version}.tgz
|
|
298
|
+
`${name.replace(/\//g, "-")}-${version}.tgz`,
|
|
299
299
|
)
|
|
300
300
|
await fs.mkdir(Path.dirname(tmpTarballPath), { recursive: true })
|
|
301
301
|
const npm_pack_outputs = await $`cd ${
|
|
302
302
|
ctx.cwd
|
|
303
303
|
} && npm pack --json --pack-destination ${Path.dirname(
|
|
304
|
-
tmpTarballPath
|
|
304
|
+
tmpTarballPath,
|
|
305
305
|
)}`.json()
|
|
306
306
|
|
|
307
307
|
if (!existsSync(tmpTarballPath)) {
|
|
@@ -330,7 +330,7 @@ export const publish = async (ctx: AppContext, args: any) => {
|
|
|
330
330
|
|
|
331
331
|
console.log(
|
|
332
332
|
kleur.green(
|
|
333
|
-
`Published ${name}@${version}!\nhttps://registry.tscircuit.com/${name}
|
|
334
|
-
)
|
|
333
|
+
`Published ${name}@${version}!\nhttps://registry.tscircuit.com/${name}`,
|
|
334
|
+
),
|
|
335
335
|
)
|
|
336
336
|
}
|
package/lib/cmd-fns/remove.ts
CHANGED
|
@@ -26,6 +26,6 @@ export const removeCmd = async (ctx: AppContext, args: any) => {
|
|
|
26
26
|
console.log(kleur.gray(`> ${cmd}`))
|
|
27
27
|
|
|
28
28
|
await $`npm remove ${flagsString} ${params.packages.map(
|
|
29
|
-
(p) => `@tsci/${p.replace(/\//, ".")}
|
|
29
|
+
(p) => `@tsci/${p.replace(/\//, ".")}`,
|
|
30
30
|
)}`
|
|
31
31
|
}
|
package/lib/cmd-fns/soupify.ts
CHANGED
package/lib/cmd-fns/version.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const versionCmd = async (ctx: AppContext, args: any) => {
|
|
|
33
33
|
for (const row of table) {
|
|
34
34
|
const { name } = row
|
|
35
35
|
const { data: packageInfo } = await ctx.axios.get(
|
|
36
|
-
"https://registry.npmjs.org/" + name
|
|
36
|
+
"https://registry.npmjs.org/" + name,
|
|
37
37
|
)
|
|
38
38
|
row.latest = packageInfo["dist-tags"].latest
|
|
39
39
|
}
|
|
@@ -74,7 +74,7 @@ export const createConfigHandler = ({
|
|
|
74
74
|
profile?: string
|
|
75
75
|
}): ContextConfigProps => {
|
|
76
76
|
const global_config: TypedConfigstore<GlobalConfigProps> = new Configstore(
|
|
77
|
-
"tsci"
|
|
77
|
+
"tsci",
|
|
78
78
|
)
|
|
79
79
|
const current_profile =
|
|
80
80
|
profile ?? global_config.get("current_profile") ?? "default"
|
|
@@ -8,7 +8,7 @@ export const exportBomCsvToBuffer = async (
|
|
|
8
8
|
example_file_path: string
|
|
9
9
|
export_name?: string
|
|
10
10
|
},
|
|
11
|
-
ctx: AppContext
|
|
11
|
+
ctx: AppContext,
|
|
12
12
|
) => {
|
|
13
13
|
console.log(kleur.gray("[soupifying]..."))
|
|
14
14
|
const soup = await soupify(
|
|
@@ -16,7 +16,7 @@ export const exportBomCsvToBuffer = async (
|
|
|
16
16
|
filePath: params.example_file_path,
|
|
17
17
|
exportName: params.export_name,
|
|
18
18
|
},
|
|
19
|
-
ctx
|
|
19
|
+
ctx,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
console.log(kleur.gray("[soup to bom rows]..."))
|
|
@@ -19,7 +19,7 @@ export const exportGerbersToFile = async (
|
|
|
19
19
|
export_name?: string
|
|
20
20
|
output_zip_path: string
|
|
21
21
|
},
|
|
22
|
-
ctx: AppContext
|
|
22
|
+
ctx: AppContext,
|
|
23
23
|
) => {
|
|
24
24
|
console.log(kleur.gray("[soupifying]..."))
|
|
25
25
|
const soup = await soupify(
|
|
@@ -27,7 +27,7 @@ export const exportGerbersToFile = async (
|
|
|
27
27
|
filePath: params.example_file_path,
|
|
28
28
|
exportName: params.export_name,
|
|
29
29
|
},
|
|
30
|
-
ctx
|
|
30
|
+
ctx,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
console.log(kleur.gray("[soup to gerber json]..."))
|
|
@@ -67,7 +67,7 @@ export const exportGerbersToFile = async (
|
|
|
67
67
|
|
|
68
68
|
if (typeof Bun !== "undefined") {
|
|
69
69
|
throw new Error(
|
|
70
|
-
`Exporting gerbers doesn't currently work with Bun (bug w/ archiver module)
|
|
70
|
+
`Exporting gerbers doesn't currently work with Bun (bug w/ archiver module)`,
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -92,7 +92,7 @@ export const exportGerbersToZipBuffer = async (
|
|
|
92
92
|
example_file_path: string
|
|
93
93
|
export_name?: string
|
|
94
94
|
},
|
|
95
|
-
ctx: AppContext
|
|
95
|
+
ctx: AppContext,
|
|
96
96
|
) => {
|
|
97
97
|
const tempDir = Path.join(".tscircuit", "tmp-gerber-zip")
|
|
98
98
|
fs.mkdirSync(tempDir, { recursive: true })
|
|
@@ -103,7 +103,7 @@ export const exportGerbersToZipBuffer = async (
|
|
|
103
103
|
export_name: params.export_name,
|
|
104
104
|
output_zip_path: Path.join(tempDir, "gerbers.zip"),
|
|
105
105
|
},
|
|
106
|
-
ctx
|
|
106
|
+
ctx,
|
|
107
107
|
)
|
|
108
108
|
|
|
109
109
|
const buffer = fs.readFileSync(Path.join(tempDir, "gerbers.zip"))
|
|
@@ -17,7 +17,7 @@ export const exportPnpCsvToBuffer = async (
|
|
|
17
17
|
example_file_path: string
|
|
18
18
|
export_name?: string
|
|
19
19
|
},
|
|
20
|
-
ctx: AppContext
|
|
20
|
+
ctx: AppContext,
|
|
21
21
|
) => {
|
|
22
22
|
console.log(kleur.gray("[soupifying]..."))
|
|
23
23
|
const soup = await soupify(
|
|
@@ -25,7 +25,7 @@ export const exportPnpCsvToBuffer = async (
|
|
|
25
25
|
filePath: params.example_file_path,
|
|
26
26
|
exportName: params.export_name,
|
|
27
27
|
},
|
|
28
|
-
ctx
|
|
28
|
+
ctx,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
console.log(kleur.gray("[soup to pnp csv string]..."))
|
package/lib/get-program.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as CMDFN from "lib/cmd-fns"
|
|
|
5
5
|
|
|
6
6
|
export const getProgram = (ctx: AppContext) => {
|
|
7
7
|
const cmd = new Command("tsci").description(
|
|
8
|
-
"Develop, test and manage tscircuit packages"
|
|
8
|
+
"Develop, test and manage tscircuit packages",
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
cmd
|
|
@@ -22,11 +22,11 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
22
22
|
.option("--name <name>", "Name of the project")
|
|
23
23
|
.option(
|
|
24
24
|
"--runtime <runtime>",
|
|
25
|
-
"Runtime to use (attempts to bun, otherwise node/tsx)"
|
|
25
|
+
"Runtime to use (attempts to bun, otherwise node/tsx)",
|
|
26
26
|
)
|
|
27
27
|
.option(
|
|
28
28
|
"--dir <dir>",
|
|
29
|
-
"Directory to initialize (defaults to ./<name> or . if name not provided)"
|
|
29
|
+
"Directory to initialize (defaults to ./<name> or . if name not provided)",
|
|
30
30
|
)
|
|
31
31
|
.action((args) => CMDFN.init(ctx, args))
|
|
32
32
|
|
|
@@ -35,7 +35,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
35
35
|
.description("Add a package from the tscircuit registry")
|
|
36
36
|
.argument(
|
|
37
37
|
"<packages...>",
|
|
38
|
-
"Packages to install from registry.tscircuit.com, optionally with version"
|
|
38
|
+
"Packages to install from registry.tscircuit.com, optionally with version",
|
|
39
39
|
)
|
|
40
40
|
.option("-D, --dev", "Add to devDependencies")
|
|
41
41
|
.action((packages, flags) => CMDFN.add(ctx, { packages, flags }))
|
|
@@ -85,7 +85,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
85
85
|
.description("Set runtime to use, bun or node")
|
|
86
86
|
.requiredOption(
|
|
87
87
|
"--runtime <runtime>",
|
|
88
|
-
"Bun or node. Setting to bun generally doubles soupification speed."
|
|
88
|
+
"Bun or node. Setting to bun generally doubles soupification speed.",
|
|
89
89
|
)
|
|
90
90
|
.action((args) => CMDFN.configSetRuntime(ctx, args))
|
|
91
91
|
configCmd
|
|
@@ -147,7 +147,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
147
147
|
.description("Create a new package release")
|
|
148
148
|
.option(
|
|
149
149
|
"-p, --package-name-with-version <package_name_with_version>",
|
|
150
|
-
"Package name and version"
|
|
150
|
+
"Package name and version",
|
|
151
151
|
)
|
|
152
152
|
.option("--package-name <package_name>", "Package name")
|
|
153
153
|
.option("--release-version <release_version>", "Version to publish")
|
|
@@ -157,7 +157,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
157
157
|
.description("Update a package release")
|
|
158
158
|
.option(
|
|
159
159
|
"-p, --package-name-with-version <package_name_with_version>",
|
|
160
|
-
"Package name and version"
|
|
160
|
+
"Package name and version",
|
|
161
161
|
)
|
|
162
162
|
.option("--is-latest", "Make package release the latest version")
|
|
163
163
|
.option("--is-locked", "Lock the release")
|
|
@@ -172,11 +172,11 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
172
172
|
.description("List all files for a package release")
|
|
173
173
|
.option(
|
|
174
174
|
"--package-name-with-version <package_name_with_version>",
|
|
175
|
-
"Package name with version"
|
|
175
|
+
"Package name with version",
|
|
176
176
|
)
|
|
177
177
|
.option(
|
|
178
178
|
"--package-name <package_name>",
|
|
179
|
-
"Package name (use latest version)"
|
|
179
|
+
"Package name (use latest version)",
|
|
180
180
|
)
|
|
181
181
|
.option("--package-release-id <package_release_id>", "Package Release Id")
|
|
182
182
|
.action((args) => CMDFN.packageFilesList(ctx, args))
|
|
@@ -186,12 +186,12 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
186
186
|
.description("Download a file from a package release")
|
|
187
187
|
.requiredOption(
|
|
188
188
|
"--package-name-with-version <package_name_with_version>",
|
|
189
|
-
"Package name and version"
|
|
189
|
+
"Package name and version",
|
|
190
190
|
)
|
|
191
191
|
.requiredOption("--remote-file-path <remote_file_path>", "Remote file path")
|
|
192
192
|
.option(
|
|
193
193
|
"--output <output>",
|
|
194
|
-
"Output file path (optional), prints to stdout if not provided"
|
|
194
|
+
"Output file path (optional), prints to stdout if not provided",
|
|
195
195
|
)
|
|
196
196
|
.action((args) => CMDFN.packageFilesDownload(ctx, args))
|
|
197
197
|
packageFiles
|
|
@@ -199,11 +199,11 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
199
199
|
.description("Create/upload a new package file")
|
|
200
200
|
.option(
|
|
201
201
|
"-p, --package-release-id <package_release_id>",
|
|
202
|
-
"Package Release Id"
|
|
202
|
+
"Package Release Id",
|
|
203
203
|
)
|
|
204
204
|
.option(
|
|
205
205
|
"--package-name-with-version <package_name_with_version>",
|
|
206
|
-
"Package name with version e.g. @tscircuit/arduino@1.2.3"
|
|
206
|
+
"Package name with version e.g. @tscircuit/arduino@1.2.3",
|
|
207
207
|
)
|
|
208
208
|
.requiredOption("--file <file>", "File to upload")
|
|
209
209
|
.action((args) => CMDFN.packageFilesCreate(ctx, args))
|
|
@@ -269,7 +269,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
269
269
|
.requiredOption("--file <file>", "Input example files")
|
|
270
270
|
.option(
|
|
271
271
|
"--export <export_name>",
|
|
272
|
-
"Name of export to soupify, if not specified, soupify the default/only export"
|
|
272
|
+
"Name of export to soupify, if not specified, soupify the default/only export",
|
|
273
273
|
)
|
|
274
274
|
.option("--outputfile <outputfile>", "Output file name", "gerbers.zip")
|
|
275
275
|
.action((args) => CMDFN.exportGerbers(ctx, args))
|
|
@@ -281,7 +281,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
281
281
|
.option("--output <output.json>", "Output file")
|
|
282
282
|
.option(
|
|
283
283
|
"--export <export_name>",
|
|
284
|
-
"Name of export to soupify, if not specified, soupify the default/only export"
|
|
284
|
+
"Name of export to soupify, if not specified, soupify the default/only export",
|
|
285
285
|
)
|
|
286
286
|
.action((args) => CMDFN.soupify(ctx, args))
|
|
287
287
|
|
|
@@ -290,7 +290,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
290
290
|
.description("Install a package from the tscircuit registry")
|
|
291
291
|
.argument(
|
|
292
292
|
"<packages...>",
|
|
293
|
-
"Packages to install from registry.tscircuit.com, optionally with version"
|
|
293
|
+
"Packages to install from registry.tscircuit.com, optionally with version",
|
|
294
294
|
)
|
|
295
295
|
.option("-D, --dev", "Add to devDependencies")
|
|
296
296
|
.action((packages, flags) => CMDFN.install(ctx, { packages, flags }))
|
|
@@ -310,7 +310,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
310
310
|
.description("Upload a directory to the dev server")
|
|
311
311
|
.option(
|
|
312
312
|
"--dir <dir>",
|
|
313
|
-
"Directory to upload (defaults to current directory)"
|
|
313
|
+
"Directory to upload (defaults to current directory)",
|
|
314
314
|
)
|
|
315
315
|
.option("-w, --watch", "Watch for changes")
|
|
316
316
|
.option("-p, --port", "Port dev server is running on (default: 3020)")
|
|
@@ -4,9 +4,8 @@ import { ParamHandler } from "./param-handler-type"
|
|
|
4
4
|
export const interactForPackageReleaseId: ParamHandler = async (params) => {
|
|
5
5
|
const { ctx, prompts } = params
|
|
6
6
|
|
|
7
|
-
const package_name_with_version =
|
|
8
|
-
params
|
|
9
|
-
)
|
|
7
|
+
const package_name_with_version =
|
|
8
|
+
await interactForPackageNameWithVersion(params)
|
|
10
9
|
|
|
11
10
|
return await ctx.axios
|
|
12
11
|
.post("/package_releases/get", {
|
|
@@ -9,7 +9,7 @@ export const interactForRuntime: ParamHandler = async (params) => {
|
|
|
9
9
|
|
|
10
10
|
if (!bunVersion) {
|
|
11
11
|
console.log(
|
|
12
|
-
kleur.red(`BUN IS NOT INSTALLED! Install bun first https://bun.sh/`)
|
|
12
|
+
kleur.red(`BUN IS NOT INSTALLED! Install bun first https://bun.sh/`),
|
|
13
13
|
)
|
|
14
14
|
}
|
|
15
15
|
|
package/lib/posthog.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { PostHog } from
|
|
1
|
+
import { PostHog } from "posthog-node"
|
|
2
2
|
|
|
3
3
|
const POSTHOG_API_KEY: string | undefined = process.env.POSTHOG_API_KEY
|
|
4
4
|
|
|
5
5
|
let posthogInstance: PostHog | null = null
|
|
6
6
|
|
|
7
7
|
if (POSTHOG_API_KEY) {
|
|
8
|
-
posthogInstance = new PostHog(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
)
|
|
8
|
+
posthogInstance = new PostHog(POSTHOG_API_KEY, {
|
|
9
|
+
host: "https://us.i.posthog.com",
|
|
10
|
+
})
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
const posthogProxy = new Proxy<PostHog>({} as PostHog, {
|
|
@@ -18,7 +17,7 @@ const posthogProxy = new Proxy<PostHog>({} as PostHog, {
|
|
|
18
17
|
}
|
|
19
18
|
// Return a no-op function for any method call if PostHog is not initialized
|
|
20
19
|
return () => {}
|
|
21
|
-
}
|
|
20
|
+
},
|
|
22
21
|
})
|
|
23
22
|
|
|
24
|
-
export default posthogProxy
|
|
23
|
+
export default posthogProxy
|