@rely-ai/caliber 1.48.1 → 1.48.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/bin.js +33 -5
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -4818,6 +4818,27 @@ var installNotificationHook = notificationHook.install;
|
|
|
4818
4818
|
var removeNotificationHook = notificationHook.remove;
|
|
4819
4819
|
var PRECOMMIT_START = "# caliber:pre-commit:start";
|
|
4820
4820
|
var PRECOMMIT_END = "# caliber:pre-commit:end";
|
|
4821
|
+
function tryWindowsDirectNodeInvocation(cmd) {
|
|
4822
|
+
if (process.platform !== "win32") return null;
|
|
4823
|
+
if (!/\.cmd$/i.test(cmd)) return null;
|
|
4824
|
+
const npmDir = path10.dirname(cmd);
|
|
4825
|
+
const binJs = path10.join(npmDir, "node_modules", "@rely-ai", "caliber", "dist", "bin.js");
|
|
4826
|
+
if (!fs11.existsSync(binJs)) return null;
|
|
4827
|
+
let nodePath;
|
|
4828
|
+
try {
|
|
4829
|
+
const out = execSync10("where node", {
|
|
4830
|
+
encoding: "utf-8",
|
|
4831
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
4832
|
+
}).trim();
|
|
4833
|
+
nodePath = pickExecutable(out);
|
|
4834
|
+
if (!nodePath) return null;
|
|
4835
|
+
} catch {
|
|
4836
|
+
return null;
|
|
4837
|
+
}
|
|
4838
|
+
const fwdNode = nodePath.replace(/\\/g, "/");
|
|
4839
|
+
const fwdBin = binJs.replace(/\\/g, "/");
|
|
4840
|
+
return `"${fwdNode}" "${fwdBin}"`;
|
|
4841
|
+
}
|
|
4821
4842
|
function getPrecommitBlock() {
|
|
4822
4843
|
const cmd = resolveCaliber();
|
|
4823
4844
|
const npx = isNpxResolution();
|
|
@@ -4835,13 +4856,20 @@ function getPrecommitBlock() {
|
|
|
4835
4856
|
invoke = cmd;
|
|
4836
4857
|
}
|
|
4837
4858
|
} else {
|
|
4838
|
-
const
|
|
4839
|
-
if (
|
|
4840
|
-
|
|
4859
|
+
const directNode = tryWindowsDirectNodeInvocation(cmd);
|
|
4860
|
+
if (directNode) {
|
|
4861
|
+
const nodeBin = directNode.match(/^"([^"]+)"/)?.[1] ?? "";
|
|
4862
|
+
guard = `[ -x "${nodeBin}" ]`;
|
|
4863
|
+
invoke = directNode;
|
|
4841
4864
|
} else {
|
|
4842
|
-
|
|
4865
|
+
const cmdBash = bashPath(cmd);
|
|
4866
|
+
if (path10.isAbsolute(cmd)) {
|
|
4867
|
+
guard = `[ -x "${cmdBash}" ]`;
|
|
4868
|
+
} else {
|
|
4869
|
+
guard = `[ -x "${cmdBash}" ] || command -v "${cmdBash}" >/dev/null 2>&1`;
|
|
4870
|
+
}
|
|
4871
|
+
invoke = `"${cmdBash}"`;
|
|
4843
4872
|
}
|
|
4844
|
-
invoke = `"${cmdBash}"`;
|
|
4845
4873
|
}
|
|
4846
4874
|
return `${PRECOMMIT_START}
|
|
4847
4875
|
if ${guard}; then
|
package/package.json
CHANGED