diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5f5c253..2f9b761 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -132,9 +132,8 @@ jobs: node -e ' const fs = require("node:fs"); const pkg = JSON.parse(fs.readFileSync("package.json", "utf8")); - if (!pkg.name.startsWith("@")) { - pkg.name = `@${process.env.GITHUB_REPOSITORY_OWNER.toLowerCase()}/${pkg.name}`; - fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2) + "\n"); - } + const baseName = pkg.name.includes("/") ? pkg.name.split("/")[1] : pkg.name; + pkg.name = `@${process.env.GITHUB_REPOSITORY_OWNER.toLowerCase()}/${baseName}`; + fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2) + "\n"); ' npm publish --registry=https://npm.pkg.github.com diff --git a/README.md b/README.md index 8f51aa7..72d1bd2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## Installation ```bash -npm install gitcontext +npm install @utkarsh2325/git-context ``` Node.js 20 or later and the `git` executable are required. @@ -16,7 +16,7 @@ Node.js 20 or later and the `git` executable are required. ## Quick Start ```ts -import { git } from "git-context"; +import { git } from "@utkarsh2325/git-context"; const context = git(); diff --git a/package.json b/package.json index a8cdf56..1493820 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,10 @@ { - "name": "gitcontext", + "name": "@utkarsh2325/git-context", "version": "0.6.0", "description": "Know your Git state from inside Node.js.", + "publishConfig": { + "access": "public" + }, "keywords": [ "git", "context", @@ -22,8 +25,8 @@ } }, "bin": { - "gitcontext": "./dist/cli.js", - "git-context": "./dist/cli.js" + "gitcontext": "dist/cli.js", + "git-context": "dist/cli.js" }, "files": [ "dist",