@protobase/cli 0.45.6 → 0.45.7
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/generate.js +4 -1
- package/dist/mobile/native-icon.js +39 -0
- package/package.json +6 -6
- package/skills/protobase/references/guides/mobile-app.md +2 -0
- package/skills/protobase/references/reference/app-identity.md +1 -1
- package/skills/protobase/references/reference/ui-config.md +1 -1
package/dist/cli/package.js
CHANGED
package/dist/mobile/generate.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { withLocalNetworking } from "./info-plist.js";
|
|
2
|
+
import { withProtobaseIcon } from "./native-icon.js";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
4
5
|
//#region src/mobile/generate.ts
|
|
5
6
|
const infoPlist = (ws) => path.join(ws, "ios", "App", "App", "Info.plist");
|
|
6
7
|
/**
|
|
7
8
|
* Generates the platform's native project in the workspace from its capacitor.config.json and app files, replacing
|
|
8
|
-
* the last one: it is never edited by hand.
|
|
9
|
+
* the last one: it is never edited by hand. Its home-screen icon is Protobase's, and an iOS app calling the API over
|
|
10
|
+
* plain http may reach local addresses.
|
|
9
11
|
*/
|
|
10
12
|
const generatePlatform = async (ws, platform, { cleartext }, cap) => {
|
|
11
13
|
await rm(path.join(ws, platform), {
|
|
@@ -13,6 +15,7 @@ const generatePlatform = async (ws, platform, { cleartext }, cap) => {
|
|
|
13
15
|
force: true
|
|
14
16
|
});
|
|
15
17
|
await cap(["add", platform]);
|
|
18
|
+
await withProtobaseIcon(ws, platform);
|
|
16
19
|
if (platform !== "ios" || !cleartext) return;
|
|
17
20
|
await writeFile(infoPlist(ws), withLocalNetworking(await readFile(infoPlist(ws), "utf8")));
|
|
18
21
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { copyFile } from "node:fs/promises";
|
|
4
|
+
/**
|
|
5
|
+
* The template's home-screen icon files, by path in the platform's native project, which Protobase's icon replaces:
|
|
6
|
+
* iOS's one 1024 pixel icon; Android's legacy, round and adaptive foreground icons at each density, and the adaptive
|
|
7
|
+
* icon's background colour.
|
|
8
|
+
*/
|
|
9
|
+
const nativeIconFiles = {
|
|
10
|
+
ios: ["App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png"],
|
|
11
|
+
android: [...[
|
|
12
|
+
"mdpi",
|
|
13
|
+
"hdpi",
|
|
14
|
+
"xhdpi",
|
|
15
|
+
"xxhdpi",
|
|
16
|
+
"xxxhdpi"
|
|
17
|
+
].flatMap((density) => [
|
|
18
|
+
"ic_launcher",
|
|
19
|
+
"ic_launcher_round",
|
|
20
|
+
"ic_launcher_foreground"
|
|
21
|
+
].map((icon) => `app/src/main/res/mipmap-${density}/${icon}.png`)), "app/src/main/res/values/ic_launcher_background.xml"]
|
|
22
|
+
};
|
|
23
|
+
/** Where @protobase/mobile, installed in the workspace `ws`, has Protobase's icon for the platform, by the same paths. */
|
|
24
|
+
const protobaseIconDir = (ws, platform) => path.join(ws, "node_modules", "@protobase", "mobile", "icon", platform);
|
|
25
|
+
/**
|
|
26
|
+
* Gives the platform's native project in the workspace Protobase's icon in place of Capacitor's. Each file must be one
|
|
27
|
+
* the template has, so a template that moves its icon fails here rather than leaving Capacitor's on the phone.
|
|
28
|
+
*/
|
|
29
|
+
const withProtobaseIcon = async (ws, platform) => {
|
|
30
|
+
for (const file of nativeIconFiles[platform]) {
|
|
31
|
+
const from = path.join(protobaseIconDir(ws, platform), file);
|
|
32
|
+
const to = path.join(ws, platform, file);
|
|
33
|
+
if (!existsSync(from)) throw new Error(`@protobase/mobile has no ${path.join(platform, file)} of Protobase's icon`);
|
|
34
|
+
if (!existsSync(to)) throw new Error(`The generated ${platform} project has no ${file}, the icon Protobase's replaces`);
|
|
35
|
+
await copyFile(from, to);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { nativeIconFiles, protobaseIconDir, withProtobaseIcon };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.7",
|
|
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.7",
|
|
40
|
+
"@protobase/query": "0.45.7",
|
|
41
|
+
"@protobase/schema": "0.45.7",
|
|
42
|
+
"@protobase/server": "0.45.7",
|
|
43
|
+
"@protobase/ui": "0.45.7",
|
|
44
44
|
"@react-email/render": "^2.1.0",
|
|
45
45
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
46
46
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -35,6 +35,8 @@ export default defineConfig({
|
|
|
35
35
|
|
|
36
36
|
The app is installed under the name it shows in its upper left, on iOS and Android alike: `protobase mobile` reads it from the server the app calls (its web manifest), so a `PROTOBASE_APP_NAME` the server runs with names the app on the phone too. When that server cannot be reached, `run` and `open` warn and take the project's own name, `appName` or `PROTOBASE_APP_NAME` in its environment, and `build` stops.
|
|
37
37
|
|
|
38
|
+
On the home screen the app shows Protobase's icon, on iOS and Android alike. <gap>An app cannot show its own icon on the phone because setting the mobile app's icon is not implemented.</gap>
|
|
39
|
+
|
|
38
40
|
With a mobile section, the API answers the app's origins, `capacitor://localhost` on iOS and `https://localhost` on Android, through [CORS](../reference/api.md#cors). Apps without one get no new dependency, and `protobase build` and `protobase dev` work as before.
|
|
39
41
|
|
|
40
42
|
Signing in works in the app as on the web, with nothing more to set up:
|
|
@@ -9,7 +9,7 @@ An app looks like its own everywhere from three things in its project: its name,
|
|
|
9
9
|
| What | Where | Used by |
|
|
10
10
|
| --- | --- | --- |
|
|
11
11
|
| Name | `appName` of `createAuth` ([auth configuration](auth.md#configuration)), overridden at run time by `PROTOBASE_APP_NAME` | the sidebar's logo, the end of every tab title, the installed app's name, the [mobile app](../guides/mobile-app.md)'s name on the phone, passkey and authenticator prompts, auth mail and its sender's name |
|
|
12
|
-
| Icon | `protobase.favicon.svg` at the project's root | the browser tab, the sidebar's logo, the installed app's icon |
|
|
12
|
+
| Icon | `protobase.favicon.svg` at the project's root | the browser tab, the sidebar's logo, the installed app's icon; the [mobile app](../guides/mobile-app.md) shows Protobase's icon instead |
|
|
13
13
|
| Raster icons | optional PNGs beside the SVG, below | the iPhone home screen and Android launchers, which take no SVG |
|
|
14
14
|
| Colours | `app` in `protobase.config.ts` | the installed app's title bar and its start screen |
|
|
15
15
|
|
|
@@ -599,7 +599,7 @@ export const repairsView = filtered
|
|
|
599
599
|
| `l.section(title, fields, { help?, helpWhen?, presentation?, when? })` | A titled group of fields in the main column, editable where the user may write. `presentation: 'facts'` shows them on the read view as a row of [key facts](#key-facts). |
|
|
600
600
|
| `l.group(title, items, { collapsed?, when? })` | A heading over sections and related tables, closed until opened with `collapsed: true`. `when` also takes a [condition](#form-and-read-view). See [Groups](#groups). |
|
|
601
601
|
| `l.tab(title, items)` | A tab holding main-column items; a view's tabs show as one strip on the read view and the form. See [Tabs](#tabs). |
|
|
602
|
-
| `l.sidebar(fields, { when? })` | A summary card beside it, read-only, each value on one line, cut off with an ellipsis when it does not fit and shown whole on hover. `when` also takes a [condition](#form-and-read-view). |
|
|
602
|
+
| `l.sidebar(fields, { when? })` | A summary card beside it, read-only, each value on one line, cut off with an ellipsis when it does not fit and shown whole on hover. The record's created and updated times show in a Details card below it, but for those the summary lists. `when` also takes a [condition](#form-and-read-view). |
|
|
603
603
|
| `l.related(title, { ... })` | A table or cards of the records of another resource that point at this one, in the main column. See [Related records](#related-records). |
|
|
604
604
|
| `l.custom(Component, { title?, props?, sidebar?, when? })` | A [custom component](custom-components.md#record-sections) where it is listed: in the main column under `title`, or with `sidebar: true` as a sidebar card. |
|
|
605
605
|
| `l.map(title, { latitude, longitude, zoom?, sidebar?, when? })` | A map with a pin at the record's position, in the main column or with `sidebar: true` as a sidebar card. See [Maps](#maps). |
|