@foundrykit/hub-plugin 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ # @foundrykit/hub-plugin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Tells the Foundry Hub what a Payload 3 site is actually running. Each time the
4
+ site starts it sends one report: every `@foundrykit/*` package with its
5
+ installed version, the FoundryKit plugins switched on, the environment, the
6
+ site URL, the git commit, and the Payload and Next.js versions. The Hub shows it
7
+ on the site's page, per environment.
8
+
9
+ It never holds up or breaks boot: the request gives up after 3 seconds and
10
+ failures are logged as a warning.
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ pnpm add @foundrykit/hub-plugin
16
+ ```
17
+
18
+ ```ts
19
+ import { hubPlugin } from '@foundrykit/hub-plugin';
20
+
21
+ export default buildConfig({
22
+ plugins: [hubPlugin()],
23
+ });
24
+ ```
25
+
26
+ Create a key in **Hub › Admin › Projects › Site keys** and set the three lines it
27
+ gives you:
28
+
29
+ ```sh
30
+ FOUNDRY_HUB_URL=https://<hub>
31
+ FOUNDRY_HUB_KEY=fhk_…
32
+ FOUNDRY_ENV=production # or staging, …
33
+ ```
34
+
35
+ ## Options
36
+
37
+ | Option | Default | |
38
+ | ------------- | --------------------------------------------------- | ------------------------------------ |
39
+ | `hubUrl` | `FOUNDRY_HUB_URL` | The Hub's address. |
40
+ | `key` | `FOUNDRY_HUB_KEY` | This site's key. |
41
+ | `environment` | `FOUNDRY_ENV`, else `VERCEL_ENV`, else `production` | Which environment this is. |
42
+ | `enabled` | `true` | `false` leaves the config untouched. |
43
+
44
+ - No URL or key: logs one warning and does nothing.
45
+ - Vercel preview deploys don't report unless `FOUNDRY_ENV` is set, so a PR
46
+ branch can't overwrite production.
47
+ - `next build` doesn't report.
48
+ - The commit comes from `SOURCE_COMMIT` (Dokploy), `VERCEL_GIT_COMMIT_SHA` or
49
+ `GIT_COMMIT`.
50
+ - Installed versions are read from `node_modules`. If a package's
51
+ `package.json` isn't there (for example a pruned standalone build), the
52
+ declared range is sent instead and the Hub shows its status as unknown.
@@ -0,0 +1,10 @@
1
+ import type { Config } from 'payload';
2
+ /**
3
+ * Records this plugin as active in `config.custom.foundrykit.activePlugins`, the list
4
+ * `@foundrykit/guides-plugin` sends to the guides hub so the site gets this plugin's guides.
5
+ * Only call it on the enabled path: installed-but-disabled doesn't count.
6
+ *
7
+ * Every FoundryKit Payload plugin carries its own copy of this file (it's too small for a package);
8
+ * keep them identical.
9
+ */
10
+ export declare const recordActivePlugin: (config: Config, name: string) => Config;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Records this plugin as active in `config.custom.foundrykit.activePlugins`, the list
3
+ * `@foundrykit/guides-plugin` sends to the guides hub so the site gets this plugin's guides.
4
+ * Only call it on the enabled path: installed-but-disabled doesn't count.
5
+ *
6
+ * Every FoundryKit Payload plugin carries its own copy of this file (it's too small for a package);
7
+ * keep them identical.
8
+ */ export const recordActivePlugin = (config, name)=>{
9
+ const foundrykit = config.custom?.foundrykit ?? {};
10
+ return {
11
+ ...config,
12
+ custom: {
13
+ ...config.custom,
14
+ foundrykit: {
15
+ ...foundrykit,
16
+ activePlugins: [
17
+ ...new Set([
18
+ ...foundrykit.activePlugins ?? [],
19
+ name
20
+ ])
21
+ ]
22
+ }
23
+ }
24
+ };
25
+ };
26
+
27
+ //# sourceMappingURL=activePlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/activePlugins.ts"],"sourcesContent":["import type { Config } from 'payload';\n\n/**\n * Records this plugin as active in `config.custom.foundrykit.activePlugins`, the list\n * `@foundrykit/guides-plugin` sends to the guides hub so the site gets this plugin's guides.\n * Only call it on the enabled path: installed-but-disabled doesn't count.\n *\n * Every FoundryKit Payload plugin carries its own copy of this file (it's too small for a package);\n * keep them identical.\n */\nexport const recordActivePlugin = (config: Config, name: string): Config => {\n const foundrykit = (config.custom?.foundrykit ?? {}) as {\n activePlugins?: string[];\n };\n return {\n ...config,\n custom: {\n ...config.custom,\n foundrykit: {\n ...foundrykit,\n activePlugins: [\n ...new Set([...(foundrykit.activePlugins ?? []), name]),\n ],\n },\n },\n };\n};\n"],"names":["recordActivePlugin","config","name","foundrykit","custom","activePlugins","Set"],"mappings":"AAEA;;;;;;;CAOC,GACD,OAAO,MAAMA,qBAAqB,CAACC,QAAgBC;IACjD,MAAMC,aAAcF,OAAOG,MAAM,EAAED,cAAc,CAAC;IAGlD,OAAO;QACL,GAAGF,MAAM;QACTG,QAAQ;YACN,GAAGH,OAAOG,MAAM;YAChBD,YAAY;gBACV,GAAGA,UAAU;gBACbE,eAAe;uBACV,IAAIC,IAAI;2BAAKH,WAAWE,aAAa,IAAI,EAAE;wBAAGH;qBAAK;iBACvD;YACH;QACF;IACF;AACF,EAAE"}
@@ -0,0 +1,13 @@
1
+ import type { Config } from 'payload';
2
+ export type { SiteReport } from './report.js';
3
+ export type HubPluginConfig = {
4
+ /** The Hub's address. Default: FOUNDRY_HUB_URL. */
5
+ hubUrl?: string;
6
+ /** This site's key from Hub › Admin › Projects. Default: FOUNDRY_HUB_KEY. */
7
+ key?: string;
8
+ /** Default: FOUNDRY_ENV, else VERCEL_ENV, else production. */
9
+ environment?: string;
10
+ enabled?: boolean;
11
+ };
12
+ export declare const hubPlugin: (options?: HubPluginConfig) => (incoming: Config) => Config;
13
+ export default hubPlugin;
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ import { recordActivePlugin } from './activePlugins.js';
2
+ import { buildReport, resolveEnvironment, sendReport } from './report.js';
3
+ /** Reports what the site is running, once per start. Never holds up or breaks boot. */ async function report(payload, options) {
4
+ if (process.env.NEXT_PHASE === 'phase-production-build') return;
5
+ const hubUrl = options.hubUrl ?? process.env.FOUNDRY_HUB_URL;
6
+ const key = options.key ?? process.env.FOUNDRY_HUB_KEY;
7
+ if (!hubUrl || !key) {
8
+ payload.logger.warn('[hub-plugin] FOUNDRY_HUB_URL or FOUNDRY_HUB_KEY is not set, so this site is not reporting to the Foundry Hub.');
9
+ return;
10
+ }
11
+ const environment = resolveEnvironment(process.env, options.environment);
12
+ if (!environment) return;
13
+ const foundrykit = payload.config.custom?.foundrykit;
14
+ const ok = await sendReport(hubUrl, key, buildReport({
15
+ cwd: process.cwd(),
16
+ env: process.env,
17
+ environment,
18
+ serverURL: payload.config.serverURL,
19
+ activePlugins: foundrykit?.activePlugins ?? []
20
+ }));
21
+ if (!ok) payload.logger.warn(`[hub-plugin] Couldn't report to the Foundry Hub at ${hubUrl}.`);
22
+ }
23
+ export const hubPlugin = (options = {})=>(incoming)=>{
24
+ if (options.enabled === false) return incoming;
25
+ const config = recordActivePlugin(incoming, '@foundrykit/hub-plugin');
26
+ const previous = config.onInit;
27
+ return {
28
+ ...config,
29
+ onInit: async (payload)=>{
30
+ await previous?.(payload);
31
+ await report(payload, options);
32
+ }
33
+ };
34
+ };
35
+ export default hubPlugin;
36
+
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config, Payload } from 'payload';\nimport { recordActivePlugin } from './activePlugins.js';\nimport { buildReport, resolveEnvironment, sendReport } from './report.js';\n\nexport type { SiteReport } from './report.js';\n\nexport type HubPluginConfig = {\n /** The Hub's address. Default: FOUNDRY_HUB_URL. */\n hubUrl?: string;\n /** This site's key from Hub › Admin › Projects. Default: FOUNDRY_HUB_KEY. */\n key?: string;\n /** Default: FOUNDRY_ENV, else VERCEL_ENV, else production. */\n environment?: string;\n enabled?: boolean;\n};\n\n/** Reports what the site is running, once per start. Never holds up or breaks boot. */\nasync function report(payload: Payload, options: HubPluginConfig) {\n if (process.env.NEXT_PHASE === 'phase-production-build') return;\n const hubUrl = options.hubUrl ?? process.env.FOUNDRY_HUB_URL;\n const key = options.key ?? process.env.FOUNDRY_HUB_KEY;\n if (!hubUrl || !key) {\n payload.logger.warn(\n '[hub-plugin] FOUNDRY_HUB_URL or FOUNDRY_HUB_KEY is not set, so this site is not reporting to the Foundry Hub.'\n );\n return;\n }\n const environment = resolveEnvironment(process.env, options.environment);\n if (!environment) return;\n\n const foundrykit = payload.config.custom?.foundrykit as\n | { activePlugins?: string[] }\n | undefined;\n const ok = await sendReport(\n hubUrl,\n key,\n buildReport({\n cwd: process.cwd(),\n env: process.env,\n environment,\n serverURL: payload.config.serverURL,\n activePlugins: foundrykit?.activePlugins ?? [],\n })\n );\n if (!ok)\n payload.logger.warn(\n `[hub-plugin] Couldn't report to the Foundry Hub at ${hubUrl}.`\n );\n}\n\nexport const hubPlugin =\n (options: HubPluginConfig = {}) =>\n (incoming: Config): Config => {\n if (options.enabled === false) return incoming;\n const config = recordActivePlugin(incoming, '@foundrykit/hub-plugin');\n const previous = config.onInit;\n return {\n ...config,\n onInit: async payload => {\n await previous?.(payload);\n await report(payload, options);\n },\n };\n };\n\nexport default hubPlugin;\n"],"names":["recordActivePlugin","buildReport","resolveEnvironment","sendReport","report","payload","options","process","env","NEXT_PHASE","hubUrl","FOUNDRY_HUB_URL","key","FOUNDRY_HUB_KEY","logger","warn","environment","foundrykit","config","custom","ok","cwd","serverURL","activePlugins","hubPlugin","incoming","enabled","previous","onInit"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,UAAU,QAAQ,cAAc;AAc1E,qFAAqF,GACrF,eAAeC,OAAOC,OAAgB,EAAEC,OAAwB;IAC9D,IAAIC,QAAQC,GAAG,CAACC,UAAU,KAAK,0BAA0B;IACzD,MAAMC,SAASJ,QAAQI,MAAM,IAAIH,QAAQC,GAAG,CAACG,eAAe;IAC5D,MAAMC,MAAMN,QAAQM,GAAG,IAAIL,QAAQC,GAAG,CAACK,eAAe;IACtD,IAAI,CAACH,UAAU,CAACE,KAAK;QACnBP,QAAQS,MAAM,CAACC,IAAI,CACjB;QAEF;IACF;IACA,MAAMC,cAAcd,mBAAmBK,QAAQC,GAAG,EAAEF,QAAQU,WAAW;IACvE,IAAI,CAACA,aAAa;IAElB,MAAMC,aAAaZ,QAAQa,MAAM,CAACC,MAAM,EAAEF;IAG1C,MAAMG,KAAK,MAAMjB,WACfO,QACAE,KACAX,YAAY;QACVoB,KAAKd,QAAQc,GAAG;QAChBb,KAAKD,QAAQC,GAAG;QAChBQ;QACAM,WAAWjB,QAAQa,MAAM,CAACI,SAAS;QACnCC,eAAeN,YAAYM,iBAAiB,EAAE;IAChD;IAEF,IAAI,CAACH,IACHf,QAAQS,MAAM,CAACC,IAAI,CACjB,CAAC,mDAAmD,EAAEL,OAAO,CAAC,CAAC;AAErE;AAEA,OAAO,MAAMc,YACX,CAAClB,UAA2B,CAAC,CAAC,GAC9B,CAACmB;QACC,IAAInB,QAAQoB,OAAO,KAAK,OAAO,OAAOD;QACtC,MAAMP,SAASlB,mBAAmByB,UAAU;QAC5C,MAAME,WAAWT,OAAOU,MAAM;QAC9B,OAAO;YACL,GAAGV,MAAM;YACTU,QAAQ,OAAMvB;gBACZ,MAAMsB,WAAWtB;gBACjB,MAAMD,OAAOC,SAASC;YACxB;QACF;IACF,EAAE;AAEJ,eAAekB,UAAU"}
@@ -0,0 +1,33 @@
1
+ /** What the Hub accepts at /api/sites/report. Keep in step with apps/hub/src/lib/site-report.ts. */
2
+ export type SiteReport = {
3
+ environment: string;
4
+ url: string | null;
5
+ commit: string | null;
6
+ payloadVersion: string | null;
7
+ nextVersion: string | null;
8
+ activePlugins: string[];
9
+ packages: {
10
+ name: string;
11
+ version: string;
12
+ resolved: boolean;
13
+ }[];
14
+ };
15
+ /**
16
+ * The environment to report as, or null to stay quiet. A Vercel preview only
17
+ * reports when FOUNDRY_ENV names it, so a PR branch can't overwrite production.
18
+ */
19
+ export declare function resolveEnvironment(env: NodeJS.ProcessEnv, option?: string): string | null;
20
+ /**
21
+ * The installed version, read straight from node_modules: `require.resolve`
22
+ * can't reach package.json when a package's `exports` doesn't list it.
23
+ */
24
+ export declare function readInstalled(cwd: string, name: string): string | null;
25
+ export declare function buildReport(input: {
26
+ cwd: string;
27
+ env: NodeJS.ProcessEnv;
28
+ environment: string;
29
+ serverURL?: string;
30
+ activePlugins: string[];
31
+ }): SiteReport;
32
+ /** Sends the report. Never throws and never waits more than 3 seconds. */
33
+ export declare function sendReport(url: string, key: string, report: SiteReport, fetchImpl?: (url: string, init?: RequestInit) => Promise<Response>): Promise<boolean>;
package/dist/report.js ADDED
@@ -0,0 +1,75 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ /**
4
+ * The environment to report as, or null to stay quiet. A Vercel preview only
5
+ * reports when FOUNDRY_ENV names it, so a PR branch can't overwrite production.
6
+ */ export function resolveEnvironment(env, option) {
7
+ const named = option ?? env.FOUNDRY_ENV;
8
+ if (named) return named.trim().toLowerCase();
9
+ if (env.VERCEL_ENV === 'preview') return null;
10
+ return (env.VERCEL_ENV ?? 'production').toLowerCase();
11
+ }
12
+ const readJson = (path)=>JSON.parse(readFileSync(path, 'utf8'));
13
+ /**
14
+ * The installed version, read straight from node_modules: `require.resolve`
15
+ * can't reach package.json when a package's `exports` doesn't list it.
16
+ */ export function readInstalled(cwd, name) {
17
+ try {
18
+ const { version } = readJson(join(cwd, 'node_modules', name, 'package.json'));
19
+ return typeof version === 'string' ? version : null;
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ export function buildReport(input) {
25
+ const { cwd, env } = input;
26
+ let declared = {};
27
+ try {
28
+ const pkg = readJson(join(cwd, 'package.json'));
29
+ declared = {
30
+ ...pkg.devDependencies,
31
+ ...pkg.dependencies
32
+ };
33
+ } catch {
34
+ // No package.json where we expected it: report no packages rather than fail.
35
+ }
36
+ const packages = Object.entries(declared).filter(([name])=>name.startsWith('@foundrykit/')).sort(([a], [b])=>a.localeCompare(b)).map(([name, specifier])=>{
37
+ const installed = readInstalled(cwd, name);
38
+ return installed ? {
39
+ name,
40
+ version: installed,
41
+ resolved: true
42
+ } : {
43
+ name,
44
+ version: specifier,
45
+ resolved: false
46
+ };
47
+ });
48
+ return {
49
+ environment: input.environment,
50
+ url: input.serverURL || null,
51
+ commit: env.SOURCE_COMMIT || env.VERCEL_GIT_COMMIT_SHA || env.GIT_COMMIT || null,
52
+ payloadVersion: readInstalled(cwd, 'payload'),
53
+ nextVersion: readInstalled(cwd, 'next'),
54
+ activePlugins: input.activePlugins,
55
+ packages
56
+ };
57
+ }
58
+ /** Sends the report. Never throws and never waits more than 3 seconds. */ export async function sendReport(url, key, report, fetchImpl = fetch) {
59
+ try {
60
+ const res = await fetchImpl(`${url.replace(/\/$/, '')}/api/sites/report`, {
61
+ method: 'POST',
62
+ headers: {
63
+ authorization: `Bearer ${key}`,
64
+ 'content-type': 'application/json'
65
+ },
66
+ body: JSON.stringify(report),
67
+ signal: AbortSignal.timeout(3000)
68
+ });
69
+ return res.ok;
70
+ } catch {
71
+ return false;
72
+ }
73
+ }
74
+
75
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/report.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/** What the Hub accepts at /api/sites/report. Keep in step with apps/hub/src/lib/site-report.ts. */\nexport type SiteReport = {\n environment: string;\n url: string | null;\n commit: string | null;\n payloadVersion: string | null;\n nextVersion: string | null;\n activePlugins: string[];\n packages: { name: string; version: string; resolved: boolean }[];\n};\n\n/**\n * The environment to report as, or null to stay quiet. A Vercel preview only\n * reports when FOUNDRY_ENV names it, so a PR branch can't overwrite production.\n */\nexport function resolveEnvironment(\n env: NodeJS.ProcessEnv,\n option?: string\n): string | null {\n const named = option ?? env.FOUNDRY_ENV;\n if (named) return named.trim().toLowerCase();\n if (env.VERCEL_ENV === 'preview') return null;\n return (env.VERCEL_ENV ?? 'production').toLowerCase();\n}\n\nconst readJson = (path: string) =>\n JSON.parse(readFileSync(path, 'utf8')) as Record<string, unknown>;\n\n/**\n * The installed version, read straight from node_modules: `require.resolve`\n * can't reach package.json when a package's `exports` doesn't list it.\n */\nexport function readInstalled(cwd: string, name: string): string | null {\n try {\n const { version } = readJson(\n join(cwd, 'node_modules', name, 'package.json')\n );\n return typeof version === 'string' ? version : null;\n } catch {\n return null;\n }\n}\n\nexport function buildReport(input: {\n cwd: string;\n env: NodeJS.ProcessEnv;\n environment: string;\n serverURL?: string;\n activePlugins: string[];\n}): SiteReport {\n const { cwd, env } = input;\n let declared: Record<string, string> = {};\n try {\n const pkg = readJson(join(cwd, 'package.json')) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n declared = { ...pkg.devDependencies, ...pkg.dependencies };\n } catch {\n // No package.json where we expected it: report no packages rather than fail.\n }\n const packages = Object.entries(declared)\n .filter(([name]) => name.startsWith('@foundrykit/'))\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([name, specifier]) => {\n const installed = readInstalled(cwd, name);\n return installed\n ? { name, version: installed, resolved: true }\n : { name, version: specifier, resolved: false };\n });\n\n return {\n environment: input.environment,\n url: input.serverURL || null,\n commit:\n env.SOURCE_COMMIT || env.VERCEL_GIT_COMMIT_SHA || env.GIT_COMMIT || null,\n payloadVersion: readInstalled(cwd, 'payload'),\n nextVersion: readInstalled(cwd, 'next'),\n activePlugins: input.activePlugins,\n packages,\n };\n}\n\n/** Sends the report. Never throws and never waits more than 3 seconds. */\nexport async function sendReport(\n url: string,\n key: string,\n report: SiteReport,\n fetchImpl: (url: string, init?: RequestInit) => Promise<Response> = fetch\n): Promise<boolean> {\n try {\n const res = await fetchImpl(`${url.replace(/\\/$/, '')}/api/sites/report`, {\n method: 'POST',\n headers: {\n authorization: `Bearer ${key}`,\n 'content-type': 'application/json',\n },\n body: JSON.stringify(report),\n signal: AbortSignal.timeout(3000),\n });\n return res.ok;\n } catch {\n return false;\n }\n}\n"],"names":["readFileSync","join","resolveEnvironment","env","option","named","FOUNDRY_ENV","trim","toLowerCase","VERCEL_ENV","readJson","path","JSON","parse","readInstalled","cwd","name","version","buildReport","input","declared","pkg","devDependencies","dependencies","packages","Object","entries","filter","startsWith","sort","a","b","localeCompare","map","specifier","installed","resolved","environment","url","serverURL","commit","SOURCE_COMMIT","VERCEL_GIT_COMMIT_SHA","GIT_COMMIT","payloadVersion","nextVersion","activePlugins","sendReport","key","report","fetchImpl","fetch","res","replace","method","headers","authorization","body","stringify","signal","AbortSignal","timeout","ok"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,SAASC,IAAI,QAAQ,YAAY;AAajC;;;CAGC,GACD,OAAO,SAASC,mBACdC,GAAsB,EACtBC,MAAe;IAEf,MAAMC,QAAQD,UAAUD,IAAIG,WAAW;IACvC,IAAID,OAAO,OAAOA,MAAME,IAAI,GAAGC,WAAW;IAC1C,IAAIL,IAAIM,UAAU,KAAK,WAAW,OAAO;IACzC,OAAO,AAACN,CAAAA,IAAIM,UAAU,IAAI,YAAW,EAAGD,WAAW;AACrD;AAEA,MAAME,WAAW,CAACC,OAChBC,KAAKC,KAAK,CAACb,aAAaW,MAAM;AAEhC;;;CAGC,GACD,OAAO,SAASG,cAAcC,GAAW,EAAEC,IAAY;IACrD,IAAI;QACF,MAAM,EAAEC,OAAO,EAAE,GAAGP,SAClBT,KAAKc,KAAK,gBAAgBC,MAAM;QAElC,OAAO,OAAOC,YAAY,WAAWA,UAAU;IACjD,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA,OAAO,SAASC,YAAYC,KAM3B;IACC,MAAM,EAAEJ,GAAG,EAAEZ,GAAG,EAAE,GAAGgB;IACrB,IAAIC,WAAmC,CAAC;IACxC,IAAI;QACF,MAAMC,MAAMX,SAAST,KAAKc,KAAK;QAI/BK,WAAW;YAAE,GAAGC,IAAIC,eAAe;YAAE,GAAGD,IAAIE,YAAY;QAAC;IAC3D,EAAE,OAAM;IACN,6EAA6E;IAC/E;IACA,MAAMC,WAAWC,OAAOC,OAAO,CAACN,UAC7BO,MAAM,CAAC,CAAC,CAACX,KAAK,GAAKA,KAAKY,UAAU,CAAC,iBACnCC,IAAI,CAAC,CAAC,CAACC,EAAE,EAAE,CAACC,EAAE,GAAKD,EAAEE,aAAa,CAACD,IACnCE,GAAG,CAAC,CAAC,CAACjB,MAAMkB,UAAU;QACrB,MAAMC,YAAYrB,cAAcC,KAAKC;QACrC,OAAOmB,YACH;YAAEnB;YAAMC,SAASkB;YAAWC,UAAU;QAAK,IAC3C;YAAEpB;YAAMC,SAASiB;YAAWE,UAAU;QAAM;IAClD;IAEF,OAAO;QACLC,aAAalB,MAAMkB,WAAW;QAC9BC,KAAKnB,MAAMoB,SAAS,IAAI;QACxBC,QACErC,IAAIsC,aAAa,IAAItC,IAAIuC,qBAAqB,IAAIvC,IAAIwC,UAAU,IAAI;QACtEC,gBAAgB9B,cAAcC,KAAK;QACnC8B,aAAa/B,cAAcC,KAAK;QAChC+B,eAAe3B,MAAM2B,aAAa;QAClCtB;IACF;AACF;AAEA,wEAAwE,GACxE,OAAO,eAAeuB,WACpBT,GAAW,EACXU,GAAW,EACXC,MAAkB,EAClBC,YAAoEC,KAAK;IAEzE,IAAI;QACF,MAAMC,MAAM,MAAMF,UAAU,GAAGZ,IAAIe,OAAO,CAAC,OAAO,IAAI,iBAAiB,CAAC,EAAE;YACxEC,QAAQ;YACRC,SAAS;gBACPC,eAAe,CAAC,OAAO,EAAER,KAAK;gBAC9B,gBAAgB;YAClB;YACAS,MAAM7C,KAAK8C,SAAS,CAACT;YACrBU,QAAQC,YAAYC,OAAO,CAAC;QAC9B;QACA,OAAOT,IAAIU,EAAE;IACf,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@foundrykit/hub-plugin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Reports the FoundryKit versions a Payload 3 site is actually running to the Foundry Hub, once each time the site starts.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "author": {
8
+ "name": "Isaac SJ",
9
+ "email": "isaac@umidigital.co.uk"
10
+ },
11
+ "keywords": [
12
+ "payload",
13
+ "payloadcms",
14
+ "plugin",
15
+ "foundry"
16
+ ],
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ }
23
+ },
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "devDependencies": {
30
+ "@swc/cli": "0.6.0",
31
+ "@types/node": "22.19.9",
32
+ "payload": "3.84.1",
33
+ "rimraf": "3.0.2",
34
+ "typescript": "5.9.2",
35
+ "vitest": "4.1.10"
36
+ },
37
+ "peerDependencies": {
38
+ "payload": "^3.37.0"
39
+ },
40
+ "engines": {
41
+ "node": ">=20.9.0"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/umi-labs/foundry.git",
49
+ "directory": "packages/payload/hub-plugin"
50
+ },
51
+ "homepage": "https://github.com/umi-labs/foundry/tree/prod/packages/payload/hub-plugin#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/umi-labs/foundry/issues"
54
+ },
55
+ "scripts": {
56
+ "build": "pnpm build:types && pnpm build:swc",
57
+ "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths --ignore \"**/*.test.ts\" --ignore \"**/*.d.ts\"",
58
+ "build:types": "tsc --outDir dist --rootDir ./src",
59
+ "clean": "rimraf {dist,*.tsbuildinfo}",
60
+ "verify:pack": "node scripts/verify-pack.mjs",
61
+ "test": "pnpm test:unit",
62
+ "test:unit": "vitest run src"
63
+ }
6
64
  }