@forsakringskassan/commitlint-config 3.0.0 → 3.0.1
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 +21 -15
- package/package.json +1 -1
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
|
-
|
|
849
|
-
|
|
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,21 @@ 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
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
858
|
+
if (!import_is_ci.default) {
|
|
859
|
+
const result = await spawn2(
|
|
860
|
+
"npm",
|
|
861
|
+
[
|
|
862
|
+
"exec",
|
|
863
|
+
"simple-git-hooks",
|
|
864
|
+
__require.resolve(
|
|
865
|
+
"@forsakringskassan/commitlint-config/hooks.js"
|
|
866
|
+
)
|
|
867
|
+
],
|
|
868
|
+
{ cwd: process.env["INIT_CWD"] }
|
|
869
|
+
);
|
|
870
|
+
console.log(result.output);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
if (!import_is_ci.default) {
|
|
874
|
+
configureCommitTemplate();
|
|
869
875
|
}
|