@entrinsik/vite-plugin-informer 2.5.0-beta.0 → 2.6.0-beta.0

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/bin/publish.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { readFile, access } from 'node:fs/promises';
3
+ import { readFile, access, readdir } from 'node:fs/promises';
4
4
  import { resolve, join } from 'node:path';
5
5
  import { collectAppFiles } from '../src/assemble.js';
6
6
  import { extractNotes } from '../src/changelog.js';
@@ -64,9 +64,10 @@ try {
64
64
  }
65
65
 
66
66
  const icon = await resolveIcon(projectRoot, inf.icon);
67
+ const screenshots = await resolveScreenshots(projectRoot, inf.screenshots);
67
68
  const channel = version.includes('-') ? 'beta' : 'stable';
68
69
 
69
- console.log(`Publishing ${name} v${version} (${channel}) — ${files.length} files${changeNotes ? '' : ' — no release notes found'}`);
70
+ console.log(`Publishing ${name} v${version} (${channel}) — ${files.length} files${screenshots.length ? `, ${screenshots.length} screenshot${screenshots.length === 1 ? '' : 's'}` : ''}${changeNotes ? '' : ' — no release notes found'}`);
70
71
 
71
72
  try {
72
73
  const result = await publish({
@@ -74,6 +75,7 @@ try {
74
75
  token,
75
76
  files,
76
77
  icon,
78
+ screenshots,
77
79
  fields: {
78
80
  name,
79
81
  slug,
@@ -126,3 +128,20 @@ async function resolveIcon(root, configured) {
126
128
  }
127
129
  return undefined;
128
130
  }
131
+
132
+ // Collect listing screenshots from a `screenshots/` directory (override via
133
+ // package.json informer.screenshots), ordered by filename. Returns
134
+ // [{abs, filename}] for the publisher to upload; empty when none exist.
135
+ async function resolveScreenshots(root, configuredDir) {
136
+ const dir = resolve(root, configuredDir || 'screenshots');
137
+ let names;
138
+ try {
139
+ names = await readdir(dir);
140
+ } catch {
141
+ return []; // no screenshots directory — nothing to upload
142
+ }
143
+ return names
144
+ .filter(n => /\.(png|jpe?g|webp|gif)$/i.test(n))
145
+ .sort((a, b) => a.localeCompare(b, undefined, { numeric: true }))
146
+ .map(n => ({ abs: join(dir, n), filename: n }));
147
+ }
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "@entrinsik/vite-plugin-informer",
3
- "version": "2.5.0-beta.0",
3
+ "version": "2.6.0-beta.0",
4
4
  "description": "Vite plugin and deploy tool for Informer App development",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/entrinsik-org/i5.git",
8
8
  "directory": "packages/vite-plugin-informer"
9
9
  },
10
- "publishConfig": {
11
- "registry": "https://docker.entrinsik.com/repository/entNPM/"
12
- },
13
10
  "author": "Entrinsik Inc.",
14
11
  "license": "UNLICENSED",
15
12
  "type": "module",
package/src/publish.js CHANGED
@@ -58,7 +58,7 @@ async function buildArchive(files) {
58
58
  * @param {{abs: string, filename: string}} [opts.icon] - optional listing icon
59
59
  * @returns {Promise<Object>} the publish response
60
60
  */
61
- export async function publish({ marketplaceUrl, token, files, fields, icon }) {
61
+ export async function publish({ marketplaceUrl, token, files, fields, icon, screenshots = [] }) {
62
62
  const archive = await buildArchive(files);
63
63
 
64
64
  const form = new FormData();
@@ -75,6 +75,12 @@ export async function publish({ marketplaceUrl, token, files, fields, icon }) {
75
75
  const iconBuffer = await readFile(icon.abs);
76
76
  form.append('icon', new Blob([iconBuffer]), icon.filename);
77
77
  }
78
+ // Listing screenshots — appended in order; the server records sortOrder by
79
+ // the order parts arrive.
80
+ for (const shot of screenshots) {
81
+ const buffer = await readFile(shot.abs);
82
+ form.append('screenshots', new Blob([buffer]), shot.filename);
83
+ }
78
84
 
79
85
  const url = `${marketplaceUrl.replace(/\/+$/, '')}/packs/publish`;
80
86
  const res = await fetch(url, {