Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clear-lions-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@proofkit/webviewer": patch
---

Document the `proofkit add addon webviewer` command in the WebViewer skill and setup docs.
5 changes: 5 additions & 0 deletions .changeset/fair-poems-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@proofkit/cli": patch
---

Fix `proofkit add addon` so it works outside an existing ProofKit project.
2 changes: 1 addition & 1 deletion apps/docs/content/docs/cli/webviewer/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Creating a ProofKit project for a FileMaker WebViewer is extremely similar to th

## Prep your FileMaker file

- Install the ProofKit WebViewer add-on into the file you want to target.
- Install the ProofKit WebViewer add-on into the file you want to target. If you already have a ProofKit project, run `proofkit add addon webviewer` to copy the local add-on files, then install the add-on into the FileMaker file.
- Make sure the file has the scripts needed by your WebViewer workflow, such as `Launch Web Viewer for Dev` and `UploadWebviewerWidget`.
- If you want local typegen without a hosted server, start the FM MCP bridge and keep a connected FileMaker file open.

Expand Down
6 changes: 4 additions & 2 deletions apps/docs/content/docs/webviewer/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ For web-based applications where you're looking to interact with the Data API us

We strongly recommend using the [ProofKit CLI](/docs/cli) to setup your project. It will also walk you through a FileMaker add-on that installs the neccesary layouts, scripts and custom functions to get you started.

If you already have a ProofKit WebViewer project and need to install or update the FileMaker add-on manually, run `proofkit add addon webviewer` from the project root. That copies the local add-on files; you still need to install the add-on into the FileMaker file.

<Accordions type="single">
<Accordion title="Manual Installation">

{" "}
<Callout type="warn">
This demo file is a very simplified example. To see more features, use the
[ProofKit CLI](/docs/cli) to build a new app and follow the instructions to
install the FileMaker addon.
[ProofKit CLI](/docs/cli) to build a new app or run `proofkit add addon webviewer`
in an existing ProofKit project, then install the FileMaker add-on.
</Callout>

Use your preferred package manager to install the package.
Expand Down
13 changes: 1 addition & 12 deletions packages/cli/src/cli/add/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { select } from "~/cli/prompts.js";
import { debugOption, nonInteractiveOption } from "~/globalOptions.js";
import { installFmAddonExplicitly } from "~/installers/install-fm-addon.js";
import { initProgramState, isNonInteractiveMode } from "~/state.js";
import { getSettings } from "~/utils/parseSettings.js";
import { abortIfCancel, ensureProofKitProject } from "../utils.js";
import { abortIfCancel } from "../utils.js";

type AddonTarget = "webviewer" | "auth";

Expand All @@ -29,18 +28,8 @@ async function resolveAddonTarget(name?: string): Promise<AddonTarget> {
}

export async function runAddAddonAction(targetName?: string) {
ensureProofKitProject({ commandName: "add addon" });
const settings = getSettings();
const target = await resolveAddonTarget(targetName);

if (target === "webviewer" && settings.appType !== "webviewer") {
throw new Error("The WebViewer add-on can only be added from a WebViewer ProofKit project.");
}

if (target === "auth" && settings.appType !== "browser") {
throw new Error("The auth add-on can only be added from a browser ProofKit project.");
}

await installFmAddonExplicitly({ addonName: target === "webviewer" ? "wv" : "auth" });
}

Expand Down
9 changes: 6 additions & 3 deletions packages/cli/src/installers/install-fm-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,16 @@ export async function inspectFmAddon(
export function getFmAddonInstallInstructions(addonName: FmAddonName) {
const addonDisplayName = getAddonDisplayName(addonName);
const installCommand = getAddonInstallCommand(addonName);
const removeOldStep = `If your FileMaker file already has an older ${addonDisplayName} add-on installed, remove that old add-on first`;

return {
addonDisplayName,
installCommand,
docsUrl: addonName === "auth" ? "https://proofkit.dev/auth/fm-addon" : "https://proofkit.dev/webviewer",
steps: [
`Run \`${installCommand}\` to install or update the local add-on files`,
"Restart FileMaker Pro (if it's currently running)",
"Restart FileMaker Pro so the new local add-on files appear",
removeOldStep,
`Open your FileMaker file, go to layout mode, and install the ${addonDisplayName} add-on to the file`,
],
};
Expand Down Expand Up @@ -256,8 +258,9 @@ export async function installFmAddonExplicitly({ addonName }: { addonName: FmAdd
);
}
const steps = [
"Restart FileMaker Pro (if it's currently running)",
`Open your FileMaker file, go to layout mode, and install the ${addonDisplayName} addon to the file`,
"Restart FileMaker Pro so the new local add-on files appear",
`If your FileMaker file already has an older ${addonDisplayName} add-on installed, remove that old add-on first`,
`Open your FileMaker file, go to layout mode, and install the ${addonDisplayName} add-on to the file`,
];
steps.forEach((step, index) => {
console.log(`${index + 1}. ${step}`);
Expand Down
7 changes: 0 additions & 7 deletions packages/cli/tests/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,6 @@ describe("proofkit CLI", () => {
it("supports `proofkit add addon webviewer`", async () => {
const cwd = await fs.mkdtemp(path.join(os.tmpdir(), "proofkit-new-cli-addon-project-"));
const addonModulesDir = await fs.mkdtemp(path.join(os.tmpdir(), "proofkit-new-cli-addon-modules-"));
await fs.writeJson(path.join(cwd, "proofkit.json"), {
appType: "webviewer",
ui: "shadcn",
dataSources: [],
replacedMainPage: false,
registryTemplates: [],
});

const result = spawnSync("node", [distEntry, "add", "addon", "webviewer", "--non-interactive"], {
cwd,
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/tests/install-fm-addon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import os from "node:os";
import path from "node:path";
import fs from "fs-extra";
import { describe, expect, it } from "vitest";
import { compareAddonVersions, inspectFmAddon } from "~/installers/install-fm-addon.js";
import { compareAddonVersions, getFmAddonInstallInstructions, inspectFmAddon } from "~/installers/install-fm-addon.js";
import { getWebViewerAddonMessages } from "~/installers/proofkit-webviewer.js";

async function writeAddonVersion(dir: string, version: string) {
Expand Down Expand Up @@ -112,3 +112,12 @@ describe("getWebViewerAddonMessages", () => {
expect(messages.nextSteps).toEqual(["proofkit add addon webviewer"]);
});
});

describe("getFmAddonInstallInstructions", () => {
it("includes restart and old add-on removal guidance", () => {
const instructions = getFmAddonInstallInstructions("wv");

expect(instructions.steps).toContain("Restart FileMaker Pro so the new local add-on files appear");
expect(instructions.steps.join("\n")).toContain("remove that old add-on first");
});
});
5 changes: 5 additions & 0 deletions packages/webviewer/skills/webviewer-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ sources:

## Setup

This package assumes the user has already added specific layouts, scripts, etc into their FileMaker file. This is accomplished using a FileMaker add-on, downloaded during the setup process if the project was created using @proofkit/cli, but the user must still manually install the add-on in their FileMaker file.
To download the latest version of the add-on to the user's computer, run `npx -y @proofkit/cli@beta add addon webviewer` in any directory.

Install the package and set the webviewer name before calling any scripts.



```ts
import { fmFetch, globalSettings } from "@proofkit/webviewer";

Expand Down
Loading