Feature Request: Add script to `choco new` templates to remove comments from `ps1` and `nuspec` files
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
Currently there is a comment at the top of the `chocolateyinstall.ps1` and `chocolateyuninstall.ps1` files:
```
# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file:
# $f='c:\path\to\thisFile.ps1'
# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f
```
Would it be possible to move this code to a PowerShell script beside the `nuspec` file that runs on all of the ps1 files? This script could also remove all comments from the nuspec file as well.
Or, as another option: could this action be done as part of the `choco pack` process? Akin to minifying javascript before deploying to a website.
If this is something that would be desired, I have been working on a script in my own repo that I could contribute.
Contributor guide
Research direction
Start by examining the choco new templates containing chocolateyinstall.ps1, chocolateyuninstall.ps1, and the nuspec file, then trace the choco pack process. The issue presents two possible entry points, so first clarify whether comment removal belongs in template generation or packing. Done means comments are consistently removed from the relevant ps1 and nuspec files without breaking package creation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100