@protobase/cli 0.45.7 → 0.45.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/dist/cli/package.js +1 -1
- package/dist/mobile/app-plugins-hook.js +16 -0
- package/dist/mobile/package.js +1 -1
- package/dist/mobile/pinned-packages.js +1 -1
- package/dist/mobile/protobase-plugin.js +11 -4
- package/dist/mobile/workspace.js +3 -1
- package/package.json +6 -6
- package/skills/protobase/references/guides/first-plugin.md +1 -1
- package/skills/protobase/references/reference/client.md +1 -1
- package/skills/protobase/references/reference/plugins.md +1 -1
package/dist/cli/package.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/mobile/app-plugins-hook.ts
|
|
2
|
+
/** The Capacitor hooks, scripts in the workspace's package.json, run after `cap copy` and `cap update`; `add` and `sync` run both. */
|
|
3
|
+
const appPluginsHooks = ["capacitor:copy:after", "capacitor:update:after"];
|
|
4
|
+
/** Where each platform's native project keeps the app's files, as Capacitor copies them from the web part. */
|
|
5
|
+
const nativeWebDirs = {
|
|
6
|
+
ios: "ios/App/App/public",
|
|
7
|
+
android: "android/app/src/main/assets/public"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The hook's command: copies the web part's `plugins/`, the app's own UI plugins, back into the platform's files.
|
|
11
|
+
* Capacitor keeps `plugins/` for Cordova plugins and removes it on every copy and update, so without this the app finds
|
|
12
|
+
* no plugin.json at `/plugins/<name>/` and turns its plugins off. Single quotes only, for any shell npm scripts run in.
|
|
13
|
+
*/
|
|
14
|
+
const appPluginsCommand = `node -e "const fs=require('fs');const to={${Object.entries(nativeWebDirs).map(([platform, dir]) => `${platform}:'${dir}'`).join(",")}}[process.env.CAPACITOR_PLATFORM_NAME];if(to&&fs.existsSync('web/plugins'))fs.cpSync('web/plugins',to+'/plugins',{recursive:true})"`;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { appPluginsCommand, appPluginsHooks, nativeWebDirs };
|
package/dist/mobile/package.js
CHANGED
|
@@ -13,7 +13,7 @@ const nativeDependencies = Object.fromEntries(Object.entries(dependencies).filte
|
|
|
13
13
|
* The native code an app's binary carries from @protobase/mobile, name → version, which a native fingerprint names:
|
|
14
14
|
* the native packages it pins, at their versions, and its own native code by its `nativeContract`, `native-<n>`. Never
|
|
15
15
|
* its npm version, which is Protobase's: every Protobase release would cut the binaries off updates. Raise
|
|
16
|
-
* `nativeContract` whenever its Android
|
|
16
|
+
* `nativeContract` whenever its Android or iOS sources change; its test fails until it is.
|
|
17
17
|
*/
|
|
18
18
|
const pinnedNative = {
|
|
19
19
|
...nativeDependencies,
|
|
@@ -42,10 +42,17 @@ const checkProtobasePlugin = async (ws) => {
|
|
|
42
42
|
if (missing.length === 0) return;
|
|
43
43
|
throw new Error(`The Android app lacks Protobase's native plugin (${missing.join(", ")}): delete ${ws} and run the command again`);
|
|
44
44
|
};
|
|
45
|
-
/**
|
|
45
|
+
/** The class of Protobase's iOS plugin, which gives the page back the bounce Capacitor turns off. */
|
|
46
|
+
const protobaseIosPlugin = "ProtobaseBounce";
|
|
47
|
+
/**
|
|
48
|
+
* Checks the class list `cap add ios` writes: it refuses the live updater, which has no guard on iOS yet, and an app
|
|
49
|
+
* without Protobase's iOS plugin, as a workspace left from an earlier CLI may build.
|
|
50
|
+
*/
|
|
46
51
|
const checkIosPlugins = async (ws) => {
|
|
47
|
-
|
|
48
|
-
throw new Error("The iOS app lists LiveUpdatePlugin, which has no guard against page script on iOS yet");
|
|
52
|
+
const classes = JSON.parse(await readFile(path.join(ws, "ios", "App", "App", "capacitor.config.json"), "utf8")).packageClassList ?? [];
|
|
53
|
+
if (classes.includes("LiveUpdatePlugin")) throw new Error("The iOS app lists LiveUpdatePlugin, which has no guard against page script on iOS yet");
|
|
54
|
+
if (classes.includes("ProtobaseBounce")) return;
|
|
55
|
+
throw new Error(`The iOS app lacks Protobase's native plugin (${protobaseIosPlugin}): delete ${ws} and run the command again`);
|
|
49
56
|
};
|
|
50
57
|
//#endregion
|
|
51
|
-
export { checkIosPlugins, checkProtobasePlugin, guardLiveUpdate, protobasePluginClasses };
|
|
58
|
+
export { checkIosPlugins, checkProtobasePlugin, guardLiveUpdate, protobaseIosPlugin, protobasePluginClasses };
|
package/dist/mobile/workspace.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { protobaseVersion } from "../version/version.js";
|
|
2
2
|
import { protobaseFolder } from "../project/protobase-folder.js";
|
|
3
3
|
import { packageNameProblem } from "./package-name.js";
|
|
4
|
+
import { appPluginsCommand, appPluginsHooks } from "./app-plugins-hook.js";
|
|
4
5
|
import { isLocalSpec } from "./local-spec.js";
|
|
5
6
|
import { checkLocalPins, isUnmet, localPins } from "./local-pins.js";
|
|
6
7
|
import { existsSync } from "node:fs";
|
|
@@ -13,9 +14,10 @@ const workspaceDir = (projectDir) => path.join(projectDir, protobaseFolder, "mob
|
|
|
13
14
|
const fromSource = path.extname(import.meta.url) === ".ts";
|
|
14
15
|
/** The @protobase/mobile to install: the CLI's own version, or this repository's package when the CLI runs from source. */
|
|
15
16
|
const mobileSpec = (source = fromSource) => source ? `file:${fileURLToPath(new URL("../../../mobile", import.meta.url))}` : protobaseVersion;
|
|
16
|
-
/** The workspace's package.json: @protobase/mobile
|
|
17
|
+
/** The workspace's package.json: @protobase/mobile, the project's extra plugins and the hooks that keep the app's UI plugins. */
|
|
17
18
|
const workspacePackageJson = ({ mobileSpec, plugins = {} }) => ({
|
|
18
19
|
private: true,
|
|
20
|
+
scripts: Object.fromEntries(appPluginsHooks.map((hook) => [hook, appPluginsCommand])),
|
|
19
21
|
dependencies: {
|
|
20
22
|
"@protobase/mobile": mobileSpec,
|
|
21
23
|
...plugins
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.9",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@better-auth/core": "^1.7.12",
|
|
37
37
|
"@hono/node-server": "^2.1.3",
|
|
38
38
|
"@hono/vite-dev-server": "^0.26.1",
|
|
39
|
-
"@protobase/layout": "0.45.
|
|
40
|
-
"@protobase/query": "0.45.
|
|
41
|
-
"@protobase/schema": "0.45.
|
|
42
|
-
"@protobase/server": "0.45.
|
|
43
|
-
"@protobase/ui": "0.45.
|
|
39
|
+
"@protobase/layout": "0.45.9",
|
|
40
|
+
"@protobase/query": "0.45.9",
|
|
41
|
+
"@protobase/schema": "0.45.9",
|
|
42
|
+
"@protobase/server": "0.45.9",
|
|
43
|
+
"@protobase/ui": "0.45.9",
|
|
44
44
|
"@react-email/render": "^2.1.0",
|
|
45
45
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
46
46
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -163,4 +163,4 @@ Put `dist/` on a static host, and list its `plugin.json` in the deployed app's `
|
|
|
163
163
|
|
|
164
164
|
The app updates to a new release of Protobase. Nothing happens to the plugin: within plugin API 1, every release keeps what the plugin imports, and the plugin runs on the newer `@protobase/ui` it is handed, its fixes included.
|
|
165
165
|
|
|
166
|
-
If the app were older than the plugin needs, it would not load the plugin at all. Its admins would see a notice
|
|
166
|
+
If the app were older than the plugin needs, it would not load the plugin at all. Its admins would see a notice below the top bar, such as "The plugin sales-tools is off: it needs Protobase >=0.12.0, and this app runs 0.11.1.", and the card would show a warning in place of the drafts, while the rest of the app works as before. [Versions](../reference/plugins.md#versions) has the rules.
|
|
@@ -23,7 +23,7 @@ With an absolute `baseUrl`, such as another app's `https://desk.example.com/api/
|
|
|
23
23
|
|
|
24
24
|
## The admin app
|
|
25
25
|
|
|
26
|
-
`<App baseUrl="/api/v1" />` renders the shell from `/api/meta` (beside the API, so `createClient` derives it from `baseUrl`) and routes `/:page` ([composed pages](layouts.md)), `/:resource` (list) and `/:resource/:key` (record); it opens on the first page, or the first resource. Its own pages sit under `/-/`, which no page or resource name takes: `/-/account` (the user's passkeys and two-factor authentication) and `/-/sign-in-policy` (admins: the policy, and the log of staff sign-ins). Before the shell, it signs in on its sign-in route, `/-/sign-in`, with the methods the server offers and asks for what the [sign-in policy](auth.md#sign-in-policy) requires. Someone signed out goes there from any page, with that page in `?next=`, and signing in comes back to it; each step (a forgotten password, an emailed code, making an account) adds `?step=`, so the browser's Back returns to the step before; `?staff-sign-in` opens the [staff sign-in](auth.md#staff-sign-in) page instead, and a staff session gets a banner
|
|
26
|
+
`<App baseUrl="/api/v1" />` renders the shell from `/api/meta` (beside the API, so `createClient` derives it from `baseUrl`) and routes `/:page` ([composed pages](layouts.md)), `/:resource` (list) and `/:resource/:key` (record); it opens on the first page, or the first resource. Its own pages sit under `/-/`, which no page or resource name takes: `/-/account` (the user's passkeys and two-factor authentication) and `/-/sign-in-policy` (admins: the policy, and the log of staff sign-ins). Before the shell, it signs in on its sign-in route, `/-/sign-in`, with the methods the server offers and asks for what the [sign-in policy](auth.md#sign-in-policy) requires. Someone signed out goes there from any page, with that page in `?next=`, and signing in comes back to it; each step (a forgotten password, an emailed code, making an account) adds `?step=`, so the browser's Back returns to the step before; `?staff-sign-in` opens the [staff sign-in](auth.md#staff-sign-in) page instead, and a staff session gets a banner below the top bar. `createAuthSession` from `@protobase/client` is that session (`signIn`, `signInWithCode`, `signInWithPasskey`, `verifyTwoFactor`, `account`, `signInPolicy`, `staff`). `ui` takes the project's [custom components and action handlers](custom-components.md). The list state lives in the URL: `?list=`, a [named list](ui-config.md#more-than-one-list), `?filter=` (AIP-160), `?order_by=`, `?display=`, the [display](ui-config.md#list-displays) it shows, `?layout=panel`, the filters in a panel beside the table on a desktop instead of a bar above it, `?map=52.37,4.89,12`, where a [map](ui-config.md#maps) looks, `?calendar=month,2026-10-01`, the month or week a [calendar](ui-config.md#calendars) shows, `?timeline=quarter,2026-10-01`, the week, month or quarter a [timeline](ui-config.md#timelines) shows, and `?saved_search=`, the [saved search](ui-config.md#saved-searches) the list was opened from. Views come from `examples/*/config/*/ui.ts`. The sidebar's recent-record groups and the user menu are configured there too: see [Sidebar](sidebar.md), [User menu](user-menu.md) and [Bottom bar](bottom-bar.md).
|
|
27
27
|
|
|
28
28
|
## Global search
|
|
29
29
|
|
|
@@ -307,7 +307,7 @@ Nothing a plugin does stops the app. Each of these turns off that plugin alone:
|
|
|
307
307
|
- its module cannot be loaded, or does not link: it imports something the app's `@protobase/ui` does not have;
|
|
308
308
|
- it defines a name an earlier plugin defines.
|
|
309
309
|
|
|
310
|
-
Every place it would fill then draws its fallback (see [Extension points](#extension-points)). The app's admins (the `admin` role) see a notice
|
|
310
|
+
Every place it would fill then draws its fallback (see [Extension points](#extension-points)). The app's admins (the `admin` role) see a notice below the top bar naming each plugin that is off and why, such as "The plugin sales-tools is off: it needs Protobase >=0.12.3, and this app runs 0.12.1." Everyone else sees only the fallbacks. An action handler that throws shows its error in a toast, as a project's does, and a part that throws while drawing shows its fallback in its own place.
|
|
311
311
|
|
|
312
312
|
## API
|
|
313
313
|
|