@jchat/addon-sdk 1.0.0-alpha.8 → 1.0.0-alpha.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @jchat/addon-sdk
2
2
 
3
+ ## 1.0.0-alpha.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 015f151: - Automatically generate `vendor-licenses.txt` for open-source attribution during addon build and include it in release zip archives.
8
+
3
9
  ## 1.0.0-alpha.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import * as fs$1 from "node:fs";
3
3
  import * as path$1 from "node:path";
4
4
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  //#region package.json
6
- var version = "1.0.0-alpha.8";
6
+ var version = "1.0.0-alpha.9";
7
7
  //#endregion
8
8
  //#region ../icon/dist/types.mjs
9
9
  const e = `Activity.ArrowLeft.ArrowRight.Ban.Bell.BookOpen.Brush.Calendar.Camera.ChartBar.Check.CheckCheck.CheckCircle2.ChevronDown.ChevronLeft.ChevronRight.ChevronUp.CircleAlert.CircleCheck.CircleOff.CirclePlay.CirclePlus.Clock.Coffee.Contact.Cpu.Database.Dices.Ellipsis.Eraser.ExternalLink.Eye.EyeOff.Flag.Flame.FolderPlus.Footprints.Gamepad2.Gift.Globe.HardDrive.Headphones.Heart.Image.Info.Key.KeyRound.Layers.LayoutDashboard.LayoutList.LayoutTemplate.Link2.ListOrdered.Loader.LoaderCircle.Lock.LogOut.Mail.Maximize.Megaphone.MemoryStick.Menu.MessageCircle.MessageSquare.Mic.Minimize.Minus.Monitor.Moon.MoreHorizontal.Music.Music2.Newspaper.Palette.Paperclip.PartyPopper.Pause.PenLine.Play.Plus.Radio.Reply.RotateCcw.RotateCw.Search.Send.Server.Settings.Shield.ShieldAlert.ShieldCheck.SkipForward.SlidersHorizontal.Smartphone.Smile.Sparkles.Square.SquarePen.Star.Sun.ThumbsDown.ThumbsUp.Timer.Trash.Trash2.Trophy.Upload.User.UserCheck.UserCog.UserMinus.UserPen.UserPlus.UserRoundPlus.Users.UserX.Utensils.Video.VideoOff.Volume.Volume2.VolumeX.X.Youtube.Zap`.split(`.`);
package/dist/vite.mjs CHANGED
@@ -143,6 +143,8 @@ function jchatAddon(options) {
143
143
  }
144
144
  const readmeSource = path.resolve(rootDir, "README.md");
145
145
  if (await Bun.file(readmeSource).exists()) await Bun.write(path.resolve(buildDir, "README.md"), Bun.file(readmeSource));
146
+ const vendorLicensesContent = await generateAddonVendorLicenses(rootDir, manifest.name);
147
+ await Bun.write(path.resolve(buildDir, "vendor-licenses.txt"), vendorLicensesContent);
146
148
  const manifestJson = JSON.stringify(manifest, null, 2);
147
149
  await Bun.write(path.resolve(buildDir, "manifest.json"), manifestJson);
148
150
  if (shouldZip) {
@@ -150,6 +152,7 @@ function jchatAddon(options) {
150
152
  const filesToZip = ["manifest.json", bundleFile];
151
153
  if (await Bun.file(path.resolve(buildDir, "api.js")).exists()) filesToZip.push("api.js");
152
154
  if (await Bun.file(path.resolve(buildDir, "README.md")).exists()) filesToZip.push("README.md");
155
+ if (await Bun.file(path.resolve(buildDir, "vendor-licenses.txt")).exists()) filesToZip.push("vendor-licenses.txt");
153
156
  const migrationsDest = path.resolve(buildDir, "migrations");
154
157
  if (fs.existsSync(migrationsDest)) filesToZip.push("migrations");
155
158
  const seedsDest = path.resolve(buildDir, "seeds");
@@ -280,5 +283,59 @@ function sortValue(child) {
280
283
  function stableStringify(value) {
281
284
  return JSON.stringify(sortValue(value));
282
285
  }
286
+ async function generateAddonVendorLicenses(addonDir, addonName) {
287
+ const title = addonName ? `${addonName} Addon` : "JChat Addon";
288
+ try {
289
+ const proc = Bun.spawn([
290
+ "bun",
291
+ "pm",
292
+ "licenses",
293
+ "--json",
294
+ "--prod"
295
+ ], {
296
+ cwd: addonDir,
297
+ stdout: "pipe",
298
+ stderr: "pipe"
299
+ });
300
+ const output = await new Response(proc.stdout).text();
301
+ await proc.exited;
302
+ const data = JSON.parse(output);
303
+ const lines = [
304
+ "================================================================================",
305
+ `${title} - Third-Party Vendor Licenses & Open Source Attribution`,
306
+ "================================================================================",
307
+ "This distribution incorporates open-source libraries and software components.",
308
+ "Their licenses and attributions are listed below.",
309
+ "================================================================================",
310
+ ""
311
+ ];
312
+ let totalPackages = 0;
313
+ const sortedCategories = Object.keys(data).toSorted((a, b) => a.localeCompare(b));
314
+ for (const licenseCategory of sortedCategories) {
315
+ const packages = data[licenseCategory];
316
+ if (!packages || packages.length === 0) continue;
317
+ lines.push(`\n## License: ${licenseCategory} (${packages.length} packages)\n`);
318
+ for (const pkg of packages) {
319
+ totalPackages++;
320
+ lines.push(`- Package: ${pkg.name}@${pkg.versions.join(", ")}`);
321
+ if (pkg.description) lines.push(` Description: ${pkg.description}`);
322
+ if (pkg.author) lines.push(` Author: ${pkg.author}`);
323
+ if (pkg.homepage) lines.push(` Homepage: ${pkg.homepage}`);
324
+ }
325
+ }
326
+ lines.splice(5, 0, `Total Open-Source Dependencies: ${totalPackages}\n`);
327
+ return lines.join("\n") + "\n";
328
+ } catch {
329
+ return [
330
+ "================================================================================",
331
+ `${title} - Third-Party Vendor Licenses & Open Source Attribution`,
332
+ "================================================================================",
333
+ "This distribution incorporates open-source libraries and software components.",
334
+ "See individual package.json files and dependencies for specific license details.",
335
+ "================================================================================",
336
+ ""
337
+ ].join("\n");
338
+ }
339
+ }
283
340
  //#endregion
284
341
  export { createAddonServerBuildArguments, jchatAddon, requireAddonSigningKey, signAddonManifest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jchat/addon-sdk",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "private": false,
5
5
  "description": "JChat Addon SDK for building JChat addons.",
6
6
  "keywords": [