@protobase/cli 0.57.0 → 0.57.2
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
CHANGED
package/dist/mobile/package.js
CHANGED
|
@@ -53,30 +53,56 @@ const readIosFile = (ws, ...parts) => readFile(path.join(ws, "ios", "App", ...pa
|
|
|
53
53
|
if (error.code === "ENOENT") return;
|
|
54
54
|
throw error;
|
|
55
55
|
});
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
let parsed;
|
|
56
|
+
const iosConfigParts = ["App", "capacitor.config.json"];
|
|
57
|
+
const parseIosConfig = (text) => {
|
|
59
58
|
try {
|
|
60
|
-
|
|
59
|
+
return JSON.parse(text);
|
|
61
60
|
} catch (error) {
|
|
62
|
-
if (error instanceof SyntaxError) return
|
|
61
|
+
if (error instanceof SyntaxError) return;
|
|
63
62
|
throw error;
|
|
64
63
|
}
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
};
|
|
65
|
+
const iosClasses = (config) => {
|
|
66
|
+
const classes = config?.packageClassList;
|
|
67
|
+
return Array.isArray(classes) ? classes.filter((name) => typeof name === "string") : void 0;
|
|
68
|
+
};
|
|
69
|
+
/** The stock live updater's iOS class, and Protobase's guard that takes its place, by `@objc` name. */
|
|
70
|
+
const stockIosLiveUpdate = "LiveUpdatePlugin";
|
|
71
|
+
const guardedIosLiveUpdate = "GuardedLiveUpdatePlugin";
|
|
72
|
+
/** The Swift package product `cap add ios` compiles the live updater into, by the name @capacitor/cli's fixName gives. */
|
|
73
|
+
const liveUpdateIosProduct = "CapawesomeCapacitorLiveUpdate";
|
|
74
|
+
/**
|
|
75
|
+
* Puts Protobase's guarded live updater in the stock one's place in the class list `cap add ios` writes, so page script
|
|
76
|
+
* reaches only what the shell needs; listing both would run two updaters. `cap add ios` lists the guard in every app, as
|
|
77
|
+
* it lists each `@objc(...)` class of @protobase/mobile's Swift files, so an app without the live updater loses it.
|
|
78
|
+
*/
|
|
79
|
+
const guardIosLiveUpdate = async (ws) => {
|
|
80
|
+
const text = await readIosFile(ws, ...iosConfigParts);
|
|
81
|
+
const config = text === void 0 ? void 0 : parseIosConfig(text);
|
|
82
|
+
const classes = iosClasses(config);
|
|
83
|
+
if (!config || !classes) return;
|
|
84
|
+
const guarded = classes.includes("LiveUpdatePlugin") ? classes.map((name) => name === "LiveUpdatePlugin" ? guardedIosLiveUpdate : name).filter((name, index, all) => all.indexOf(name) === index) : classes.filter((name) => name !== guardedIosLiveUpdate);
|
|
85
|
+
await writeFile(path.join(ws, "ios", "App", ...iosConfigParts), JSON.stringify({
|
|
86
|
+
...config,
|
|
87
|
+
packageClassList: guarded
|
|
88
|
+
}, null, " "));
|
|
67
89
|
};
|
|
68
90
|
/**
|
|
69
|
-
* Checks what `cap add ios` writes: the class list, which must name Protobase's plugin classes and not the live
|
|
70
|
-
*
|
|
71
|
-
* without its product is skipped at launch without a word. A workspace left from an
|
|
91
|
+
* Checks what `cap add ios` writes: the class list, which must name Protobase's plugin classes and not the stock live
|
|
92
|
+
* updater, and the app's Swift package, which must compile Protobase's product in, and the live updater's when the
|
|
93
|
+
* guard is listed; a class listed without its product is skipped at launch without a word. A workspace left from an
|
|
94
|
+
* earlier CLI may lack either.
|
|
72
95
|
*/
|
|
73
96
|
const checkIosPlugins = async (ws) => {
|
|
74
97
|
const stale = (what) => /* @__PURE__ */ new Error(`The iOS app lacks Protobase's native plugin (${what}): delete ${ws} and run the command again`);
|
|
75
|
-
const
|
|
76
|
-
|
|
98
|
+
const text = await readIosFile(ws, ...iosConfigParts);
|
|
99
|
+
const classes = (text === void 0 ? void 0 : iosClasses(parseIosConfig(text))) ?? [];
|
|
100
|
+
if (classes.includes("LiveUpdatePlugin")) throw new Error(`The iOS app lists ${stockIosLiveUpdate}, which hands page script the live updater unguarded: run protobase mobile again instead of cap sync`);
|
|
77
101
|
const missing = protobaseIosPluginClasses.filter((name) => !classes.includes(name));
|
|
78
102
|
if (missing.length > 0) throw stale(missing.join(", "));
|
|
79
|
-
|
|
103
|
+
const manifest = await readIosFile(ws, "CapApp-SPM", "Package.swift");
|
|
104
|
+
if (!manifest?.includes(`.product(name: "ProtobaseMobile"`)) throw stale(protobaseIosProduct);
|
|
105
|
+
if (classes.includes("GuardedLiveUpdatePlugin") && !manifest.includes(`.product(name: "CapawesomeCapacitorLiveUpdate"`)) throw new Error(`The iOS app lists ${guardedIosLiveUpdate} without the live updater's ${liveUpdateIosProduct}: run protobase mobile again`);
|
|
80
106
|
};
|
|
81
107
|
//#endregion
|
|
82
|
-
export { checkIosPlugins, checkProtobasePlugin, guardLiveUpdate, protobaseIosPluginClasses, protobaseIosProduct, protobasePluginClasses };
|
|
108
|
+
export { checkIosPlugins, checkProtobasePlugin, guardIosLiveUpdate, guardLiveUpdate, guardedIosLiveUpdate, liveUpdateIosProduct, protobaseIosPluginClasses, protobaseIosProduct, protobasePluginClasses, stockIosLiveUpdate };
|
package/dist/mobile/run.js
CHANGED
|
@@ -12,7 +12,7 @@ import { deviceAppName } from "./device-app-name.js";
|
|
|
12
12
|
import { generatePlatform } from "./generate.js";
|
|
13
13
|
import { loadMobileProject } from "./load-project.js";
|
|
14
14
|
import { signForDevelopment } from "./development-signing.js";
|
|
15
|
-
import { checkIosPlugins, checkProtobasePlugin, guardLiveUpdate } from "./protobase-plugin.js";
|
|
15
|
+
import { checkIosPlugins, checkProtobasePlugin, guardIosLiveUpdate, guardLiveUpdate } from "./protobase-plugin.js";
|
|
16
16
|
import { mobileSpec, prepareWorkspace, workspaceDir, workspacePackageJson } from "./workspace.js";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { nativeFingerprint } from "@protobase/server/mobile-release";
|
|
@@ -69,7 +69,10 @@ const prepare = async ({ projectDir, platform, api, extensions, live, release },
|
|
|
69
69
|
if (platform === "android") {
|
|
70
70
|
await guardLiveUpdate(ws);
|
|
71
71
|
await checkProtobasePlugin(ws);
|
|
72
|
-
} else
|
|
72
|
+
} else {
|
|
73
|
+
await guardIosLiveUpdate(ws);
|
|
74
|
+
await checkIosPlugins(ws);
|
|
75
|
+
}
|
|
73
76
|
return {
|
|
74
77
|
ws,
|
|
75
78
|
url,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.2",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@better-auth/core": "^1.7.12",
|
|
44
44
|
"@hono/node-server": "^2.1.3",
|
|
45
|
-
"@protobase/config": "0.57.
|
|
46
|
-
"@protobase/layout": "0.57.
|
|
47
|
-
"@protobase/query": "0.57.
|
|
48
|
-
"@protobase/schema": "0.57.
|
|
49
|
-
"@protobase/server": "0.57.
|
|
50
|
-
"@protobase/ui": "0.57.
|
|
45
|
+
"@protobase/config": "0.57.2",
|
|
46
|
+
"@protobase/layout": "0.57.2",
|
|
47
|
+
"@protobase/query": "0.57.2",
|
|
48
|
+
"@protobase/schema": "0.57.2",
|
|
49
|
+
"@protobase/server": "0.57.2",
|
|
50
|
+
"@protobase/ui": "0.57.2",
|
|
51
51
|
"@react-email/render": "^2.1.0",
|
|
52
52
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
53
53
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -44,7 +44,7 @@ Every commit message follows [Conventional Commits](https://www.conventionalcomm
|
|
|
44
44
|
|
|
45
45
|
`.github/workflows/release.yml` runs on every push to `main`:
|
|
46
46
|
|
|
47
|
-
1. The checks of `ci.yml` (`bun run check`, the smoke test on Node, the docs build, the Storybook play tests and the docs check), of the tests and steps the changes since the last `v<version>` tag affect (see What a push checks in `CONTRIBUTING.md`), and commitlint over the pushed commits.
|
|
47
|
+
1. The checks of `ci.yml` (`bun run check`, the smoke test on Node, the docs build, the Storybook play tests and the docs check), of the tests and steps the changes since the last `v<version>` tag affect (see What a push checks in `CONTRIBUTING.md`), and commitlint over the pushed commits. The Postgres suite (`bun run test:postgres`, on Postgres and PgBouncer) runs in full as well, whatever changed, beside the other checks. They start at once, and the release waits for them all.
|
|
48
48
|
2. `bun run release` (`scripts/release.mjs`, with [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version)) computes the next version and its notes from the commits since the last `v<version>` tag, as above, and tags the pushed commit `v<version>`. It commits nothing and changes no file. Without a fix, feature or breaking change it tags nothing.
|
|
49
49
|
3. The tag is pushed, and the GitHub release of the tag gets the notes.
|
|
50
50
|
4. `scripts/stamp-version.mjs` writes the tag's version into every `package.json` and `bun.lock` in the runner, never committed. `scripts/publish.mjs` then builds every package at the tag to `dist` and packs it with Bun (the private `@protobase/presets` is not published), and npm, under Node, publishes it with [trusted publishing](https://docs.npmjs.com/trusted-publishers) and provenance; there is no npm token. A run that cut no release publishes nothing.
|