@forsakringskassan/commitlint-config 3.0.5 → 3.0.7
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 +36 -41
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -481,7 +481,7 @@ var require_is_ci = __commonJS({
|
|
|
481
481
|
|
|
482
482
|
// src/install.ts
|
|
483
483
|
import fs2 from "node:fs";
|
|
484
|
-
import
|
|
484
|
+
import path4 from "node:path";
|
|
485
485
|
import { spawnSync } from "node:child_process";
|
|
486
486
|
import * as fsp from "fs/promises";
|
|
487
487
|
|
|
@@ -759,9 +759,6 @@ function spawn2(file, second, third, previous) {
|
|
|
759
759
|
// src/install.ts
|
|
760
760
|
var import_is_ci = __toESM(require_is_ci(), 1);
|
|
761
761
|
|
|
762
|
-
// src/verifyPackage.ts
|
|
763
|
-
import path4 from "node:path";
|
|
764
|
-
|
|
765
762
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
766
763
|
var balanced = (a, b, str) => {
|
|
767
764
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
@@ -4822,12 +4819,12 @@ var PathBase = class {
|
|
|
4822
4819
|
/**
|
|
4823
4820
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
4824
4821
|
*/
|
|
4825
|
-
resolve(
|
|
4826
|
-
if (!
|
|
4822
|
+
resolve(path5) {
|
|
4823
|
+
if (!path5) {
|
|
4827
4824
|
return this;
|
|
4828
4825
|
}
|
|
4829
|
-
const rootPath = this.getRootString(
|
|
4830
|
-
const dir =
|
|
4826
|
+
const rootPath = this.getRootString(path5);
|
|
4827
|
+
const dir = path5.substring(rootPath.length);
|
|
4831
4828
|
const dirParts = dir.split(this.splitSep);
|
|
4832
4829
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
4833
4830
|
return result;
|
|
@@ -5579,8 +5576,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
5579
5576
|
/**
|
|
5580
5577
|
* @internal
|
|
5581
5578
|
*/
|
|
5582
|
-
getRootString(
|
|
5583
|
-
return win32.parse(
|
|
5579
|
+
getRootString(path5) {
|
|
5580
|
+
return win32.parse(path5).root;
|
|
5584
5581
|
}
|
|
5585
5582
|
/**
|
|
5586
5583
|
* @internal
|
|
@@ -5626,8 +5623,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
5626
5623
|
/**
|
|
5627
5624
|
* @internal
|
|
5628
5625
|
*/
|
|
5629
|
-
getRootString(
|
|
5630
|
-
return
|
|
5626
|
+
getRootString(path5) {
|
|
5627
|
+
return path5.startsWith("/") ? "/" : "";
|
|
5631
5628
|
}
|
|
5632
5629
|
/**
|
|
5633
5630
|
* @internal
|
|
@@ -5716,11 +5713,11 @@ var PathScurryBase = class {
|
|
|
5716
5713
|
/**
|
|
5717
5714
|
* Get the depth of a provided path, string, or the cwd
|
|
5718
5715
|
*/
|
|
5719
|
-
depth(
|
|
5720
|
-
if (typeof
|
|
5721
|
-
|
|
5716
|
+
depth(path5 = this.cwd) {
|
|
5717
|
+
if (typeof path5 === "string") {
|
|
5718
|
+
path5 = this.cwd.resolve(path5);
|
|
5722
5719
|
}
|
|
5723
|
-
return
|
|
5720
|
+
return path5.depth();
|
|
5724
5721
|
}
|
|
5725
5722
|
/**
|
|
5726
5723
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -6207,9 +6204,9 @@ var PathScurryBase = class {
|
|
|
6207
6204
|
process7();
|
|
6208
6205
|
return results;
|
|
6209
6206
|
}
|
|
6210
|
-
chdir(
|
|
6207
|
+
chdir(path5 = this.cwd) {
|
|
6211
6208
|
const oldCwd = this.cwd;
|
|
6212
|
-
this.cwd = typeof
|
|
6209
|
+
this.cwd = typeof path5 === "string" ? this.cwd.resolve(path5) : path5;
|
|
6213
6210
|
this.cwd[setAsCwd](oldCwd);
|
|
6214
6211
|
}
|
|
6215
6212
|
};
|
|
@@ -6565,8 +6562,8 @@ var MatchRecord = class {
|
|
|
6565
6562
|
}
|
|
6566
6563
|
// match, absolute, ifdir
|
|
6567
6564
|
entries() {
|
|
6568
|
-
return [...this.store.entries()].map(([
|
|
6569
|
-
|
|
6565
|
+
return [...this.store.entries()].map(([path5, n]) => [
|
|
6566
|
+
path5,
|
|
6570
6567
|
!!(n & 2),
|
|
6571
6568
|
!!(n & 1)
|
|
6572
6569
|
]);
|
|
@@ -6771,9 +6768,9 @@ var GlobUtil = class {
|
|
|
6771
6768
|
signal;
|
|
6772
6769
|
maxDepth;
|
|
6773
6770
|
includeChildMatches;
|
|
6774
|
-
constructor(patterns,
|
|
6771
|
+
constructor(patterns, path5, opts) {
|
|
6775
6772
|
this.patterns = patterns;
|
|
6776
|
-
this.path =
|
|
6773
|
+
this.path = path5;
|
|
6777
6774
|
this.opts = opts;
|
|
6778
6775
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
6779
6776
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -6792,11 +6789,11 @@ var GlobUtil = class {
|
|
|
6792
6789
|
});
|
|
6793
6790
|
}
|
|
6794
6791
|
}
|
|
6795
|
-
#ignored(
|
|
6796
|
-
return this.seen.has(
|
|
6792
|
+
#ignored(path5) {
|
|
6793
|
+
return this.seen.has(path5) || !!this.#ignore?.ignored?.(path5);
|
|
6797
6794
|
}
|
|
6798
|
-
#childrenIgnored(
|
|
6799
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
6795
|
+
#childrenIgnored(path5) {
|
|
6796
|
+
return !!this.#ignore?.childrenIgnored?.(path5);
|
|
6800
6797
|
}
|
|
6801
6798
|
// backpressure mechanism
|
|
6802
6799
|
pause() {
|
|
@@ -7011,8 +7008,8 @@ var GlobUtil = class {
|
|
|
7011
7008
|
};
|
|
7012
7009
|
var GlobWalker = class extends GlobUtil {
|
|
7013
7010
|
matches = /* @__PURE__ */ new Set();
|
|
7014
|
-
constructor(patterns,
|
|
7015
|
-
super(patterns,
|
|
7011
|
+
constructor(patterns, path5, opts) {
|
|
7012
|
+
super(patterns, path5, opts);
|
|
7016
7013
|
}
|
|
7017
7014
|
matchEmit(e) {
|
|
7018
7015
|
this.matches.add(e);
|
|
@@ -7049,8 +7046,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
7049
7046
|
};
|
|
7050
7047
|
var GlobStream = class extends GlobUtil {
|
|
7051
7048
|
results;
|
|
7052
|
-
constructor(patterns,
|
|
7053
|
-
super(patterns,
|
|
7049
|
+
constructor(patterns, path5, opts) {
|
|
7050
|
+
super(patterns, path5, opts);
|
|
7054
7051
|
this.results = new Minipass({
|
|
7055
7052
|
signal: this.signal,
|
|
7056
7053
|
objectMode: true
|
|
@@ -7385,9 +7382,7 @@ function existingSimpleGitConfig(packageJson) {
|
|
|
7385
7382
|
}
|
|
7386
7383
|
async function existingHuskyConfig(cwd, fileSystem) {
|
|
7387
7384
|
try {
|
|
7388
|
-
const
|
|
7389
|
-
await fileSystem.stat(huskyPath);
|
|
7390
|
-
const huskyFiles = await glob(`.husky/**/*`, {
|
|
7385
|
+
const huskyFiles = await glob(".husky/**/*", {
|
|
7391
7386
|
fs: fileSystem,
|
|
7392
7387
|
ignore: ".husky/_/**",
|
|
7393
7388
|
cwd
|
|
@@ -7413,12 +7408,12 @@ async function existingHuskyConfig(cwd, fileSystem) {
|
|
|
7413
7408
|
function findGit(cwd) {
|
|
7414
7409
|
let current = cwd;
|
|
7415
7410
|
while (true) {
|
|
7416
|
-
const search =
|
|
7411
|
+
const search = path4.join(current, ".git");
|
|
7417
7412
|
if (fs2.existsSync(search)) {
|
|
7418
|
-
return
|
|
7413
|
+
return path4.resolve(current);
|
|
7419
7414
|
}
|
|
7420
7415
|
const child = current;
|
|
7421
|
-
current =
|
|
7416
|
+
current = path4.dirname(current);
|
|
7422
7417
|
if (current === child) {
|
|
7423
7418
|
break;
|
|
7424
7419
|
}
|
|
@@ -7431,8 +7426,8 @@ function configureCommitTemplate() {
|
|
|
7431
7426
|
console.warn("Failed to locate git directory, skipping gitmessage");
|
|
7432
7427
|
return;
|
|
7433
7428
|
}
|
|
7434
|
-
const relPath =
|
|
7435
|
-
const gitmessage =
|
|
7429
|
+
const relPath = path4.relative(gitDir, path4.join(__dirname, ".."));
|
|
7430
|
+
const gitmessage = path4.join(relPath, "gitmessage");
|
|
7436
7431
|
const args = ["config", "commit.template", gitmessage];
|
|
7437
7432
|
console.info(`git ${args.join(" ")}`);
|
|
7438
7433
|
spawnSync("git", args);
|
|
@@ -7440,11 +7435,11 @@ function configureCommitTemplate() {
|
|
|
7440
7435
|
async function setupGitHooks() {
|
|
7441
7436
|
const originCwd = process.env["INIT_CWD"] || "";
|
|
7442
7437
|
const packageJson = JSON.parse(
|
|
7443
|
-
await fsp.readFile(
|
|
7438
|
+
await fsp.readFile(path4.join(originCwd, "package.json"), {
|
|
7444
7439
|
encoding: "utf-8"
|
|
7445
7440
|
})
|
|
7446
7441
|
);
|
|
7447
|
-
if (invalidInstalledPackages(packageJson) || existingSimpleGitConfig(packageJson) || await existingHuskyConfig(originCwd,
|
|
7442
|
+
if (invalidInstalledPackages(packageJson) || existingSimpleGitConfig(packageJson) || await existingHuskyConfig(originCwd, fs2)) {
|
|
7448
7443
|
process.exit(1);
|
|
7449
7444
|
}
|
|
7450
7445
|
if (!import_is_ci.default) {
|
|
@@ -7452,7 +7447,7 @@ async function setupGitHooks() {
|
|
|
7452
7447
|
await spawn2("git", ["config", "--unset", "core.hooksPath"], {
|
|
7453
7448
|
cwd: originCwd
|
|
7454
7449
|
});
|
|
7455
|
-
fs2.rmSync(
|
|
7450
|
+
fs2.rmSync(path4.join(originCwd, ".husky/_"), {
|
|
7456
7451
|
recursive: true,
|
|
7457
7452
|
force: true
|
|
7458
7453
|
});
|