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

Commit

Permalink
fix init-generated readme, fix project name not working when init'ing in
Browse files Browse the repository at this point in the history
current directory
  • Loading branch information
seveibar committed Mar 22, 2024
1 parent a7aef86 commit 6fa3bec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/cmd-fns/init/get-generated-readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export const getGeneratedReadme = ({
return `
# ${name}
[![tscircuit version badge](https://registry.tscircuit.com/badges/view?package_name=${name.replace(
"/",
"."
)})](https://registry.tscircuit.com/${name.replace("@", "")})
[![tscircuit version badge](https://registry-api.tscircuit.com/badges/view?package_name=${name
.replace("@", "")
.replace("/", ".")})](https://registry.tscircuit.com/${name.replace(
"@",
""
)})
${
shouldHaveProjectGeneratedNotice
Expand Down
6 changes: 5 additions & 1 deletion lib/cmd-fns/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const initCmd = async (ctx: AppContext, args: any) => {
const myAccount = await ctx.axios
.get("/accounts/get")
.then((r) => r.data.account)
params.name = `@${myAccount.github_username}/${Path.basename(params.dir)}`
let subName = Path.basename(params.dir)
if (subName === ".") {
subName = Path.basename(Path.resolve(Path.join(subName, "..")))
}
params.name = `@${myAccount.github_username}/${subName}`
} catch (e) {
params.name = Path.basename(params.dir ?? ctx.cwd)
}
Expand Down

0 comments on commit 6fa3bec

Please sign in to comment.