Created
May 11, 2015 12:28
-
-
Save pjmagee/5e587338ae59d4b64f20 to your computer and use it in GitHub Desktop.
TypeScript Compile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PowerShell Execution policy needs to be changed to execute this script. | |
| # Run Power shell as Admin and execute the following line | |
| # Set-ExecutionPolicy -ExecutionPolicy Unrestricted | |
| # Author: Patrick Magee | |
| # Version 1.0.2 | |
| # | |
| # PowerShell Tools for Visual Studio | |
| # http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597 | |
| # Useful variables | |
| # $PSCommandPath | |
| # $PSScriptRoot | |
| # Could be added to Model Post-Build event | |
| # powershell -NoLogo -NonInteractive -ExecutionPolicy Unrestricted -Command "$(SolutionDir)PowerShell\CompileTypeScriptFiles.ps1" | |
| $scriptDirectory = "$PSScriptRoot\..\Website\Scripts" | |
| $totalProcessed = 0 | |
| $activity = "Compiling TypeScript files" | |
| $scripts = gci -Path $scriptDirectory -Recurse -Filter "*.ts" | where { -not $_.FullName.Contains("typings") } | |
| $total = $scripts.Length | |
| $status = "Total Processed: $totalProcessed/$total" | |
| $scripts | ft -AutoSize -Property Name, FullName | |
| Write-Progress -Activity $activity -PercentComplete 0 -Status $status | |
| $scripts | foreach { | |
| $currentItem = $scripts.IndexOf($_); | |
| write "Compiling $_" | |
| &tsc -sourcemap $_.FullName # Call the TypeScript compiler on the current ts file. | |
| $totalProcessed = $currentItem + 1 | |
| $complete = $currentItem / $scripts.Length * 100 | |
| $status = "Total Processed: $totalProcessed/$total" | |
| Write-Progress -Activity $activity -PercentComplete $complete -Status $status | |
| } | |
| $totalDefinitions = ($scripts).Count | |
| write "Done." | |
| write "Total TypeScript files: $totalDefinitions." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment