@forsakringskassan/commitlint-config 3.0.6 → 3.0.8
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 +43 -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
|
|
|
@@ -706,11 +706,18 @@ var lineIterator = async function* (subprocess, { state }, streamName) {
|
|
|
706
706
|
if (!stream2) {
|
|
707
707
|
return;
|
|
708
708
|
}
|
|
709
|
+
handleErrors(subprocess);
|
|
709
710
|
yield* readline.createInterface({ input: stream2 });
|
|
710
711
|
} finally {
|
|
711
712
|
await subprocess;
|
|
712
713
|
}
|
|
713
714
|
};
|
|
715
|
+
var handleErrors = async (subprocess) => {
|
|
716
|
+
try {
|
|
717
|
+
await subprocess;
|
|
718
|
+
} catch {
|
|
719
|
+
}
|
|
720
|
+
};
|
|
714
721
|
var combineAsyncIterators = async function* (...iterators) {
|
|
715
722
|
try {
|
|
716
723
|
let promises = [];
|
|
@@ -759,9 +766,6 @@ function spawn2(file, second, third, previous) {
|
|
|
759
766
|
// src/install.ts
|
|
760
767
|
var import_is_ci = __toESM(require_is_ci(), 1);
|
|
761
768
|
|
|
762
|
-
// src/verifyPackage.ts
|
|
763
|
-
import path4 from "node:path";
|
|
764
|
-
|
|
765
769
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
766
770
|
var balanced = (a, b, str) => {
|
|
767
771
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
@@ -4822,12 +4826,12 @@ var PathBase = class {
|
|
|
4822
4826
|
/**
|
|
4823
4827
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
4824
4828
|
*/
|
|
4825
|
-
resolve(
|
|
4826
|
-
if (!
|
|
4829
|
+
resolve(path5) {
|
|
4830
|
+
if (!path5) {
|
|
4827
4831
|
return this;
|
|
4828
4832
|
}
|
|
4829
|
-
const rootPath = this.getRootString(
|
|
4830
|
-
const dir =
|
|
4833
|
+
const rootPath = this.getRootString(path5);
|
|
4834
|
+
const dir = path5.substring(rootPath.length);
|
|
4831
4835
|
const dirParts = dir.split(this.splitSep);
|
|
4832
4836
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
4833
4837
|
return result;
|
|
@@ -5579,8 +5583,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
5579
5583
|
/**
|
|
5580
5584
|
* @internal
|
|
5581
5585
|
*/
|
|
5582
|
-
getRootString(
|
|
5583
|
-
return win32.parse(
|
|
5586
|
+
getRootString(path5) {
|
|
5587
|
+
return win32.parse(path5).root;
|
|
5584
5588
|
}
|
|
5585
5589
|
/**
|
|
5586
5590
|
* @internal
|
|
@@ -5626,8 +5630,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
5626
5630
|
/**
|
|
5627
5631
|
* @internal
|
|
5628
5632
|
*/
|
|
5629
|
-
getRootString(
|
|
5630
|
-
return
|
|
5633
|
+
getRootString(path5) {
|
|
5634
|
+
return path5.startsWith("/") ? "/" : "";
|
|
5631
5635
|
}
|
|
5632
5636
|
/**
|
|
5633
5637
|
* @internal
|
|
@@ -5716,11 +5720,11 @@ var PathScurryBase = class {
|
|
|
5716
5720
|
/**
|
|
5717
5721
|
* Get the depth of a provided path, string, or the cwd
|
|
5718
5722
|
*/
|
|
5719
|
-
depth(
|
|
5720
|
-
if (typeof
|
|
5721
|
-
|
|
5723
|
+
depth(path5 = this.cwd) {
|
|
5724
|
+
if (typeof path5 === "string") {
|
|
5725
|
+
path5 = this.cwd.resolve(path5);
|
|
5722
5726
|
}
|
|
5723
|
-
return
|
|
5727
|
+
return path5.depth();
|
|
5724
5728
|
}
|
|
5725
5729
|
/**
|
|
5726
5730
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -6207,9 +6211,9 @@ var PathScurryBase = class {
|
|
|
6207
6211
|
process7();
|
|
6208
6212
|
return results;
|
|
6209
6213
|
}
|
|
6210
|
-
chdir(
|
|
6214
|
+
chdir(path5 = this.cwd) {
|
|
6211
6215
|
const oldCwd = this.cwd;
|
|
6212
|
-
this.cwd = typeof
|
|
6216
|
+
this.cwd = typeof path5 === "string" ? this.cwd.resolve(path5) : path5;
|
|
6213
6217
|
this.cwd[setAsCwd](oldCwd);
|
|
6214
6218
|
}
|
|
6215
6219
|
};
|
|
@@ -6565,8 +6569,8 @@ var MatchRecord = class {
|
|
|
6565
6569
|
}
|
|
6566
6570
|
// match, absolute, ifdir
|
|
6567
6571
|
entries() {
|
|
6568
|
-
return [...this.store.entries()].map(([
|
|
6569
|
-
|
|
6572
|
+
return [...this.store.entries()].map(([path5, n]) => [
|
|
6573
|
+
path5,
|
|
6570
6574
|
!!(n & 2),
|
|
6571
6575
|
!!(n & 1)
|
|
6572
6576
|
]);
|
|
@@ -6771,9 +6775,9 @@ var GlobUtil = class {
|
|
|
6771
6775
|
signal;
|
|
6772
6776
|
maxDepth;
|
|
6773
6777
|
includeChildMatches;
|
|
6774
|
-
constructor(patterns,
|
|
6778
|
+
constructor(patterns, path5, opts) {
|
|
6775
6779
|
this.patterns = patterns;
|
|
6776
|
-
this.path =
|
|
6780
|
+
this.path = path5;
|
|
6777
6781
|
this.opts = opts;
|
|
6778
6782
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
6779
6783
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -6792,11 +6796,11 @@ var GlobUtil = class {
|
|
|
6792
6796
|
});
|
|
6793
6797
|
}
|
|
6794
6798
|
}
|
|
6795
|
-
#ignored(
|
|
6796
|
-
return this.seen.has(
|
|
6799
|
+
#ignored(path5) {
|
|
6800
|
+
return this.seen.has(path5) || !!this.#ignore?.ignored?.(path5);
|
|
6797
6801
|
}
|
|
6798
|
-
#childrenIgnored(
|
|
6799
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
6802
|
+
#childrenIgnored(path5) {
|
|
6803
|
+
return !!this.#ignore?.childrenIgnored?.(path5);
|
|
6800
6804
|
}
|
|
6801
6805
|
// backpressure mechanism
|
|
6802
6806
|
pause() {
|
|
@@ -7011,8 +7015,8 @@ var GlobUtil = class {
|
|
|
7011
7015
|
};
|
|
7012
7016
|
var GlobWalker = class extends GlobUtil {
|
|
7013
7017
|
matches = /* @__PURE__ */ new Set();
|
|
7014
|
-
constructor(patterns,
|
|
7015
|
-
super(patterns,
|
|
7018
|
+
constructor(patterns, path5, opts) {
|
|
7019
|
+
super(patterns, path5, opts);
|
|
7016
7020
|
}
|
|
7017
7021
|
matchEmit(e) {
|
|
7018
7022
|
this.matches.add(e);
|
|
@@ -7049,8 +7053,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
7049
7053
|
};
|
|
7050
7054
|
var GlobStream = class extends GlobUtil {
|
|
7051
7055
|
results;
|
|
7052
|
-
constructor(patterns,
|
|
7053
|
-
super(patterns,
|
|
7056
|
+
constructor(patterns, path5, opts) {
|
|
7057
|
+
super(patterns, path5, opts);
|
|
7054
7058
|
this.results = new Minipass({
|
|
7055
7059
|
signal: this.signal,
|
|
7056
7060
|
objectMode: true
|
|
@@ -7385,9 +7389,7 @@ function existingSimpleGitConfig(packageJson) {
|
|
|
7385
7389
|
}
|
|
7386
7390
|
async function existingHuskyConfig(cwd, fileSystem) {
|
|
7387
7391
|
try {
|
|
7388
|
-
const
|
|
7389
|
-
await fileSystem.stat(huskyPath);
|
|
7390
|
-
const huskyFiles = await glob(`.husky/**/*`, {
|
|
7392
|
+
const huskyFiles = await glob(".husky/**/*", {
|
|
7391
7393
|
fs: fileSystem,
|
|
7392
7394
|
ignore: ".husky/_/**",
|
|
7393
7395
|
cwd
|
|
@@ -7413,12 +7415,12 @@ async function existingHuskyConfig(cwd, fileSystem) {
|
|
|
7413
7415
|
function findGit(cwd) {
|
|
7414
7416
|
let current = cwd;
|
|
7415
7417
|
while (true) {
|
|
7416
|
-
const search =
|
|
7418
|
+
const search = path4.join(current, ".git");
|
|
7417
7419
|
if (fs2.existsSync(search)) {
|
|
7418
|
-
return
|
|
7420
|
+
return path4.resolve(current);
|
|
7419
7421
|
}
|
|
7420
7422
|
const child = current;
|
|
7421
|
-
current =
|
|
7423
|
+
current = path4.dirname(current);
|
|
7422
7424
|
if (current === child) {
|
|
7423
7425
|
break;
|
|
7424
7426
|
}
|
|
@@ -7431,8 +7433,8 @@ function configureCommitTemplate() {
|
|
|
7431
7433
|
console.warn("Failed to locate git directory, skipping gitmessage");
|
|
7432
7434
|
return;
|
|
7433
7435
|
}
|
|
7434
|
-
const relPath =
|
|
7435
|
-
const gitmessage =
|
|
7436
|
+
const relPath = path4.relative(gitDir, path4.join(__dirname, ".."));
|
|
7437
|
+
const gitmessage = path4.join(relPath, "gitmessage");
|
|
7436
7438
|
const args = ["config", "commit.template", gitmessage];
|
|
7437
7439
|
console.info(`git ${args.join(" ")}`);
|
|
7438
7440
|
spawnSync("git", args);
|
|
@@ -7440,11 +7442,11 @@ function configureCommitTemplate() {
|
|
|
7440
7442
|
async function setupGitHooks() {
|
|
7441
7443
|
const originCwd = process.env["INIT_CWD"] || "";
|
|
7442
7444
|
const packageJson = JSON.parse(
|
|
7443
|
-
await fsp.readFile(
|
|
7445
|
+
await fsp.readFile(path4.join(originCwd, "package.json"), {
|
|
7444
7446
|
encoding: "utf-8"
|
|
7445
7447
|
})
|
|
7446
7448
|
);
|
|
7447
|
-
if (invalidInstalledPackages(packageJson) || existingSimpleGitConfig(packageJson) || await existingHuskyConfig(originCwd,
|
|
7449
|
+
if (invalidInstalledPackages(packageJson) || existingSimpleGitConfig(packageJson) || await existingHuskyConfig(originCwd, fs2)) {
|
|
7448
7450
|
process.exit(1);
|
|
7449
7451
|
}
|
|
7450
7452
|
if (!import_is_ci.default) {
|
|
@@ -7452,7 +7454,7 @@ async function setupGitHooks() {
|
|
|
7452
7454
|
await spawn2("git", ["config", "--unset", "core.hooksPath"], {
|
|
7453
7455
|
cwd: originCwd
|
|
7454
7456
|
});
|
|
7455
|
-
fs2.rmSync(
|
|
7457
|
+
fs2.rmSync(path4.join(originCwd, ".husky/_"), {
|
|
7456
7458
|
recursive: true,
|
|
7457
7459
|
force: true
|
|
7458
7460
|
});
|