@forsakringskassan/commitlint-config 3.0.0 → 3.0.2

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.
package/dist/install.js CHANGED
@@ -764,8 +764,8 @@ import path3 from "node:path";
764
764
  var nonAllowedPackages = ["husky", "simple-git-hooks", "lint-staged"];
765
765
  function invalidInstalledPackages(packageJson) {
766
766
  const dependencies = [
767
- ...Object.keys(packageJson.dependencies),
768
- ...Object.keys(packageJson.devDependencies)
767
+ ...Object.keys(packageJson.dependencies ?? {}),
768
+ ...Object.keys(packageJson.devDependencies ?? {})
769
769
  ];
770
770
  for (const item of nonAllowedPackages) {
771
771
  if (dependencies.includes(item)) {
@@ -845,9 +845,8 @@ function configureCommitTemplate() {
845
845
  console.info(`git ${args.join(" ")}`);
846
846
  spawnSync("git", args);
847
847
  }
848
- if (!import_is_ci.default && process.env.FK_COMMITLINT_SKIP !== "1") {
849
- configureCommitTemplate();
850
- const originCwd = process.env["INIT_CWD"] || "";
848
+ var originCwd = process.env["INIT_CWD"] || "";
849
+ if (process.env.FK_COMMITLINT_SKIP !== "1") {
851
850
  const packageJson = JSON.parse(
852
851
  await fsp.readFile(path4.join(originCwd, "package.json"), {
853
852
  encoding: "utf-8"
@@ -856,14 +855,28 @@ if (!import_is_ci.default && process.env.FK_COMMITLINT_SKIP !== "1") {
856
855
  if (invalidInstalledPackages(packageJson) || existingSimpleGitConfig(packageJson) || await existingHuskyConfig(originCwd, fsp)) {
857
856
  process.exit(1);
858
857
  }
859
- const result = await spawn2(
860
- "npm",
861
- [
862
- "exec",
863
- "simple-git-hooks",
864
- __require.resolve("@forsakringskassan/commitlint-config/hooks.js")
865
- ],
866
- { cwd: process.env["INIT_CWD"] }
867
- );
868
- console.log(result.output);
858
+ if (!import_is_ci.default) {
859
+ await spawn2("git", ["config", "--unset", "core.hooksPath"], {
860
+ cwd: process.env["INIT_CWD"]
861
+ });
862
+ const result = await spawn2(
863
+ "npm",
864
+ [
865
+ "exec",
866
+ "simple-git-hooks",
867
+ __require.resolve(
868
+ "@forsakringskassan/commitlint-config/hooks.js"
869
+ )
870
+ ],
871
+ { cwd: process.env["INIT_CWD"] }
872
+ );
873
+ if (result.output.toLowerCase().includes("error")) {
874
+ console.log(result.output);
875
+ process.exit(1);
876
+ }
877
+ console.log(result.output);
878
+ }
879
+ }
880
+ if (!import_is_ci.default) {
881
+ configureCommitTemplate();
869
882
  }
package/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
 
3
- const lintConfigPath = fileURLToPath.meta.resolve("./lint-staged.js");
3
+ const lintConfigPath = fileURLToPath(import.meta.resolve("./lint-staged.js"));
4
4
 
5
5
  export default {
6
6
  "pre-commit": `npm exec lint-staged -- --config "${lintConfigPath}" "$@"`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/commitlint-config",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "FK commitlint shareable config",
5
5
  "keywords": [
6
6
  "commitlint"