[Pitch] New command for package creation, and package templates

Hey everyone!

I'd like to get your feedback on this evolution. In short the goal is to improve the experience of creating brand new packages when there isn't any pre-existing sources, and the introduction of package templates allowing for greater flexibility when creating Swift packages.

3 Likes

-1 as is

The proposal was well written and I enjoyed reading it. swift package create is a very pleasant sounding command, but the changes suggested don’t seem worth the complexity and added burden to the package managers maintainability.

Templates are clearly the star of the show here. I think templates in general sound like a good idea. However while I was reading the proposal I kept thinking it would be way easier to copy or clone the package you want and rename it, then to look up template names assuming you even have them installed and updated.

I can’t personally conceive of a situation where you’d be creating the same type of package so frequently that you’d need your own personal template. However my packages always require a per-project executable package and an intermediate library with dependencies. All my users will need to do this, so I can appreciate an automation of some kind for this situation. However the proposal requires my users to install a template locally, and to be perfectly frank; if this feature existed today I would simply tell my users to clone the sample project and rename it.

I think if a template system were to be added it should revolve around git and actual package directory structures. This way the package manager won’t require complex changes and templates would grow with package features. Renaming the clone and removing its .git directory in a single command would be nice.

So a swift package rename command would solve most of the suggested issues. There’s another proposal for modifying existing packages and I think it includes rename, Please forgive me I’m on mobile and cant find it atm.

If a revision is done, I would appreciate a focus on keeping things as similar to actual packages as possible. I would also like to see a method for sharing templates, preferably with git, and preferably allowing multiple templates in a repository.

After reading through the pitch proposal, I am +1 in the concept, but -1 on the approach.

The concept being proposed would be a boon for anyone looking to establish conventions and speed up onboarding, from organizations to framework authors. However, there are some aspects of the approach that miss the mark for me. A few questions, if you don’t mind.

Have you looked into the how other PM communities approach this problem, such as npm.js ? In general, it would be better if templates were invisibly downloaded and processed by users, and if they gave creators the ability to specify any permutation of filesystem structure and content using both static assets and dynamic executables. Additionally, I would’ve liked to have seen a section in the proposal that detailed which features from which PM communities where used to establish precedent.

Why JSON and not Swift? Again, I would like to see the filesystem alone declaring the template’s static structure and content. But for all things dynamic, I suggest following the precedent established by SPM itself in its use of Swift for Package.swift.

Hope this feedback helps refine the proposal. :slight_smile:

Terms of Service

Privacy Policy

Cookie Policy