Skip to content

Commit

Permalink
feat(git-tools): Added commitlint validations to commit command b…
Browse files Browse the repository at this point in the history
…y default
  • Loading branch information
sullivanpj committed Jan 10, 2025
1 parent 7c10076 commit 03c9f9f
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 60 deletions.
148 changes: 88 additions & 60 deletions packages/git-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,145 +45,173 @@
"pnpm": ">=9.15.2"
},
"bin": {
"storm-git": "./bin/git/index.js",
"storm-git-esm": "./bin/git/index.mjs",
"storm-git-cjs": "./bin/git/index.js",
"storm-post-checkout": "./bin/post-checkout/index.js",
"storm-post-checkout-esm": "./bin/post-checkout/index.mjs",
"storm-post-checkout-cjs": "./bin/post-checkout/index.js",
"storm-post-commit": "./bin/post-commit/index.js",
"storm-post-commit-esm": "./bin/post-commit/index.mjs",
"storm-post-commit-cjs": "./bin/post-commit/index.js",
"storm-post-merge": "./bin/post-merge/index.js",
"storm-post-merge-esm": "./bin/post-merge/index.mjs",
"storm-post-merge-cjs": "./bin/post-merge/index.js",
"storm-pre-commit": "./bin/pre-commit/index.js",
"storm-pre-commit-esm": "./bin/pre-commit/index.mjs",
"storm-pre-commit-cjs": "./bin/pre-commit/index.js",
"storm-pre-install": "./bin/pre-install/index.js",
"storm-pre-install-esm": "./bin/pre-install/index.mjs",
"storm-pre-install-cjs": "./bin/pre-install/index.js",
"storm-pre-push": "./bin/pre-push/index.js",
"storm-pre-push-esm": "./bin/pre-push/index.mjs",
"storm-pre-push-cjs": "./bin/pre-push/index.js",
"storm-prepare": "./bin/prepare/index.js",
"storm-prepare-esm": "./bin/prepare/index.mjs",
"storm-prepare-cjs": "./bin/prepare/index.js",
"storm-version-warning": "./bin/version-warning/index.js",
"storm-version-warning-esm": "./bin/version-warning/index.mjs",
"storm-version-warning-cjs": "./bin/version-warning/index.js"
"storm-git": "./bin/git/index.cjs",
"storm-git-esm": "./bin/git/index.js",
"storm-git-cjs": "./bin/git/index.cjs",
"storm-post-checkout": "./bin/post-checkout/index.cjs",
"storm-post-checkout-esm": "./bin/post-checkout/index.js",
"storm-post-checkout-cjs": "./bin/post-checkout/index.cjs",
"storm-post-commit": "./bin/post-commit/index.cjs",
"storm-post-commit-esm": "./bin/post-commit/index.js",
"storm-post-commit-cjs": "./bin/post-commit/index.cjs",
"storm-post-merge": "./bin/post-merge/index.cjs",
"storm-post-merge-esm": "./bin/post-merge/index.js",
"storm-post-merge-cjs": "./bin/post-merge/index.cjs",
"storm-pre-commit": "./bin/pre-commit/index.cjs",
"storm-pre-commit-esm": "./bin/pre-commit/index.js",
"storm-pre-commit-cjs": "./bin/pre-commit/index.cjs",
"storm-pre-install": "./bin/pre-install/index.cjs",
"storm-pre-install-esm": "./bin/pre-install/index.js",
"storm-pre-install-cjs": "./bin/pre-install/index.cjs",
"storm-pre-push": "./bin/pre-push/index.cjs",
"storm-pre-push-esm": "./bin/pre-push/index.js",
"storm-pre-push-cjs": "./bin/pre-push/index.cjs",
"storm-prepare": "./bin/prepare/index.cjs",
"storm-prepare-esm": "./bin/prepare/index.js",
"storm-prepare-cjs": "./bin/prepare/index.cjs",
"storm-version-warning": "./bin/version-warning/index.cjs",
"storm-version-warning-esm": "./bin/version-warning/index.js",
"storm-version-warning-cjs": "./bin/version-warning/index.cjs"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
},
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./index": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
},
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./types": {
"import": {
"types": "./dist/types.d.mts",
"default": "./dist/types.mjs"
},
"require": {
"types": "./dist/types.d.ts",
"default": "./dist/types.js"
},
"require": {
"types": "./dist/types.d.cts",
"default": "./dist/types.cjs"
},
"default": {
"types": "./dist/types.d.ts",
"default": "./dist/types.js"
}
},
"./commit/config": {
"import": {
"types": "./dist/commit/config.d.mts",
"default": "./dist/commit/config.mjs"
},
"require": {
"types": "./dist/commit/config.d.ts",
"default": "./dist/commit/config.js"
},
"require": {
"types": "./dist/commit/config.d.cts",
"default": "./dist/commit/config.cjs"
},
"default": {
"types": "./dist/commit/config.d.ts",
"default": "./dist/commit/config.js"
}
},
"./commit/*": {
"import": {
"types": "./dist/commit/*.d.mts",
"default": "./dist/commit/*.mjs"
},
"require": {
"types": "./dist/commit/*.d.ts",
"default": "./dist/commit/*.js"
},
"require": {
"types": "./dist/commit/*.d.cts",
"default": "./dist/commit/*.cjs"
},
"default": {
"types": "./dist/commit/*.d.ts",
"default": "./dist/commit/*.js"
}
},
"./release/config": {
"./commitlint/config": {
"import": {
"types": "./dist/commitlint/config.d.ts",
"default": "./dist/commitlint/config.js"
},
"require": {
"types": "./dist/commitlint/config.d.cts",
"default": "./dist/commitlint/config.cjs"
},
"default": {
"types": "./dist/commitlint/config.d.ts",
"default": "./dist/commitlint/config.js"
}
},
"./commitlint/*": {
"import": {
"types": "./dist/release/config.d.mts",
"default": "./dist/release/config.mjs"
"types": "./dist/commitlint/*.d.ts",
"default": "./dist/commitlint/*.js"
},
"require": {
"types": "./dist/commitlint/*.d.cts",
"default": "./dist/commitlint/*.cjs"
},
"default": {
"types": "./dist/commitlint/*.d.ts",
"default": "./dist/commitlint/*.js"
}
},
"./release/config": {
"import": {
"types": "./dist/release/config.d.ts",
"default": "./dist/release/config.js"
},
"require": {
"types": "./dist/release/config.d.cts",
"default": "./dist/release/config.cjs"
},
"default": {
"types": "./dist/release/config.d.ts",
"default": "./dist/release/config.js"
}
},
"./release/*": {
"import": {
"types": "./dist/release/*.d.mts",
"default": "./dist/release/*.mjs"
},
"require": {
"types": "./dist/release/*.d.ts",
"default": "./dist/release/*.js"
},
"require": {
"types": "./dist/release/*.d.cts",
"default": "./dist/release/*.cjs"
},
"default": {
"types": "./dist/release/*.d.ts",
"default": "./dist/release/*.js"
}
},
"./changelog-renderer": {
"import": {
"types": "./dist/release/changelog-renderer.d.mts",
"default": "./dist/release/changelog-renderer.mjs"
},
"require": {
"types": "./dist/release/changelog-renderer.d.ts",
"default": "./dist/release/changelog-renderer.js"
},
"require": {
"types": "./dist/release/changelog-renderer.d.cts",
"default": "./dist/release/changelog-renderer.cjs"
},
"default": {
"types": "./dist/release/changelog-renderer.d.ts",
"default": "./dist/release/changelog-renderer.js"
Expand Down
4 changes: 4 additions & 0 deletions packages/git-tools/src/commit/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { run } from "@storm-software/config-tools/utilities/run";
import shellescape from "any-shell-escape";
import chalkTemplate from "chalk-template";
import fs from "node:fs/promises";
import { runCommitLint } from "../commitlint/run";
import {
CommitQuestionAnswers,
CommitQuestionProps,
Expand Down Expand Up @@ -48,6 +49,8 @@ export const runCommit = async (
`);

await runCommitLint(config, { message });

const commandItems = ["git", "commit"];
if (!process.env.CI && !process.env.STORM_CI) {
commandItems.push("-S");
Expand All @@ -65,6 +68,7 @@ export const runCommit = async (
writeDebug(`Message [dry-run]: ${message}`, config);
} else {
await fs.writeFile(commitMsgFile, message);

run(config, command);
}
};
Expand Down
1 change: 1 addition & 0 deletions packages/git-tools/tsup.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default defineConfig([
"src/index.ts",
"src/types.ts",
"src/commit/config.ts",
"src/commitlint/config.ts",
"src/release/config.ts",
"src/release/changelog-renderer.ts"
],
Expand Down

0 comments on commit 03c9f9f

Please sign in to comment.