@akanjs/devkit 2.4.0-rc.4 → 2.4.0-rc.6

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.
@@ -265,6 +265,8 @@ describe("AkanAppConfig", () => {
265
265
  `postgres@${runtimeDependencies.postgres}`,
266
266
  `protobufjs@${runtimeDependencies.protobufjs}`,
267
267
  ]);
268
+ // The workspace-root install covers the toolchain/runtime plus every app Capacitor plugin
269
+ // (deduped — "@capacitor/core" appears in both source lists).
268
270
  const expectedMobilePackages: string[] = [
269
271
  "firebase",
270
272
  "@capacitor/cli",
@@ -272,18 +274,38 @@ describe("AkanAppConfig", () => {
272
274
  "@capacitor/ios",
273
275
  "@capacitor/android",
274
276
  "@capacitor/assets",
277
+ "@capacitor-community/fcm",
275
278
  "@capacitor/app",
279
+ "@capacitor/browser",
280
+ "@capacitor/camera",
276
281
  "@capacitor/device",
277
- "@capacitor/keyboard",
282
+ "@capacitor/geolocation",
278
283
  "@capacitor/haptics",
284
+ "@capacitor/inappbrowser",
285
+ "@capacitor/keyboard",
279
286
  "@capacitor/preferences",
280
- "@capacitor/browser",
287
+ "@capacitor/push-notifications",
281
288
  "capacitor-plugin-safe-area",
282
289
  ];
283
290
  expect(config.getMobileRuntimePackages() as string[]).toEqual(expectedMobilePackages);
284
291
  expect(config.getMissingMobileDependencySpecs()).toEqual(
285
292
  expectedMobilePackages.map((lib) => `${lib}@${runtimeDependencies[lib as keyof typeof runtimeDependencies]}`),
286
293
  );
294
+ expect(config.getMobileAppCapacitorPlugins()).toEqual([
295
+ "@capacitor-community/fcm",
296
+ "@capacitor/app",
297
+ "@capacitor/browser",
298
+ "@capacitor/camera",
299
+ "@capacitor/core",
300
+ "@capacitor/device",
301
+ "@capacitor/geolocation",
302
+ "@capacitor/haptics",
303
+ "@capacitor/inappbrowser",
304
+ "@capacitor/keyboard",
305
+ "@capacitor/preferences",
306
+ "@capacitor/push-notifications",
307
+ "capacitor-plugin-safe-area",
308
+ ]);
287
309
  });
288
310
 
289
311
  test("normalizes multiple mobile targets and validates base paths", () => {
@@ -52,17 +52,11 @@ const WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"] a
52
52
  const SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"] as const;
53
53
  const NATIVE_RUNTIME_PACKAGES = ["sharp"] as const;
54
54
  const DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"] as const;
55
- // Packages required to build/run a mobile target that are not part of the base bootstrap;
56
- // installed on demand when a mobile target is built or started. All are declared only as
57
- // optional peers, so a fresh workspace never auto-installs them. Split into three groups:
58
- // 1. the firebase client (push tokens),
59
- // 2. the Capacitor toolchain (`npx cap` / `npx @capacitor/assets` + the native platforms), and
60
- // 3. the Capacitor plugins the framework loads unconditionally on every native boot — Device,
61
- // Keyboard, Haptics and SafeArea (`Device.load`), App (CSR lifecycle), Preferences (storage),
62
- // Browser (`CsrLink` navigation). Without them `npx cap sync` never registers the native
63
- // plugin, so the JS bridge throws `Capacitor plugin "Device" is not available.` at runtime.
64
- // Feature-gated plugins (camera, contacts, geolocation, push, fcm, updater, purchase) stay opt-in
65
- // optional peers because they need app-specific native permissions/config before they can be used.
55
+ // The firebase client (push tokens) and the Capacitor toolchain `@capacitor/cli` (`npx cap`),
56
+ // `@capacitor/assets` (`npx @capacitor/assets`) plus the `@capacitor/core`/`ios`/`android` runtime
57
+ // and native-platform packages that `npx cap add`/`sync` resolve from the workspace node_modules.
58
+ // All are declared only as optional peers, so a fresh workspace never auto-installs them; the mobile
59
+ // preflight installs them (together with MOBILE_APP_CAPACITOR_PLUGINS) at the workspace root.
66
60
  const MOBILE_RUNTIME_PACKAGES = [
67
61
  "firebase",
68
62
  "@capacitor/cli",
@@ -70,12 +64,27 @@ const MOBILE_RUNTIME_PACKAGES = [
70
64
  "@capacitor/ios",
71
65
  "@capacitor/android",
72
66
  "@capacitor/assets",
67
+ ] as const;
68
+ // Capacitor plugins that must additionally be declared in the *app's* package.json
69
+ // (apps/<app>/package.json): `npx cap sync` discovers plugins by scanning the app directory's
70
+ // dependencies and registers their native code into the iOS/Android projects; packages present only
71
+ // at the workspace root are never registered, so the JS bridge throws
72
+ // `Capacitor plugin "Device" is not available.` at runtime. They are installed at the workspace root
73
+ // alongside MOBILE_RUNTIME_PACKAGES (pinned via optional peers) and declared in the app with a "*"
74
+ // range so bun dedupes them to that hoisted version instead of pinning a second source of truth.
75
+ const MOBILE_APP_CAPACITOR_PLUGINS = [
76
+ "@capacitor-community/fcm",
73
77
  "@capacitor/app",
78
+ "@capacitor/browser",
79
+ "@capacitor/camera",
80
+ "@capacitor/core",
74
81
  "@capacitor/device",
75
- "@capacitor/keyboard",
82
+ "@capacitor/geolocation",
76
83
  "@capacitor/haptics",
84
+ "@capacitor/inappbrowser",
85
+ "@capacitor/keyboard",
77
86
  "@capacitor/preferences",
78
- "@capacitor/browser",
87
+ "@capacitor/push-notifications",
79
88
  "capacitor-plugin-safe-area",
80
89
  ] as const;
81
90
  const DATABASE_MODE_RUNTIME_PACKAGES = {
@@ -415,11 +424,16 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
415
424
  return this.#getMissingDependencySpecs(this.getDatabaseModeRuntimePackages(databaseMode));
416
425
  }
417
426
  getMobileRuntimePackages() {
418
- return [...MOBILE_RUNTIME_PACKAGES];
427
+ // The app Capacitor plugins are installed at the workspace root too, so bun can resolve the
428
+ // app's "*" declarations to a hoisted, peer-pinned version instead of fetching latest.
429
+ return [...new Set([...MOBILE_RUNTIME_PACKAGES, ...MOBILE_APP_CAPACITOR_PLUGINS])];
419
430
  }
420
431
  getMissingMobileDependencySpecs() {
421
432
  return this.#getMissingDependencySpecs(this.getMobileRuntimePackages());
422
433
  }
434
+ getMobileAppCapacitorPlugins() {
435
+ return [...MOBILE_APP_CAPACITOR_PLUGINS];
436
+ }
423
437
  #getMissingDependencySpecs(libs: readonly string[]) {
424
438
  const rootDependencies = {
425
439
  ...this.rootPackageJson.dependencies,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "2.4.0-rc.4",
3
+ "version": "2.4.0-rc.6",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  "@langchain/openai": "^1.4.6",
33
33
  "@tailwindcss/node": "^4.3.0",
34
34
  "@trapezedev/project": "^7.1.4",
35
- "akanjs": "2.4.0-rc.4",
35
+ "akanjs": "2.4.0-rc.6",
36
36
  "chalk": "^5.6.2",
37
37
  "commander": "^14.0.3",
38
38
  "daisyui": "5.5.23",