@akanjs/cli 2.4.0-rc.3 → 2.4.0-rc.5

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.
@@ -729,6 +729,21 @@ var MOBILE_RUNTIME_PACKAGES = [
729
729
  "@capacitor/android",
730
730
  "@capacitor/assets"
731
731
  ];
732
+ var MOBILE_APP_CAPACITOR_PLUGINS = [
733
+ "@capacitor-community/fcm",
734
+ "@capacitor/app",
735
+ "@capacitor/browser",
736
+ "@capacitor/camera",
737
+ "@capacitor/core",
738
+ "@capacitor/device",
739
+ "@capacitor/geolocation",
740
+ "@capacitor/haptics",
741
+ "@capacitor/inappbrowser",
742
+ "@capacitor/keyboard",
743
+ "@capacitor/preferences",
744
+ "@capacitor/push-notifications",
745
+ "capacitor-plugin-safe-area"
746
+ ];
732
747
  var DATABASE_MODE_RUNTIME_PACKAGES = {
733
748
  single: [],
734
749
  multiple: ["@libsql/client", "bullmq", "ioredis", "protobufjs"],
@@ -1038,6 +1053,9 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
1038
1053
  getMissingMobileDependencySpecs() {
1039
1054
  return this.#getMissingDependencySpecs(this.getMobileRuntimePackages());
1040
1055
  }
1056
+ getMobileAppCapacitorPlugins() {
1057
+ return [...MOBILE_APP_CAPACITOR_PLUGINS];
1058
+ }
1041
1059
  #getMissingDependencySpecs(libs) {
1042
1060
  const rootDependencies = {
1043
1061
  ...this.rootPackageJson.dependencies,
package/index.js CHANGED
@@ -727,6 +727,21 @@ var MOBILE_RUNTIME_PACKAGES = [
727
727
  "@capacitor/android",
728
728
  "@capacitor/assets"
729
729
  ];
730
+ var MOBILE_APP_CAPACITOR_PLUGINS = [
731
+ "@capacitor-community/fcm",
732
+ "@capacitor/app",
733
+ "@capacitor/browser",
734
+ "@capacitor/camera",
735
+ "@capacitor/core",
736
+ "@capacitor/device",
737
+ "@capacitor/geolocation",
738
+ "@capacitor/haptics",
739
+ "@capacitor/inappbrowser",
740
+ "@capacitor/keyboard",
741
+ "@capacitor/preferences",
742
+ "@capacitor/push-notifications",
743
+ "capacitor-plugin-safe-area"
744
+ ];
730
745
  var DATABASE_MODE_RUNTIME_PACKAGES = {
731
746
  single: [],
732
747
  multiple: ["@libsql/client", "bullmq", "ioredis", "protobufjs"],
@@ -1036,6 +1051,9 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
1036
1051
  getMissingMobileDependencySpecs() {
1037
1052
  return this.#getMissingDependencySpecs(this.getMobileRuntimePackages());
1038
1053
  }
1054
+ getMobileAppCapacitorPlugins() {
1055
+ return [...MOBILE_APP_CAPACITOR_PLUGINS];
1056
+ }
1039
1057
  #getMissingDependencySpecs(libs) {
1040
1058
  const rootDependencies = {
1041
1059
  ...this.rootPackageJson.dependencies,
@@ -17760,6 +17778,27 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
17760
17778
  throw error;
17761
17779
  }
17762
17780
  }
17781
+ async syncMobileAppCapacitorPlugins(app, akanConfig3) {
17782
+ const plugins = akanConfig3.getMobileAppCapacitorPlugins();
17783
+ if (plugins.length === 0)
17784
+ return;
17785
+ const packageJson = await app.getPackageJson({ refresh: true });
17786
+ const dependencies = packageJson.dependencies ?? {};
17787
+ const missing = plugins.filter((plugin) => !dependencies[plugin]);
17788
+ if (missing.length === 0)
17789
+ return;
17790
+ const spinner2 = app.workspace.spinning(`Adding default Capacitor plugins to ${app.name}...`);
17791
+ try {
17792
+ packageJson.dependencies = { ...dependencies, ...Object.fromEntries(missing.map((plugin) => [plugin, "*"])) };
17793
+ await app.setPackageJson(packageJson);
17794
+ await app.workspace.spawn("bun", ["install"], { stdio: "inherit" });
17795
+ await app.getPackageJson({ refresh: true });
17796
+ spinner2.succeed(`Added default Capacitor plugins to ${app.name}: ${missing.join(", ")}`);
17797
+ } catch (error) {
17798
+ spinner2.fail(`Failed to add default Capacitor plugins to ${app.name}`);
17799
+ throw error;
17800
+ }
17801
+ }
17763
17802
  async createApplication(appName, workspace, { start = false, libs = [] } = {}) {
17764
17803
  const spinner2 = workspace.spinning("Creating application...");
17765
17804
  const app = await this.applicationRunner.createApplication(appName, workspace, libs);
@@ -17881,7 +17920,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
17881
17920
  noAllowProvisioningUpdates = false
17882
17921
  } = {}) {
17883
17922
  await app.scanSync({ write });
17884
- await this.syncMobileDependencies(app, await app.getConfig());
17923
+ const akanConfig3 = await app.getConfig();
17924
+ await this.syncMobileDependencies(app, akanConfig3);
17925
+ await this.syncMobileAppCapacitorPlugins(app, akanConfig3);
17885
17926
  await this.applicationRunner.startIos(app, {
17886
17927
  open,
17887
17928
  operation,
@@ -17910,7 +17951,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
17910
17951
  regenerate = false
17911
17952
  } = {}) {
17912
17953
  await app.scanSync({ write });
17913
- await this.syncMobileDependencies(app, await app.getConfig());
17954
+ const akanConfig3 = await app.getConfig();
17955
+ await this.syncMobileDependencies(app, akanConfig3);
17956
+ await this.syncMobileAppCapacitorPlugins(app, akanConfig3);
17914
17957
  await this.applicationRunner.startAndroid(app, {
17915
17958
  open,
17916
17959
  operation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "2.4.0-rc.3",
3
+ "version": "2.4.0-rc.5",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -34,7 +34,7 @@
34
34
  "@langchain/openai": "^1.4.6",
35
35
  "@tailwindcss/node": "^4.3.0",
36
36
  "@trapezedev/project": "^7.1.4",
37
- "akanjs": "2.4.0-rc.3",
37
+ "akanjs": "2.4.0-rc.5",
38
38
  "chalk": "^5.6.2",
39
39
  "commander": "^14.0.3",
40
40
  "daisyui": "5.5.23",