Skip to content

Commit dd14bc2

Browse files
authored
Merge pull request #3501 from SwiftPackageIndex/custom-collections-blogpost
First rough draft of custom collections blog post
2 parents d70d15f + 704c3cc commit dd14bc2

File tree

6 files changed

+83
-0
lines changed

6 files changed

+83
-0
lines changed
17.8 KB
Loading
15.5 KB
Loading
172 KB
Loading
159 KB
Loading
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
We first launched support for package collections ahead of WWDC 2021 as a convenient way to add packages to an Xcode project.
2+
3+
The first release of this feature generated a package collection for all an author or organisation’s packages. For example, you can copy a link for the package collection for Apple’s packages via [their author page](https://swiftpackageindex.com/apple) and [add it to Xcode](https://swiftpackageindex.com/package-collections).
4+
5+
Human-curated collections are a logical next step, and we received a request to implement this from the SSWG. Today, we are adding the ability to create package collections for key community efforts.
6+
7+
### How does it work?
8+
9+
Custom collections work in a similar way to our package list. However, instead of adding a package to [packages.json](https://github.com/SwiftPackageIndex/PackageList/blob/main/packages.json), you add the location of a collection index file (whose contents _you_ maintain) to [custom-package-collections.json](https://github.com/SwiftPackageIndex/PackageList/blob/main/custom-package-collections.json).
10+
11+
[Here’s what this looks like](https://github.com/SwiftPackageIndex/PackageList/blob/6bc193c42d7b523a9159632b8fbe89e0c172316f/custom-package-collections.json#L2-L8), taking the Swift Server Workgroup Graduated packages as an example:
12+
13+
```
14+
{
15+
"key": "sswg-graduated",
16+
"name": "Graduated",
17+
"description": "SSWG packages that are in 'graduated' state",
18+
"badge": "SSWG",
19+
"url": "https://swift.org/api/v1/sswg/incubation/graduated.json"
20+
}
21+
```
22+
23+
The fields in that JSON determine how we find and display the custom package collection.
24+
25+
The `key` field specifies the URL where the package collection will available on the Swift Package Index website:
26+
27+
<picture>
28+
<source srcset="/images/blog/custom-package-collection-url~dark.png" media="(prefers-color-scheme: dark)">
29+
<img src="/images/blog/custom-package-collection-url~light.png" alt="Safari's Address Bar with the package collection URL in it highlighting the part of the URL related to the key field.">
30+
</picture>
31+
32+
The `name` is its display name on the collections page as well as on the package page where we show a package’s membership to package collections:
33+
34+
<picture>
35+
<source srcset="/images/blog/custom-package-collections-package-page~dark.png" media="(prefers-color-scheme: dark)">
36+
<img src="/images/blog/custom-package-collections-package-page~light.png" alt="The custom package collection badge highlighted on a package page.">
37+
</picture>
38+
39+
The `description` field brielfly explains the motivation for this custom collection. It serves informational purposes and is not displayed.
40+
41+
The optional `badge` field is used to style the small badge next to the collection name on the package page. If omitted, the collection will have no badge.
42+
43+
Finally, the `url` field points to a location where you maintain a list of package URLs that belong to the collection. There should be of the format `https://github.com/author/package.git`. In particular, make sure the URL scheme is `https` and the `.git` suffix is included.
44+
45+
We match the listed packages against the list of all packages in the Swift Package Index and include only the ones we are able to match. Note that the matching is case-insensitive.
46+
47+
For example, here is the SSWG Graduated package collection’s list of packages:
48+
49+
```
50+
[
51+
"https://github.com/apple/swift-crypto.git",
52+
"https://github.com/apple/swift-log.git",
53+
"https://github.com/apple/swift-metrics.git",
54+
"https://github.com/apple/swift-nio.git",
55+
"https://github.com/apple/swift-statsd-client.git",
56+
"https://github.com/grpc/grpc-swift.git",
57+
"https://github.com/swift-server-community/APNSwift.git",
58+
"https://github.com/swift-server/async-http-client.git",
59+
"https://github.com/vapor/jwt-kit.git",
60+
"https://github.com/vapor/multipart-kit.git",
61+
"https://github.com/vapor/postgres-nio.git",
62+
"https://github.com/vapor/vapor.git",
63+
]
64+
```
65+
66+
### How to propose new custom collections
67+
68+
We will be considering additions to the custom collections list on a case by case basis for package lists that benefit the Swift package ecosystem.
69+
70+
Such lists should be goverened by a group or organisation active in the Swift open source community and have appeal for a significant part of the Swift ecosystem.
71+
72+
The intial set of SSWG collections give an example of these requirements:
73+
74+
- The content of the lists is managed by the Swift Server Workgroup.
75+
- While mainly geared towards server-side development, many packages like for example `swift-crypto` are relevant even for developers not working with server-side Swift.
76+
- Making the maturity levels of these packages visible on the Swift Package Index helps developers find quality packages for their needs.
77+
78+
Please [get in touch](https://discord.gg/vQRb6KkYRw) if you have questions, would like to propose a new custom collection, or open an issue or pull request on the [PackageList repository](https://github.com/SwiftPackageIndex/PackageList/) for discussion.

Resources/Blog/posts.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,8 @@
193193
summary: We are thrilled to announce that Amazon is joining Apple as a supporter of the Swift Package Index by providing infrastructure support.
194194
published_at: 2024-10-28
195195
published: true
196+
- slug: introducing-custom-package-collections
197+
title: Introducing custom package collections
198+
summary: We've added support for custom package collections to allow well-known community efforts to present package collections.
199+
published_at: 2024-11-22
200+
published: false

0 commit comments

Comments
 (0)