Pibd-21_Ievlewa_M.D._Intern.../node_modules/.bin/json-server.ps1

29 lines
829 B
PowerShell
Raw Normal View History

2023-12-03 19:52:09 +04:00
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
2023-12-10 22:07:47 +04:00
$input | & "$basedir/node$exe" "$basedir/../json-server/lib/cli/bin.js" $args
2023-12-03 19:52:09 +04:00
} else {
2023-12-10 22:07:47 +04:00
& "$basedir/node$exe" "$basedir/../json-server/lib/cli/bin.js" $args
2023-12-03 19:52:09 +04:00
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
2023-12-10 22:07:47 +04:00
$input | & "node$exe" "$basedir/../json-server/lib/cli/bin.js" $args
2023-12-03 19:52:09 +04:00
} else {
2023-12-10 22:07:47 +04:00
& "node$exe" "$basedir/../json-server/lib/cli/bin.js" $args
2023-12-03 19:52:09 +04:00
}
$ret=$LASTEXITCODE
}
exit $ret