Skip to content

Instantly share code, notes, and snippets.

@conorlawton
Created February 1, 2024 16:04
Show Gist options
  • Save conorlawton/826fd8aa687f98c19f7f68d2ec8e9123 to your computer and use it in GitHub Desktop.
Save conorlawton/826fd8aa687f98c19f7f68d2ec8e9123 to your computer and use it in GitHub Desktop.
tasks.json for ccmod
{
// Set ccpath in environment variables to path to CrossCode executable.
// Add 7z executable to path
"version": "2.0.0",
"tasks": [
{
"label": "Run",
"type": "shell",
"command": "Remove-Item -Path (Join-Path ${workspaceFolder} -ChildPath \"dist\\assets\") -Force -Recurse;Copy-Item -Path (Join-Path -Path ${workspaceFolder} -ChildPath \"src\\assets\") -Destination \"${workspaceFolder}\\dist\" -Recurse;Copy-Item -Path (Join-Path -Path ${workspaceFolder} -ChildPath \"ccmod.json\") -Destination \"${workspaceFolder}\\dist\";$iconPath = (Join-Path -Path ${workspaceFolder} -ChildPath \"icon.png\"); if (Test-Path $iconPath) { Copy-Item -Path $iconPath -Destination \"${workspaceFolder}\\dist\"};tsc --project \"${workspaceFolder}\\tsconfig.json\" --outDir \"${workspaceFolder}\\dist\\${workspaceFolderBasename}\";Set-Location dist; 7z a -tzip \"${workspaceFolderBasename}.ccmod\" \"${workspaceFolder}\\dist\\*\" -xr!'*.ccmod';Copy-Item -Path \"${workspaceFolder}\\dist\\${workspaceFolderBasename}.ccmod\" -Destination (Join-Path -Path $env:ccpath -ChildPath \\assets\\mods); ii $env:ccpath\\CrossCode.exe",
"problemMatcher": []
},
{
"label": "Build release",
"type": "shell",
"command": "Remove-Item -Path (Join-Path ${workspaceFolder} -ChildPath \"dist\\assets\") -Force -Recurse; Copy-Item -Path (Join-Path -Path ${workspaceFolder} -ChildPath \"src\\assets\") -Destination \"${workspaceFolder}\\dist\" -Recurse; Copy-Item -Path (Join-Path -Path ${workspaceFolder} -ChildPath \"ccmod.json\") -Destination \"${workspaceFolder}\\dist\"; $iconPath = (Join-Path -Path ${workspaceFolder} -ChildPath \"icon.png\"); if (Test-Path $iconPath) { Copy-Item -Path $iconPath -Destination \"${workspaceFolder}\\dist\"}; tsc --project \"${workspaceFolder}\\tsconfig.json\" --outDir \"${workspaceFolder}\\dist\\${workspaceFolderBasename}\"; cd dist; 7z a -tzip \"${workspaceFolderBasename}.ccmod\" \"${workspaceFolder}\\dist\\*\" -xr!'*.ccmod'; Copy-Item -Path \"${workspaceFolder}\\dist\\${workspaceFolderBasename}.ccmod\" -Destination (Join-Path -Path $env:ccpath -ChildPath \\assets\\mods); Write-Host \"Done\"",
"problemMatcher": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment