Skip to content

Commit

Permalink
fix(snocommit): pkg name
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Oct 12, 2022
1 parent 496dd56 commit 6df74aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions packages/snocommit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snocommit",
"version": "1.4.11",
"version": "1.4.13",
"description": "A Simple way to commit changes in current folder.",
"keywords": [
"cli",
Expand Down Expand Up @@ -39,7 +39,8 @@
"scripts": {
"build": "snobuild && tsx postbuild.ts",
"prepack": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"postversion": "npm publish"
},
"dependencies": {
"async-exec": "^1.1.0",
Expand All @@ -55,4 +56,4 @@
"tsx": "3.10.1",
"yargs": "^17.6.0"
}
}
}
14 changes: 7 additions & 7 deletions packages/snocommit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ type PART = "-" | "." | string;
const cmdActions: Record<Type, (part: PART, desc: string) => Promise<any> | any> = {
breaking: (part, desc) =>
`(npm version major --no-workspaces-update${
" || echo [WARN] error throws while version bump) && " && ""
}`,
" || echo [WARN] error throws while version bump)" && ")"
} && `,
feat: (part, desc) =>
`(npm version minor --no-workspaces-update${
" || echo [WARN] error throws while version bump) && " && ""
}`,
" || echo [WARN] error throws while version bump)" && ")"
} && `,
fix: (part, desc) =>
`(npm version patch --no-workspaces-update${
" || echo [WARN] error throws while version bump) && " && ""
}`,
" || echo [WARN] error throws while version bump)" && ")"
} && `,
chore: (part, desc) => "",
docs: (part, desc) => "",
styles: (part, desc) => "",
Expand All @@ -32,7 +32,7 @@ export default async function snocommit({ type, part, desc }: snoCommitOptions)
if (!desc) throw new Error("missing desc");
if (part === ".") {
const pkgPath = await pkgUp({ cwd: process.cwd() });
const pkgName = pkgPath && path.parse(pkgPath).name;
const pkgName = pkgPath && path.parse(path.parse(pkgPath).dir).name;
const folderName = path.parse(process.cwd()).name;
part = pkgName || folderName;
}
Expand Down

0 comments on commit 6df74aa

Please sign in to comment.