@vltpkg/cmd-shim 1.3.7 → 1.4.0
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/index.js +7 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// @<prog> <args...> %dp0%<target> %*
|
|
10
10
|
import { chmod, mkdir, readFile, stat, writeFile, } from 'node:fs/promises';
|
|
11
11
|
import { error } from '@vltpkg/error-cause';
|
|
12
|
-
import { dirname, relative } from 'node:path';
|
|
12
|
+
import { dirname, isAbsolute, relative } from 'node:path';
|
|
13
13
|
import { convertToSetCommands } from "./to-batch-syntax.js";
|
|
14
14
|
export { findCmdShim, findCmdShimIfExists, readCmdShim, readCmdShimIfExists, } from "./read.js";
|
|
15
15
|
const shebangExpr = /^#!\s*(?:\/usr\/bin\/env\s+(?:-S\s+)?((?:[^ \t=]+=[^ \t=]+\s+)*))?([^ \t]+)(.*)$/;
|
|
@@ -57,6 +57,8 @@ const writeShim = async (from, to, remover) => {
|
|
|
57
57
|
};
|
|
58
58
|
const writeShim_ = async (from, to, prog, args, variables) => {
|
|
59
59
|
let shTarget = relative(dirname(to), from);
|
|
60
|
+
// win32 cross-drive: relative() is absolute, so no basedir prefix
|
|
61
|
+
const [dp0, basedir] = isAbsolute(shTarget) ? ['', ''] : ['%dp0%\\', '$basedir/'];
|
|
60
62
|
let target = shTarget.split('/').join('\\');
|
|
61
63
|
let longProg;
|
|
62
64
|
let shProg = prog?.split('\\').join('/');
|
|
@@ -67,8 +69,8 @@ const writeShim_ = async (from, to, prog, args, variables) => {
|
|
|
67
69
|
args = args || '';
|
|
68
70
|
variables = variables || '';
|
|
69
71
|
if (!prog) {
|
|
70
|
-
prog = `"
|
|
71
|
-
shProg = `"$basedir
|
|
72
|
+
prog = `"${dp0}${target}"`;
|
|
73
|
+
shProg = `"${basedir}${shTarget}"`;
|
|
72
74
|
pwshProg = shProg;
|
|
73
75
|
args = '';
|
|
74
76
|
target = '';
|
|
@@ -78,8 +80,8 @@ const writeShim_ = async (from, to, prog, args, variables) => {
|
|
|
78
80
|
longProg = `"%dp0%\\${prog}.exe"`;
|
|
79
81
|
shLongProg = `"$basedir/${prog}"`;
|
|
80
82
|
pwshLongProg = `"$basedir/${prog}$exe"`;
|
|
81
|
-
target = `"
|
|
82
|
-
shTarget = `"$basedir
|
|
83
|
+
target = `"${dp0}${target}"`;
|
|
84
|
+
shTarget = `"${basedir}${shTarget}"`;
|
|
83
85
|
}
|
|
84
86
|
// Subroutine trick to fix https://github.com/npm/cmd-shim/issues/10
|
|
85
87
|
// and https://github.com/npm/cli/issues/969
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/cmd-shim",
|
|
3
3
|
"description": "Executable script shims for Windows",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"url": "http://vlt.sh"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@vltpkg/error-cause": "1.
|
|
17
|
-
"@vltpkg/rollback-remove": "1.
|
|
16
|
+
"@vltpkg/error-cause": "1.4.0",
|
|
17
|
+
"@vltpkg/rollback-remove": "1.4.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@eslint/js": "^9.39.1",
|