@stacksjs/buddy 0.70.63 → 0.70.65

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.
@@ -0,0 +1,8 @@
1
+ import type { CLI } from '@stacksjs/types';
2
+ /**
3
+ * `buddy extension:*` — build & package MV3 browser extensions from the
4
+ * project's `config/extension.ts` (see @stacksjs/browser-extension). Zero
5
+ * per-project build scripts: the framework owns the manifest, bundling, and
6
+ * packaging.
7
+ */
8
+ export declare function extension(buddy: CLI): void;
@@ -0,0 +1,30 @@
1
+ import process from "node:process";
2
+ import { log } from "@stacksjs/cli";
3
+ export function extension(buddy) {
4
+ const load = async () => {
5
+ const { loadExtensionConfig } = await import("@stacksjs/browser-extension"), config = await loadExtensionConfig(process.cwd());
6
+ if (!config) {
7
+ log.error("No extension config found. Create `config/extension.ts` exporting `defineExtension({ \u2026 })`.");
8
+ process.exit(1);
9
+ }
10
+ const pkg = await Bun.file(`${process.cwd()}/package.json`).json().catch(() => ({}));
11
+ return { config, version: pkg.version ?? "0.0.0" };
12
+ };
13
+ buddy.command("extension:build", "Build the browser extension (Chrome + Firefox) from config/extension.ts").option("--target <target>", "Build a single target (chrome | firefox); omit to build all").option("--version <version>", "Override the extension version (defaults to package.json)").action(async (options) => {
14
+ const { buildExtension, buildAllTargets } = await import("@stacksjs/browser-extension"), { config, version } = await load(), v = options.version ?? version;
15
+ if (options.target) {
16
+ const { outdir } = await buildExtension(config, { target: options.target, version: v });
17
+ log.success(`Built ${config.name} ${v} (${options.target}) \u2192 ${outdir}`);
18
+ } else {
19
+ await buildAllTargets(config, { version: v });
20
+ log.success(`Built ${config.name} ${v} for ${(config.targets ?? ["chrome", "firefox"]).join(", ")}`);
21
+ }
22
+ });
23
+ buddy.command("extension:package", "Build + zip the browser extension into store-ready archives").option("--target <target>", "Package a single target (chrome | firefox); omit to package all").option("--version <version>", "Override the extension version (defaults to package.json)").action(async (options) => {
24
+ const { packageExtension } = await import("@stacksjs/browser-extension"), { config, version } = await load(), v = options.version ?? version, targets = options.target ? [options.target] : config.targets ?? ["chrome", "firefox"];
25
+ for (const target of targets) {
26
+ const out = await packageExtension(config, { target, version: v });
27
+ log.success(`Packaged ${config.name} (${target}) \u2192 ${out}`);
28
+ }
29
+ });
30
+ }
@@ -19,6 +19,8 @@ const commandRegistry = {
19
19
  domains: { path: "./commands/domains.js", exportName: "domains" },
20
20
  email: { path: "./commands/email.js", exportName: "email" },
21
21
  env: { path: "./commands/env.js", exportName: "env" },
22
+ "extension:build": { path: "./commands/extension.js", exportName: "extension" },
23
+ "extension:package": { path: "./commands/extension.js", exportName: "extension" },
22
24
  "dashboard:install": { path: "./commands/features.js", exportName: "features" },
23
25
  "dashboard:uninstall": { path: "./commands/features.js", exportName: "features" },
24
26
  "commerce:install": { path: "./commands/features.js", exportName: "features" },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
- "version": "0.70.63",
4
+ "version": "0.70.65",
5
5
  "description": "Meet Buddy. The Stacks runtime.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [