@protobase/cli 0.75.2 → 0.76.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.
@@ -2,16 +2,17 @@ import { checkMobileConfig } from "../mobile/mobile-config.js";
2
2
  //#region src/build/bundle-mobile.ts
3
3
  /**
4
4
  * What the manifest says of the config's `mobile` section, checked as `protobase mobile` checks it: its app id, which a
5
- * host that never runs the config binds in the release's statement, and its plugins, empty when it gives none, which it
6
- * fingerprints the mobile release with. `undefined`
7
- * without a section, so its presence means the app has a mobile build.
5
+ * host that never runs the config binds in the release's statement, and its plugins, empty when it gives none, and
6
+ * `push`, the config's `notifications()`, with which it fingerprints the mobile release. `undefined` without a section,
7
+ * so its presence means the app has a mobile build.
8
8
  */
9
- const bundleMobile = (section) => {
9
+ const bundleMobile = (section, push) => {
10
10
  if (section === void 0) return;
11
11
  const { appId, plugins } = checkMobileConfig(section);
12
12
  return {
13
13
  appId,
14
- plugins: plugins ?? {}
14
+ plugins: plugins ?? {},
15
+ push
15
16
  };
16
17
  };
17
18
  //#endregion
@@ -99,7 +99,8 @@ const buildConfigBundle = async ({ projectDir, outFile, bun, extensions = [], co
99
99
  });
100
100
  return {
101
101
  native: [...native.values()],
102
- mobile: config.mobile
102
+ mobile: config.mobile,
103
+ notifications: Boolean(config.notifications)
103
104
  };
104
105
  };
105
106
  //#endregion
@@ -51,14 +51,14 @@ const buildDeployBundle = async ({ projectDir, outDir, bun, extensions = [], sou
51
51
  await removeOwnFolder(outDir, bundleNodeModules, "nodeModules");
52
52
  await removeOwnFolder(outDir, bundleMigrations, "migrations");
53
53
  const components = /* @__PURE__ */ new Set();
54
- const { native, mobile } = await buildConfigBundle({
54
+ const { native, mobile, notifications } = await buildConfigBundle({
55
55
  projectDir,
56
56
  outFile: path.join(outDir, bundleLayout.server),
57
57
  bun,
58
58
  extensions,
59
59
  components
60
60
  });
61
- const mobileSection = bundleMobile(mobile);
61
+ const mobileSection = bundleMobile(mobile, notifications);
62
62
  await checkViews(projectDir);
63
63
  await checkUi(projectDir, extensions, components);
64
64
  const packages = native.length > 0 ? await copyPackages(native, path.join(outDir, bundleNodeModules)) : [];
@@ -32,7 +32,7 @@ const parseManifest = (value, file) => {
32
32
  if (builtAt !== void 0 && !isTime(builtAt)) throw new Error(`${file} has a builtAt that is no time in ms`);
33
33
  if (icons !== void 0 && !isIcons(icons)) throw new Error(`${file} has icons that are not a favicon flag and a list of PNG icons`);
34
34
  if (native !== void 0 && !isVersions(native)) throw new Error(`${file} has a native that is not a map of package names to versions`);
35
- if (mobile !== void 0 && !(isObject(mobile) && isVersions(mobile.plugins) && (mobile.appId === void 0 || typeof mobile.appId === "string"))) throw new Error(`${file} has a mobile that is not { appId, plugins } with an app id and a map of package names to versions`);
35
+ if (mobile !== void 0 && !(isObject(mobile) && isVersions(mobile.plugins) && (mobile.appId === void 0 || typeof mobile.appId === "string") && (mobile.push === void 0 || typeof mobile.push === "boolean"))) throw new Error(`${file} has a mobile that is not { appId, plugins, push } with an app id, a map of package names to versions and true or false`);
36
36
  if (nodeModules !== void 0 && typeof nodeModules !== "string") throw new Error(`${file} has a nodeModules that is no path`);
37
37
  if (migrations !== void 0 && typeof migrations !== "string") throw new Error(`${file} has a migrations that is no path`);
38
38
  return {
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.75.2";
2
+ var version = "0.76.0";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.75.2",
3
+ "version": "0.76.0",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.75.2",
47
- "@protobase/layout": "0.75.2",
48
- "@protobase/query": "0.75.2",
49
- "@protobase/schema": "0.75.2",
50
- "@protobase/server": "0.75.2",
51
- "@protobase/ui": "0.75.2",
52
- "@protobase/workflows": "0.75.2",
46
+ "@protobase/config": "0.76.0",
47
+ "@protobase/layout": "0.76.0",
48
+ "@protobase/query": "0.76.0",
49
+ "@protobase/schema": "0.76.0",
50
+ "@protobase/server": "0.76.0",
51
+ "@protobase/ui": "0.76.0",
52
+ "@protobase/workflows": "0.76.0",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -254,7 +254,7 @@ By default the bundle runs on Node and on Bun. `--bun` makes it a bundle for Bun
254
254
  ],
255
255
  "shell": { "protobase": "0.12.0", "pluginApi": 1, "paths": ["/index.html", "/assets", "/protobase.sw.js"] },
256
256
  "native": { "@capacitor/core": "8.5.3", "@capacitor/ios": "8.5.3" },
257
- "mobile": { "appId": "com.example.shop", "plugins": { "@capacitor/camera": "^8.0.1" } },
257
+ "mobile": { "appId": "com.example.shop", "plugins": { "@capacitor/camera": "^8.0.1" }, "push": true },
258
258
  "nodeModules": "node_modules",
259
259
  "migrations": "migrations"
260
260
  }
@@ -265,7 +265,7 @@ By default the bundle runs on Node and on Bun. `--bun` makes it a bundle for Bun
265
265
  - `plugins` are the bundle's own plugins, in the order the app merges them: the extensions', then the project's (`app`). Each names its `plugin.json`, the plugin API and Protobase versions it is built for, and the [field types](plugins.md#field-types) it registers with the storage types each shows, which the serve runtime checks the views against at startup. `/api/meta` names them to everyone, before any other plugin.
266
266
  - `shell` is the admin app `public/` holds a copy of: its Protobase version and plugin API, and its files as URL paths. A host with a shell of its own may serve its own for those paths instead (see [The UI](#the-ui)), so the app gets that release's fixes without a rebuild.
267
267
  - `native` is the native code, name to version, that `shell` runs on in the [mobile app](../guides/mobile-app.md): the native packages `@protobase/mobile` pins, and `@protobase/mobile` itself at its native contract, such as `native-1`, which Protobase raises when its own native code changes. The fingerprint of the bundle's [mobile release](#mobile-releases) names them. A bundle built before it serves no mobile release.
268
- - `mobile` is present only when the project's config has a `mobile` section, so a host learns that the app has a mobile build without running the config: the section's `appId`, which the statement of a signed mobile release binds, and its `plugins`, name to the spec it gives, `{}` when it gives none, which the fingerprint of the mobile release names besides `native`. A bundle built before it names no `appId`. The build checks the section as `protobase mobile` does.
268
+ - `mobile` is present only when the project's config has a `mobile` section, so a host learns that the app has a mobile build without running the config: the section's `appId`, which the statement of a signed mobile release binds, its `plugins`, name to the spec it gives, `{}` when it gives none, and `push`, whether the config has [`notifications()`](notifications.md), with which the binaries compile native push in; the fingerprint of the mobile release names both besides `native`. A bundle built before it names no `appId`, and one built before `push` none, which counts as `false`. The build checks the section as `protobase mobile` does.
269
269
  - `theme` is the project's [theme](theme.md), which the app links at `/protobase.theme.css`. It is always there, empty when the project has none.
270
270
  - `nodeModules` is present only when the config module imports [native packages](#native-packages). It is always the `node_modules` folder beside `server`, where Bun and Node resolve the module's imports from, and holds plain packages: JavaScript, `package.json` files and native binaries for linux x64 and arm64 (glibc), which the runtime loads with `dlopen`. A host keeps it next to the server module and must not mount it `noexec` (an add-on there then fails with `failed to map segment from shared object`). Its binaries link nothing but glibc, `libstdc++.so.6`, `libgcc_s.so.1` and libraries in the bundle itself, so the run image must have those three. Without `nodeModules`, the server module is the only file the runtime reads.
271
271
  - `migrations` is present only when the project has a `db/migrations` folder: its `.sql` files, which the runtime's `migrate` applies (see [Deploy](../guides/deploy.md)). A host never serves it.
@@ -493,7 +493,7 @@ An Android or iOS app built with `mobile.publicKey` updates itself from the serv
493
493
 
494
494
  A host that serves bundles without running their config, such as a router in front of many apps or a static host, serves the same release from the files it already serves with `@protobase/server/mobile-release`, which loads none of the rest of the server: `protobase serve` composes its own release with the same exports.
495
495
 
496
- - `nativeFingerprint(native, plugins)`: the release's fingerprint, from the manifest's `native` (or that of the shell the host serves) and `mobile.plugins`. It is a contract across versions: a binary one Protobase release built is matched by a host that runs another.
496
+ - `nativeFingerprint(native, plugins, { push })`: the release's fingerprint, from the manifest's `native` (or that of the shell the host serves), `mobile.plugins` and `mobile.push`, `false` when the manifest names none. A host that leaves `push` out matches no binary of an app with `notifications()`. It is a contract across versions: a binary one Protobase release built is matched by a host that runs another.
497
497
  - `releaseOrder({ builtAt, shell })`: the order a release signs, from the manifest's build time and that of the server's own shell the host serves in its place, `[builtAt, 0]` with the bundle's copy; `undefined` when either names no build time.
498
498
  - `withApiOrigin(html, origin)`: the `spa` page naming the API origin, the app's `url`.
499
499
  - `composeRelease(files, signing?)`: the release of `{ href, content }` files, every file the host serves the web with the page above in place of `spa`, with its id and, with `signing`, `{ key, binding: { order, appId, fingerprint, shellVersion } }`, `appId` the manifest's `mobile.appId`, the signed checksums and statement.
@@ -234,7 +234,7 @@ The notification's title and body are its alert, with its `badge` and `sound`; t
234
234
  ## Android
235
235
 
236
236
  :::caution[Beta]
237
- Push on Android is new.
237
+ Push on Android is new, and a message over FCM's size limit is not refused before it is sent (see below).
238
238
  :::
239
239
 
240
240
  Android devices receive push through Firebase Cloud Messaging's HTTP v1 API. You create a service account key in your Firebase project (Project settings, Service accounts, Generate new private key) and set its JSON as `PROTOBASE_FCM_SERVICE_ACCOUNT`. Without it, Android devices are skipped. `protobase mobile` sets the app up from your `google-services.json`: see [Push notifications in the mobile app guide](../guides/mobile-app.md#9-push-notifications).