citeclaw 2.0.9 → 2.0.10
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/package.json +1 -1
- package/scripts/botcite.js +21 -2
package/package.json
CHANGED
package/scripts/botcite.js
CHANGED
|
@@ -343,6 +343,24 @@ function fileExists( filePath ) {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
function normalizeCommandForSpawn( command, platform ) {
|
|
347
|
+
const activePlatform = platform || process.platform;
|
|
348
|
+
if ( activePlatform !== 'win32' ) {
|
|
349
|
+
return command;
|
|
350
|
+
}
|
|
351
|
+
if ( /[\\/]/.test( command ) || /\.[^\\/]+$/.test( command ) ) {
|
|
352
|
+
return command;
|
|
353
|
+
}
|
|
354
|
+
const windowsCommands = {
|
|
355
|
+
npm: 'npm.cmd',
|
|
356
|
+
npx: 'npx.cmd',
|
|
357
|
+
git: 'git.exe',
|
|
358
|
+
curl: 'curl.exe',
|
|
359
|
+
bun: 'bun.exe'
|
|
360
|
+
};
|
|
361
|
+
return windowsCommands[ command ] || command;
|
|
362
|
+
}
|
|
363
|
+
|
|
346
364
|
function commandExists( command ) {
|
|
347
365
|
const args = process.platform === 'win32' ? [ '/c', 'where', command ] : [ '-lc', `command -v ${ command }` ];
|
|
348
366
|
const found = spawnSync( process.platform === 'win32' ? 'cmd' : 'bash', args, {
|
|
@@ -439,7 +457,7 @@ function jsonOut( value ) {
|
|
|
439
457
|
}
|
|
440
458
|
|
|
441
459
|
function runCommandText( command, args ) {
|
|
442
|
-
const result = spawnSync( command, args, {
|
|
460
|
+
const result = spawnSync( normalizeCommandForSpawn( command ), args, {
|
|
443
461
|
stdio: 'pipe',
|
|
444
462
|
encoding: 'utf8'
|
|
445
463
|
} );
|
|
@@ -454,7 +472,7 @@ function runCommandText( command, args ) {
|
|
|
454
472
|
}
|
|
455
473
|
|
|
456
474
|
function runCommandOrThrow( command, args, cwd ) {
|
|
457
|
-
const result = spawnSync( command, args, {
|
|
475
|
+
const result = spawnSync( normalizeCommandForSpawn( command ), args, {
|
|
458
476
|
cwd: cwd || rootDir,
|
|
459
477
|
stdio: 'pipe',
|
|
460
478
|
encoding: 'utf8'
|
|
@@ -5191,6 +5209,7 @@ module.exports = {
|
|
|
5191
5209
|
extractBestDoiCandidate,
|
|
5192
5210
|
extractPdfCandidates,
|
|
5193
5211
|
main,
|
|
5212
|
+
normalizeCommandForSpawn,
|
|
5194
5213
|
normalizeArxivId,
|
|
5195
5214
|
normalizeDoi,
|
|
5196
5215
|
syncStyles,
|