@goreleaser/sponsors 0.0.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GoReleaser
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # sponsors
2
+
3
+ Fetches sponsors from [GitHub Sponsors](https://github.com/sponsors) and [OpenCollective](https://opencollective.com) and renders them into your files via Go templates.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ # brew:
9
+ brew install --cask goreleaser/tap/sponsors
10
+
11
+ # npm/npx:
12
+ npm -ig @goreleaser/sponsors
13
+ npx @goreleaser/sponsors
14
+
15
+ # from source:
16
+ go install github.com/goreleaser/sponsors@latest
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```sh
22
+ # Fetch sponsors and write sponsors.json (requires GITHUB_TOKEN)
23
+ sponsors generate --config sponsors.yml sponsors.json
24
+
25
+ # Render a template between commented markers (sponsors apply --help):
26
+ sponsors apply sponsors.json readme.tpl.md README.md
27
+ ```
28
+
29
+ `--config` defaults to `sponsors.yml` in the current directory.
30
+
31
+ ## Config
32
+
33
+ ```yaml
34
+ github_user: caarlos0
35
+ opencollective_slug: goreleaser
36
+
37
+ tiers:
38
+ - id: gold
39
+ name: Gold
40
+ monthly_rate: 100
41
+ - id: backer
42
+ name: Backer
43
+ monthly_rate: 0
44
+
45
+ # Redirect a sponsor's login to another account (e.g. individual → org).
46
+ # The target's real name, avatar and website are fetched from GitHub.
47
+ aliases:
48
+ johndoe: acme-corp
49
+
50
+ # Manually managed entries; those past end_date are silently ignored.
51
+ external_sponsors:
52
+ - name: Acme Corp
53
+ id: acme-corp
54
+ source: github
55
+ website: https://acme.com
56
+ image: https://github.com/acme-corp.png
57
+ tier: gold
58
+ end_date: "2027-03-23"
59
+ ```
60
+
61
+ ## Templates
62
+
63
+ Templates receive `.Sponsors`, `.Tiers`, and `.ByTier` (sponsors keyed by tier ID).
64
+ A `dict` helper and `Sponsor.LogoWithSize(size int)` are available:
65
+
66
+ ```go-template
67
+ {{- define "tier" -}}
68
+ {{- if $s := index . "sponsors" }}
69
+ {{- range $s }}<a href="{{ .Website }}"><img src="{{ .LogoWithSize (index $ "size") }}" /></a>{{ end }}
70
+ {{- end -}}
71
+ {{- end -}}
72
+ {{- template "tier" (dict "size" 96 "sponsors" (index .ByTier "gold")) -}}
73
+ ```
74
+
75
+ ---
76
+
77
+ <!-- sponsors:begin -->
78
+ <!-- this list is auto-generated by https://github.com/goreleaser/sponsors -->
79
+ <div align="center">
80
+ <h2>Our Sponsors</h2>
81
+ <h3>Platinum</h3>
82
+ <a href="https://github.com/SAP" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/2531208?v=4&s=112" alt="SAP" width="112" height="112"/></a>
83
+ <h3>Gold</h3>
84
+ <a href="https://github.com/mercedes-benz" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/34240465?v=4&s=96" alt="Mercedes-Benz Group" width="96" height="96"/></a>
85
+ <a href="https://github.com/nitrictech" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/72055470?v=4&s=96" alt="nitric" width="96" height="96"/></a>
86
+ <h3>Silver</h3>
87
+ <a href="https://depot.dev" target="_blank" rel="noopener sponsored" ><img src="https://images.opencollective.com/depot/39125a1/logo.png?height=80" alt="Depot" width="80" height="80"/></a>
88
+ <a href="https://www.n-ix.com/" target="_blank" rel="noopener sponsored" ><img src="https://images.opencollective.com/n-ix-ltd/575a7a5/logo.png?height=80" alt="N-iX Ltd" width="80" height="80"/></a>
89
+ <h3>Bronze</h3>
90
+ <a href="https://github.com/conetcloud" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/35725664?v=4&s=64" alt="conet cloud" width="64" height="64"/></a>
91
+ <a href="https://github.com/encoredev" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/50438175?v=4&s=64" alt="Encore" width="64" height="64"/></a>
92
+ <a href="https://github.com/comet-ml" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/31487821?v=4&s=64" alt="Comet" width="64" height="64"/></a>
93
+ <a href="https://about.gitea.com/" target="_blank" rel="noopener sponsored" ><img src="https://images.opencollective.com/gitea/bf35c2f/logo.png?height=64" alt="Gitea" width="64" height="64"/></a>
94
+ <a href="www.interviewpal.com" target="_blank" rel="noopener sponsored" ><img src="https://avatars.githubusercontent.com/u/268665632?v=4&s=64" alt="InterviewPal.com" width="64" height="64"/></a>
95
+ <h3>And many more!</h3>
96
+ <p>See the full list <a href="https://goreleaser.com/sponsors" target="_blank" rel="noopener sponsored">here</a>.</p>
97
+ </div>
98
+
99
+ <!-- sponsors:end -->
package/install.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This file was generated by GoReleaser. DO NOT EDIT.
4
+
5
+ import { install } from "./lib.js";
6
+ install();
package/lib.js ADDED
@@ -0,0 +1,229 @@
1
+ // This file was generated by GoReleaser. DO NOT EDIT.
2
+ import fs from "fs";
3
+ import crypto from "crypto";
4
+ import path from "path";
5
+ import JSZip from "jszip";
6
+ import { x as tarExtract } from "tar";
7
+ import axios from "axios";
8
+ import { ProxyAgent } from "proxy-agent";
9
+ import { spawnSync } from "child_process";
10
+ import { fileURLToPath } from "url";
11
+
12
+ const { archives, name, version } = JSON.parse(
13
+ fs.readFileSync(new URL("./package.json", import.meta.url), "utf8"),
14
+ );
15
+
16
+ const agent = new ProxyAgent();
17
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
+
19
+ const getArchive = () => {
20
+ let target = `${process.platform}-${process.arch}`;
21
+ const archive = archives[target];
22
+ if (!archive) {
23
+ throw new Error(`No archive available for ${target}`);
24
+ }
25
+ return archive;
26
+ };
27
+
28
+ const binDir = path.join(__dirname, "bin");
29
+
30
+ async function extractTar(tarPath, binaries, dir, wrappedIn) {
31
+ try {
32
+ const filesToExtract = wrappedIn
33
+ ? binaries.map((bin) =>
34
+ path.join(wrappedIn, bin).replace(/\\/g, "/"),
35
+ )
36
+ : binaries;
37
+
38
+ await tarExtract({
39
+ file: tarPath,
40
+ cwd: dir,
41
+ filter: (path) => filesToExtract.includes(path),
42
+ });
43
+
44
+ // If wrapped, move files from wrapped directory to bin directory
45
+ if (wrappedIn) {
46
+ const wrappedDir = path.join(dir, wrappedIn);
47
+ for (const binary of binaries) {
48
+ const srcPath = path.join(wrappedDir, binary);
49
+ const destPath = path.join(dir, binary);
50
+ if (fs.existsSync(srcPath)) {
51
+ fs.renameSync(srcPath, destPath);
52
+ }
53
+ }
54
+ // Clean up empty wrapped directory
55
+ try {
56
+ fs.rmSync(wrappedDir, { recursive: true, force: true });
57
+ } catch (err) {
58
+ // Ignore cleanup errors
59
+ }
60
+ }
61
+
62
+ console.log(`Successfully extracted ${binaries} to "${dir}"`);
63
+ } catch (err) {
64
+ throw new Error(`Extraction failed: ${err.message}`);
65
+ }
66
+ }
67
+
68
+ async function extractZip(zipPath, binaries, dir, wrappedIn) {
69
+ try {
70
+ const zipData = fs.readFileSync(zipPath);
71
+ const zip = await JSZip.loadAsync(zipData);
72
+
73
+ for (const binary of binaries) {
74
+ const binaryPath = wrappedIn
75
+ ? path.join(wrappedIn, binary).replace(/\\/g, "/")
76
+ : binary;
77
+
78
+ if (!zip.files[binaryPath]) {
79
+ throw new Error(
80
+ `Error: ${binaryPath} does not exist in ${zipPath}`,
81
+ );
82
+ }
83
+
84
+ const content = await zip.files[binaryPath].async("nodebuffer");
85
+ if (!fs.existsSync(dir)) {
86
+ fs.mkdirSync(dir, { recursive: true });
87
+ }
88
+ const file = path.join(dir, binary);
89
+ fs.writeFileSync(file, content);
90
+ fs.chmodSync(file, "755");
91
+ console.log(`Successfully extracted "${binary}" to "${dir}"`);
92
+ }
93
+ } catch (err) {
94
+ throw new Error(`Extraction failed: ${err.message}`);
95
+ }
96
+ }
97
+
98
+ const run = async (bin) => {
99
+ await install();
100
+ if (process.platform === "win32") {
101
+ bin += ".exe";
102
+ }
103
+ const [, , ...args] = process.argv;
104
+ let result = spawnSync(path.join(binDir, bin), args, {
105
+ cwd: process.cwd(),
106
+ stdio: "inherit",
107
+ });
108
+ if (result.error) {
109
+ console.error(result.error);
110
+ }
111
+ return result.status;
112
+ };
113
+
114
+ const install = async () => {
115
+ try {
116
+ let archive = getArchive();
117
+ if (await exists(archive)) {
118
+ return;
119
+ }
120
+ let tmp = fs.mkdtempSync("archive-");
121
+ let archivePath = path.join(tmp, archive.name);
122
+ await download(archive.url, archivePath);
123
+ verify(archivePath, archive.checksum);
124
+
125
+ if (!fs.existsSync(binDir)) {
126
+ fs.mkdirSync(binDir);
127
+ }
128
+ switch (archive.format) {
129
+ case "binary":
130
+ const bin = path.join(binDir, archive.bins[0]);
131
+ fs.copyFileSync(archivePath, bin);
132
+ fs.chmodSync(bin, 0o755);
133
+ break;
134
+ case "zip":
135
+ await extractZip(
136
+ archivePath,
137
+ archive.bins,
138
+ binDir,
139
+ archive.wrappedIn,
140
+ );
141
+ break;
142
+ case "tar":
143
+ case "tar.gz":
144
+ case "tgz":
145
+ await extractTar(
146
+ archivePath,
147
+ archive.bins,
148
+ binDir,
149
+ archive.wrappedIn,
150
+ );
151
+ break;
152
+ case "tar.zst":
153
+ case "tzst":
154
+ case "tar.xz":
155
+ case "txz":
156
+ default:
157
+ throw new Error(`unsupported format: ${archive.format}`);
158
+ }
159
+ console.log(`Installed ${name} ${version} to ${binDir}`);
160
+ } catch (err) {
161
+ throw new Error(`Installation failed: ${err.message}`);
162
+ }
163
+ };
164
+
165
+ const verify = (filename, checksum) => {
166
+ if (checksum.algorithm == "" || checksum.digest == "") {
167
+ console.warn("Warning: No checksum provided for verification");
168
+ return;
169
+ }
170
+ let digest = crypto
171
+ .createHash(checksum.algorithm)
172
+ .update(fs.readFileSync(filename))
173
+ .digest("hex");
174
+ if (digest != checksum.digest) {
175
+ throw new Error(
176
+ `${filename}: ${checksum.algorithm} does not match, expected ${checksum.digest}, got ${digest}`,
177
+ );
178
+ }
179
+ };
180
+
181
+ const download = async (url, filename) => {
182
+ try {
183
+ console.log(`Downloading ${url} to ${filename}...`);
184
+ const dir = path.dirname(filename);
185
+ if (!fs.existsSync(dir)) {
186
+ fs.mkdirSync(dir, { recursive: true });
187
+ }
188
+
189
+ const response = await axios({
190
+ method: "GET",
191
+ url: url,
192
+ responseType: "stream",
193
+ timeout: 300000, // 5min
194
+ httpAgent: agent,
195
+ httpsAgent: agent,
196
+ });
197
+
198
+ const writer = fs.createWriteStream(filename);
199
+ response.data.pipe(writer);
200
+
201
+ return new Promise((resolve, reject) => {
202
+ writer.on("finish", () => {
203
+ console.log(`Download complete: ${filename}`);
204
+ resolve(dir);
205
+ });
206
+
207
+ writer.on("error", (err) => {
208
+ console.error(`Error writing file: ${err.message}`);
209
+ reject(err);
210
+ });
211
+ });
212
+ } catch (err) {
213
+ throw new Error(`Download failed: ${err.message}`);
214
+ }
215
+ };
216
+
217
+ function exists(archive) {
218
+ if (!fs.existsSync(binDir)) {
219
+ return false;
220
+ }
221
+ return archive.bins.every((bin) => fs.existsSync(path.join(binDir, bin)));
222
+ }
223
+
224
+ export {
225
+ install,
226
+ run,
227
+ getArchive,
228
+ download,
229
+ };
package/package.json CHANGED
@@ -1,12 +1,113 @@
1
1
  {
2
2
  "name": "@goreleaser/sponsors",
3
- "version": "0.0.1",
4
- "description": "",
5
- "license": "MIT",
6
- "author": "",
7
- "type": "commonjs",
8
- "main": "index.js",
3
+ "type": "module",
4
+ "version": "0.2.1",
5
+ "description": "Fetches sponsors from multiple sources and renders them based on templates",
9
6
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "postinstall": "node install.js",
8
+ "run": "node run-sponsors.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/goreleaser/sponsors"
13
+ },
14
+ "keywords": [
15
+ "goreleaser",
16
+ "sponsors"
17
+ ],
18
+ "author": "",
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/goreleaser/mcp/sponsors"
22
+ },
23
+ "homepage": "https://goreleaser.com/sponsors",
24
+ "bin": {
25
+ "sponsors": "run-sponsors.js"
26
+ },
27
+ "dependencies": {
28
+ "axios": "^1.8.2",
29
+ "jszip": "^3.10.1",
30
+ "proxy-agent": "^7.0.0",
31
+ "tar": "^7.4.3"
32
+ },
33
+ "archives": {
34
+ "darwin-arm64": {
35
+ "name": "sponsors_darwin_arm64.tar.gz",
36
+ "url": "https://github.com/goreleaser/sponsors/releases/download/v0.2.1/sponsors_darwin_arm64.tar.gz",
37
+ "bins": [
38
+ "sponsors"
39
+ ],
40
+ "format": "tar.gz",
41
+ "checksum": {
42
+ "algorithm": "sha256",
43
+ "digest": "627a85ab5d3fa3f12adc2c04526bb174df78eaf3a15a895b5c22b7a92184dc5a"
44
+ },
45
+ "wrappedIn": "sponsors_darwin_arm64"
46
+ },
47
+ "darwin-x64": {
48
+ "name": "sponsors_darwin_amd64.tar.gz",
49
+ "url": "https://github.com/goreleaser/sponsors/releases/download/v0.2.1/sponsors_darwin_amd64.tar.gz",
50
+ "bins": [
51
+ "sponsors"
52
+ ],
53
+ "format": "tar.gz",
54
+ "checksum": {
55
+ "algorithm": "sha256",
56
+ "digest": "7df34dd32f3fcdeca14eb43252a5a93b35b0e3e93a546c894c9f8bc5e0186c74"
57
+ },
58
+ "wrappedIn": "sponsors_darwin_amd64"
59
+ },
60
+ "linux-arm64": {
61
+ "name": "sponsors_linux_arm64.tar.gz",
62
+ "url": "https://github.com/goreleaser/sponsors/releases/download/v0.2.1/sponsors_linux_arm64.tar.gz",
63
+ "bins": [
64
+ "sponsors"
65
+ ],
66
+ "format": "tar.gz",
67
+ "checksum": {
68
+ "algorithm": "sha256",
69
+ "digest": "a2a56990067be36dd6342a0896048395f107858ba5bf725996e3d581137534ae"
70
+ },
71
+ "wrappedIn": "sponsors_linux_arm64"
72
+ },
73
+ "linux-x64": {
74
+ "name": "sponsors_linux_amd64.tar.gz",
75
+ "url": "https://github.com/goreleaser/sponsors/releases/download/v0.2.1/sponsors_linux_amd64.tar.gz",
76
+ "bins": [
77
+ "sponsors"
78
+ ],
79
+ "format": "tar.gz",
80
+ "checksum": {
81
+ "algorithm": "sha256",
82
+ "digest": "905241b2a3179f0d393072b17b1e966df6ec5bc16ba3be4011e0cfc75631fdbc"
83
+ },
84
+ "wrappedIn": "sponsors_linux_amd64"
85
+ },
86
+ "win32-arm64": {
87
+ "name": "sponsors_windows_arm64.tar.gz",
88
+ "url": "https://github.com/goreleaser/sponsors/releases/download/v0.2.1/sponsors_windows_arm64.tar.gz",
89
+ "bins": [
90
+ "sponsors.exe"
91
+ ],
92
+ "format": "tar.gz",
93
+ "checksum": {
94
+ "algorithm": "sha256",
95
+ "digest": "fe4c33d8a9ae927f9c5d49e2368ca86319fde0ebe2574cfbd965b7a7822f0ec7"
96
+ },
97
+ "wrappedIn": "sponsors_windows_arm64"
98
+ },
99
+ "win32-x64": {
100
+ "name": "sponsors_windows_amd64.tar.gz",
101
+ "url": "https://github.com/goreleaser/sponsors/releases/download/v0.2.1/sponsors_windows_amd64.tar.gz",
102
+ "bins": [
103
+ "sponsors.exe"
104
+ ],
105
+ "format": "tar.gz",
106
+ "checksum": {
107
+ "algorithm": "sha256",
108
+ "digest": "9cacaaac20c1b113facbf71e369cb5529c1f71ccd25351282c2a7b4071162dc5"
109
+ },
110
+ "wrappedIn": "sponsors_windows_amd64"
111
+ }
11
112
  }
12
- }
113
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This file was generated by GoReleaser. DO NOT EDIT.
4
+
5
+ import { run } from "./lib.js";
6
+ run("sponsors").then((code) => process.exit(code));
package/index.js DELETED
File without changes