Skip to content

Commit

Permalink
fix(ci): windows stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
manuandru committed Mar 15, 2024
1 parent 1fdcc52 commit 2168095
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ on:
workflow_call:
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
build:
strategy:
Expand All @@ -20,11 +16,6 @@ jobs:
steps:
- name: Checkout
uses: DanySK/[email protected]
- uses: actions/setup-node@v4
if: matrix.os == 'windows-2022'
with:
node-version: 18
cache: 'npm'
- uses: DanySK/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import com.lordcodes.turtle.ShellScript
*/
object NpmCommandsExtension {

private fun String.cmdIfOnWindows(): String = System.getProperty("os.name").let { os ->
when {
os.contains("Windows") -> "$this.cmd"
else -> this
}
}

private val npmCommand: String = "npm".cmdIfOnWindows()
private val npxCommand: String = "npx".cmdIfOnWindows()

/**
* Install the dependencies.
*/
Expand All @@ -15,10 +25,10 @@ object NpmCommandsExtension {
/**
* Run the NPM command.
*/
fun ShellScript.npmCommand(vararg arguments: String): String = command("npm", arguments.toList())
fun ShellScript.npmCommand(vararg arguments: String): String = command(npmCommand, arguments.toList())

/**
* Run the NPX command.
*/
fun ShellScript.npxCommand(vararg arguments: String): String = command("npx", arguments.toList())
fun ShellScript.npxCommand(vararg arguments: String): String = command(npxCommand, arguments.toList())
}

0 comments on commit 2168095

Please sign in to comment.