-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example / standard template organization #2
Comments
Hey, thanks for checking out what we've got at this stage with Plaster! We are still early enough in development (almost prototyping really) that I don't want to focus too much on what this particular example generates. It is meant just to show what is possible and hopefully a typical use case. The content of this template will surely change before Plaster is done. Right now we want to make sure that A) we have a manifest format that will allow you to scaffold what you want (create your own templates) and B) we have a manifest format that is safe from script injection attacks. After that we will want to make sure we have certain features like "default value" storage so I don't have to keep specifying my "full name" over and over. :-) Then we will want to think about working with ZIP'd versions of the template (ala nukpkg) and how we might distribute template pkgs. Then there is integration with VSCode. And then finally, what do some of the "built-in" template pkgs look like - if we even provide any built-in templates. WRT test, the size of the test artifacts in this particular example is tiny. There is only one test to verify the manifest is valid. So I don't think template pkg size should be an issue. Also, the user can elect not to have the test scaffolded. When the template is invoked it prompts you:
You can elect to pick all, some or none of Git, PSake and Pester. Note: this example is missing the |
I was working on making a custom template for something other than a module, but it's not really practical until the zip/folder support is added. The one I was working on had likely 50+ individual files I would need to manually add 1 by 1. II also felt you should give the option to tie the Root directory name to the name of the project. That way you don't have to enter the same name twice. |
@gerane Can you clarify if this is for the template directory structure or the directory structure that gets created by the invoked template? If it is the latter you have control over what gets created. And you can use the template's One thing I have been thinking of providing is pre-defined variable(s) for the DestinationPath the user provides when invoking the template. Perhaps In general I've viewed this process as - the user tells the template author under what dir (creating it if necessary) they want the template to scaffold its stuff and then the template is free to create whatever file/folders under this dir that it needs to. |
Hi all! I hear a release or pre-release might be coming! Just wanted to ping you on this - there's a good chance that the default example used in Plaster will become canon, or at least will be used by a good number of folks, given that it's from the PowerShell team (and community). I might be slightly biased, but I think it would be worth re-considering the example template organization. I tend to lean towards nesting a module outside of all the scaffolding cruft (some details here). Having a README, LICENSE, gitignore, Tests (this might be okay, some prefer it in the module folder, I do not), build.ps1, psake.ps1, etc. all in the root makes things quite messy and difficult to work with. I'm not particularly tied to that exact layout, as long as an alternative helps keep things clean and readable. I can live with it if no changes are made, just figured it would be worth pinging you one more time before this becomes more "official" : ) Cheers! |
Not sure what you mean by "nesting" here. Are you talking about simply separating the "shipped" module contents from the "infrastructure"?
I dunno. I kind of appreciate a Git repo with a build.bat or build.ps1 in its root so I can easily build whatever the repo has to build. :-) As for README and LICENSE, I think that is very common on GitHub at least to put in the root folder. We could stick all the module stuff into a subfolder like BTW there can be other templates e.g. perhaps a In your case, we "could" handle this a single template with lots of options that generates the appropriate artifacts based on how the user responds to template prompts. That said, if the common case is two files I don't want the user to have to answer a bunch of prompts that don't apply - every single time they use the template. I think this will be a balancing act but I don't have a good feel yet for when you should create a new template. I'm spit balling here but I'd say we'd like to keep the template prompts down to <= 6?? If a template needs more than that, perhaps it should be broken up into separate templates. |
Hi Keith! Apologies if it wasn't clear - like you mentioned, a subfolder with the module name is what I was aiming for. Even for a simple module, things will start to get confusing for new folks. Here's a quick example for a PSStackExchange module. I personally much, much prefer the latter. Current state:
Proposed alternative:
This makes it abundantly clear that if you are in the module folder, you are working with module-related-files, and if you're in the root folder, you're working with repo-and-related-systems-files (scaffolding). IMHO if you're going to have any scaffolding (readme, license, build, psake, etc.), the former (current) organization is cluttered, and should never be used. This could be me being finicky, I just find it difficult to parse through things, vs. having clear cut separation. Good point on multiple templates. That would certainly make sense and could address this : ) Cheers! |
I'm leaning in this direction. I could see using a generic |
Either works for me - personally I stick to May as well ping some other module authors: cc @dlwyatt @Jaykul @proxb @KirkMunro @dfinke @devblackops @gerane (Apologies for everyone I left out, didn't want to spam the whole community : P) Cheers! |
Don't use me as an example. :P (See: https://github.com/dlwyatt/ProtectedData ). I write build scripts that leave out all the non-essential stuff when it's published, but the repo is just one big folder full of stuff. |
What right we currently have is a |
Yep, that's a handy process, use something similar as well, pulling down psake if it doesn't exist. @dlwyatt: figured I'd ping folks on both sides : ) |
I agree with @RamblingCookieMonster. Keeping files related to the repository separate from files related to the module makes things easier. Especially as you start authoring more advanced modules. The current project I'm working on Watchmen has 12 files (build.ps1, psake.ps1, README.md, etc) at the repository root that are not directly related to the actual PowerShell module. IMHO having all those files and the PS module itself at the same level is messy.
I also like having |
I agree in principle with what devblackops wrote there, except that I generally name the folder "src"
For what it's worth, I always add my "projects" folder to my module path, and I build into folders with version numbers so I can import-module by name the module output:
If I have a C# project, then it's there in parallel to the "src" folder. |
I think the current NewModule template scaffolds files and folders in a way most folks here can live with. It keeps the "shipped" module files separate from the infrastructure files for build, test, script analyzer settings, license, etc. |
…the template full FileName which is used to create a File Example of use: # Used Template: <%=$PLASTER_TemplateSource%> Will get the full Template name: # Used Template PowerShellOrg#2: C:\…\scaffold\Build.template
Hi!
This might seem superficial at first glance, but given that end users may end up using examples / typical module templates the most, it might be worth some extra thought on their organization.
Two initial thoughts:
Those are the biggest that stand out - love the idea of the tool, thanks for putting this together!
Cheers!
The text was updated successfully, but these errors were encountered: