{"id":18048091,"url":"https://github.com/startautomating/psminifier","last_synced_at":"2025-04-10T09:49:37.369Z","repository":{"id":42478899,"uuid":"235255442","full_name":"StartAutomating/PSMinifier","owner":"StartAutomating","description":"A Miniature Minifier For PowerShell","archived":false,"fork":false,"pushed_at":"2022-07-09T00:37:38.000Z","size":113,"stargazers_count":21,"open_issues_count":10,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T06:18:32.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StartAutomating.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-21T04:25:51.000Z","updated_at":"2025-03-05T17:02:34.000Z","dependencies_parsed_at":"2023-01-11T17:22:12.353Z","dependency_job_id":null,"html_url":"https://github.com/StartAutomating/PSMinifier","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPSMinifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPSMinifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPSMinifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StartAutomating%2FPSMinifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StartAutomating","download_url":"https://codeload.github.com/StartAutomating/PSMinifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248197461,"owners_count":21063619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T20:11:34.433Z","updated_at":"2025-04-10T09:49:37.344Z","avatar_url":"https://github.com/StartAutomating.png","language":"PowerShell","readme":"\nPSMinifier [1.1.3]\n================\nA Miniature Minifier For PowerShell\n\n----------------\n\n\n### Using the PSMinifier GitHub Action:\n\n\nThe PSMinifier action is easy to use.  By default, it will minify all .ps1 files not named *.*.ps1 within your GitHub Workspace.\n\n~~~Yaml\n- name: PSMinifier\n  uses: StartAutomating/PSMinifier@v1.1.3\n~~~\n\nThis will generate a .min.ps1 for every PowerShell in your workspace.\n\n#### Commiting Minified Code\n\n\nIf you would like to check in the minified code, simply provide a commit message\n\n~~~yaml\n- name: PSMinifier\n  uses: StartAutomating/PSMinifier@v1.1.3\n  with:\n    CommitMessage: \"Minifying $($_.Name)\"\n~~~\n\n\n#### Including and Excluding Paths\n\nThe parameters of the GitHub action largely map to the parameters of Compress-ScriptBlock, with a couple of notable exceptions:\n* Include\n* Exclude\n~~~yaml\n- name: PSMinifier\n  uses: StartAutomating/PSMinifier@v1.1.3\n  with:\n    Include: \"*.ps1\"\n    Exclude: \"*.tests.ps1\"\n    CommitMessage: \"Minifying $($_.Name)\"\n~~~\n\n#### GZipping Minified Code\n\nFor even more space savings and obfuscation, you can GZip minified code:\n~~~yaml\n- name: PSMinifier\n  uses: StartAutomating/PSMinifier@v1.1.3\n  with:\n    CommitMessage: \"Minifying and GZipping $($_.Name)\"\n    GZip: true\n~~~\n\n\n### PSMinifier Action Output\n\nThe PSMinifier action includes some output parameters, such as:\n* MinifiedPercent\n* MinifiedSize\n* OriginalSize\n\n~~~yaml\n- name: Use PSMinifier Action\n  uses: StartAutomating/PSMinifier@v1.1.3\n  id: Minify\n  with: \n    CommitMessage: Minifying $($_.Name)\n- name: OutputMinifier\n  run: |    \n    echo Original Size ${{ steps.Minify.outputs.OriginalSize }} \n    echo Minified Size ${{ steps.Minify.outputs.MinifiedSize }} \n    echo Minified Percent ${{ steps.Minify.outputs.MinifiedPercent }}\n~~~\n\n\n\n----------------\n### Module Commands\n-----------------------\n|    Verb|Noun        |\n|-------:|:-----------|\n|Compress|-ScriptBlock|\n-----------------------\n---\nPSMinifier is a minature minifier for PowerShell.\n\nMinification makes your scripts smaller and much harder to read.  Thus it is helpful when trying to reduce filesize, and not \nhelpful when trying to make readable code.\n\nPSMinifier can minify itself with:\n    \n~~~\n# This returns the minified contents of the definition of Compress-ScriptBlock\nCompress-ScriptBlock -ScriptBlock (Get-Command Compress-ScriptBlock).ScriptBlock\n~~~\n\nOr more elegantly, with:\n\n~~~\n# This returns the minified contents of Compress-ScriptBlock, assigned to a variable ${Compressed-ScriptBlock}\nGet-Command Compress-ScriptBlock | Compress-ScriptBlock\n~~~\n\n\nIf that isn't compact or opaque enough, you can also -GZip the contents of a ScriptBlock\n\n~~~\nGet-Command Compress-ScriptBlock | Compress-ScriptBlock -GZip\n~~~\n\nIf that isn't minified enough, you can pass both -GZip and -NoBlock to recreate the script block in one long line.\n~~~\nGet-Command Compress-ScriptBlock | Compress-ScriptBlock -GZip -NoBlock\n~~~\n\n\nBoth of the preceeding examples minified a function into an anonymous Script Block.  This can be useful for embedding single \ncommands.\nYou can also minify a .ps1 file to include directly within a module.\n~~~\nGet-Command Compress-ScriptBlock | # Get Compress-ScriptBlock\n    Foreach-Object {$_.ScriptBlock.File }| # Get the file it is declared in\n    Get-Command | # get the command (if you were in the directory, this would be Get-Command .\\Compress-ScriptBlock.ps1)\n    Compress-ScriptBlock -Anonymous # compress the script, but don't assign it to a variable.\n~~~\n\n\nIf you want to GZip a ScriptBlock and declare the functions within it, you have to pass -DotSource:\n\n~~~\nGet-Command Compress-ScriptBlock | # Get Compress-ScriptBlock\n    Foreach-Object {$_.ScriptBlock.File }| # Get the file it is declared in\n    Get-Command | # get the command \n    Compress-ScriptBlock -Anonymous -GZip -DotSource # compress and dot-source the script.\n~~~\n\n\nPSMinifier works by walking the PowerShell Abstract Syntax Tree and recreating a minimal version of your script.  As such, any \ninline help will be lost.\nPSMinifier will not minify strings, as to do so would change functionality.\n\nImportantly, _PSMinifier is not an optimizer_.  It does not change the content of your scripts, attempt to improve their \nperformance, or rename your variables.\n\nIf PSMinifier fails to minify your script, please open an issue on GitHub.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fpsminifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstartautomating%2Fpsminifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstartautomating%2Fpsminifier/lists"}