Problem
Have two development environments:
Laptop
MacOS, Visual Studio Professional for Mac, .NET Core 3.0
Desktop
Windows 10, Visual Studio Professional for Windows, .NET Core 3.0
Need to write a script that will be working on Windows (.bat file) and MacOS (bash).
For example sake, scripting languages or msbuild conditions should not be used.
Solution
Never thought that it's possible, definitely not an option for complex scenarios, but for basic commands go following (assuming that script build_webpack.cmd).
Now, if we need to invoke this script during project build, add the following line:
Have two development environments:
Laptop
MacOS, Visual Studio Professional for Mac, .NET Core 3.0
Desktop
Windows 10, Visual Studio Professional for Windows, .NET Core 3.0
Need to write a script that will be working on Windows (.bat file) and MacOS (bash).
For example sake, scripting languages or msbuild conditions should not be used.
Solution
Never thought that it's possible, definitely not an option for complex scenarios, but for basic commands go following (assuming that script build_webpack.cmd).
echo off
goto(){
#!/bin/bash
NODE=`which node`
cd "$(dirname "$0")/.."
$NODE ./node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js $@
}
goto $@
exit
:(){
SET mypath=%~dp0
CD "%mypath:~0,-1%\\.."
node node_modules\\webpack\\bin\\webpack.js --config webpack.config.vendor.js %*
<Exec Command="ClientApp/scripts/build_webpack.cmd --env.dev" />
Detailed explanation can be found at: https://nastytester.com/posts/script-that-works-in-windows-and-linux.html
No comments:
Post a Comment