@tscircuit/cli 0.0.6 → 0.0.8

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.
@@ -11,6 +11,7 @@ import * as Path from "path"
11
11
  import { startWatcher } from "./start-watcher"
12
12
  import { createOrModifyNpmrc } from "../init/create-or-modify-npmrc"
13
13
  import { checkIfInitialized } from "./check-if-initialized"
14
+ import { initCmd } from "../init"
14
15
 
15
16
  export const devCmd = async (ctx: AppContext, args: any) => {
16
17
  const params = z
@@ -27,12 +28,18 @@ export const devCmd = async (ctx: AppContext, args: any) => {
27
28
  const isInitialized = await checkIfInitialized(ctx)
28
29
 
29
30
  if (!isInitialized) {
30
- console.log(
31
- kleur.red(
32
- `This project is not properly initialized. Please run "tsci init" first, or follow the manual installation steps here:\n\nhttps://github.com/tscircuit/tscircuit/blob/main/docs/manual-installation.md`
33
- )
34
- )
35
- process.exit(1)
31
+ const { confirmInitialize } = await prompts({
32
+ type: "confirm",
33
+ name: "confirmInitialize",
34
+ message: "Would you like to initialize this project now?",
35
+ initial: true,
36
+ })
37
+
38
+ if (confirmInitialize) {
39
+ return initCmd(ctx, {})
40
+ } else {
41
+ process.exit(1)
42
+ }
36
43
  }
37
44
 
38
45
  await createOrModifyNpmrc({ quiet: false }, ctx)
@@ -1,7 +1,7 @@
1
1
  import { AppContext } from "../util/app-context"
2
2
  import { z } from "zod"
3
- import { getDevServerAxios } from "./get-dev-server-axios"
4
- import { uploadExamplesFromDirectory } from "./upload-examples-from-directory"
3
+ import { getDevServerAxios } from "./dev/get-dev-server-axios"
4
+ import { uploadExamplesFromDirectory } from "./dev/upload-examples-from-directory"
5
5
  import { startWatcher } from "./dev/start-watcher"
6
6
 
7
7
  export const devServerUpload = async (ctx: AppContext, args: any) => {
@@ -30,6 +30,17 @@ export const initCmd = async (ctx: AppContext, args: any) => {
30
30
  params.dir = `.`
31
31
  }
32
32
 
33
+ if (!params.name) {
34
+ try {
35
+ const myAccount = await ctx.axios
36
+ .get("/accounts/get")
37
+ .then((r) => r.data.account)
38
+ params.name = `@${myAccount.github_username}/${Path.basename(params.dir)}`
39
+ } catch (e) {
40
+ params.name = Path.basename(params.dir ?? ctx.cwd)
41
+ }
42
+ }
43
+
33
44
  let runtime = params.runtime
34
45
  if (!runtime) {
35
46
  const bunExists = $.commandExistsSync("bun")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Command line tool for developing, publishing and installing tscircuit circuits",