@akanjs/cli 2.3.6-rc.2 → 2.3.6-rc.3
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/incrementalBuilder.proc.js +590 -42
- package/index.js +614 -59
- package/package.json +2 -2
- package/templates/workspaceRoot/.env.template +4 -2
- package/templates/workspaceRoot/Untitled +1 -0
package/index.js
CHANGED
|
@@ -2488,6 +2488,7 @@ var PAGE_ROUTE_EXPORTS = new Set([
|
|
|
2488
2488
|
]);
|
|
2489
2489
|
var ROOT_LAYOUT_EXPORTS = new Set([
|
|
2490
2490
|
"default",
|
|
2491
|
+
"pageConfig",
|
|
2491
2492
|
"head",
|
|
2492
2493
|
"metadata",
|
|
2493
2494
|
"generateHead",
|
|
@@ -2504,6 +2505,7 @@ var ROOT_LAYOUT_EXPORTS = new Set([
|
|
|
2504
2505
|
]);
|
|
2505
2506
|
var LAYOUT_ROUTE_EXPORTS = new Set([
|
|
2506
2507
|
"default",
|
|
2508
|
+
"pageConfig",
|
|
2507
2509
|
"head",
|
|
2508
2510
|
"metadata",
|
|
2509
2511
|
"generateHead",
|
|
@@ -5193,6 +5195,7 @@ export async function generateMetadata(props: PageProps) {
|
|
|
5193
5195
|
|
|
5194
5196
|
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
5195
5197
|
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
5198
|
+
export const pageConfig = userLayout.pageConfig ?? inheritedLayout.pageConfig;
|
|
5196
5199
|
|
|
5197
5200
|
export default function GeneratedLayout({ children, params, searchParams }: LayoutProps) {
|
|
5198
5201
|
return (
|
|
@@ -5234,6 +5237,7 @@ export async function generateMetadata(props: PageProps) {
|
|
|
5234
5237
|
|
|
5235
5238
|
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
5236
5239
|
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
5240
|
+
export const pageConfig = userLayout.pageConfig ?? inheritedLayout.pageConfig;
|
|
5237
5241
|
|
|
5238
5242
|
export default function GeneratedLayout({ children, params, searchParams }: LayoutProps) {
|
|
5239
5243
|
return <UserLayout params={params} searchParams={searchParams}>{children}</UserLayout>;
|
|
@@ -9482,7 +9486,9 @@ class Builder {
|
|
|
9482
9486
|
}
|
|
9483
9487
|
// pkgs/@akanjs/devkit/capacitorApp.ts
|
|
9484
9488
|
import { cp as cp2, mkdir as mkdir11, rm as rm5 } from "fs/promises";
|
|
9489
|
+
import os from "os";
|
|
9485
9490
|
import path38 from "path";
|
|
9491
|
+
import { select as select2 } from "@inquirer/prompts";
|
|
9486
9492
|
import { MobileProject } from "@trapezedev/project";
|
|
9487
9493
|
import { capitalize as capitalize4 } from "akanjs/common";
|
|
9488
9494
|
|
|
@@ -9661,6 +9667,407 @@ var resolveMobilePath = (target, pathname) => {
|
|
|
9661
9667
|
};
|
|
9662
9668
|
var targetHtmlFilename = (target) => target.basePath?.replace(/^\/+|\/+$/g, "") ? `${target.basePath.replace(/^\/+|\/+$/g, "")}.html` : "index.html";
|
|
9663
9669
|
// pkgs/@akanjs/devkit/capacitorApp.ts
|
|
9670
|
+
var iosNativeBlockedEnvKeys = new Set([
|
|
9671
|
+
"AR",
|
|
9672
|
+
"AS",
|
|
9673
|
+
"CC",
|
|
9674
|
+
"CFLAGS",
|
|
9675
|
+
"CONDA_BUILD_SYSROOT",
|
|
9676
|
+
"CONDA_PREFIX",
|
|
9677
|
+
"CPP",
|
|
9678
|
+
"CPPFLAGS",
|
|
9679
|
+
"CPATH",
|
|
9680
|
+
"CXX",
|
|
9681
|
+
"CXXFLAGS",
|
|
9682
|
+
"LD",
|
|
9683
|
+
"LDFLAGS",
|
|
9684
|
+
"LIBRARY_PATH",
|
|
9685
|
+
"MACOSX_DEPLOYMENT_TARGET",
|
|
9686
|
+
"NM",
|
|
9687
|
+
"OBJC",
|
|
9688
|
+
"OBJCXX",
|
|
9689
|
+
"PREFIX",
|
|
9690
|
+
"RANLIB",
|
|
9691
|
+
"SDKROOT",
|
|
9692
|
+
"STRIP"
|
|
9693
|
+
]);
|
|
9694
|
+
var rootCapacitorConfigFilenames = [
|
|
9695
|
+
"capacitor.config.ts",
|
|
9696
|
+
"capacitor.config.js",
|
|
9697
|
+
"capacitor.config.json"
|
|
9698
|
+
];
|
|
9699
|
+
var rootCapacitorConfigPaths = (appRoot) => rootCapacitorConfigFilenames.map((file) => path38.join(appRoot, file));
|
|
9700
|
+
async function clearRootCapacitorConfigs(appRoot) {
|
|
9701
|
+
await Promise.all(rootCapacitorConfigPaths(appRoot).map((file) => rm5(file, { force: true })));
|
|
9702
|
+
}
|
|
9703
|
+
async function writeRootCapacitorConfig(appRoot, content) {
|
|
9704
|
+
await clearRootCapacitorConfigs(appRoot);
|
|
9705
|
+
await Bun.write(path38.join(appRoot, "capacitor.config.json"), content);
|
|
9706
|
+
}
|
|
9707
|
+
var getLocalIP = () => {
|
|
9708
|
+
const interfaces = os.networkInterfaces();
|
|
9709
|
+
for (const iface of Object.values(interfaces)) {
|
|
9710
|
+
if (!iface)
|
|
9711
|
+
continue;
|
|
9712
|
+
for (const alias of iface) {
|
|
9713
|
+
if (alias.family === "IPv4" && !alias.internal)
|
|
9714
|
+
return alias.address;
|
|
9715
|
+
}
|
|
9716
|
+
}
|
|
9717
|
+
return "127.0.0.1";
|
|
9718
|
+
};
|
|
9719
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9720
|
+
var asString = (value) => typeof value === "string" ? value : undefined;
|
|
9721
|
+
var firstString = (...values) => values.find((value) => typeof value === "string");
|
|
9722
|
+
var scoreIosDeviceTarget = (target) => {
|
|
9723
|
+
const state = target.state?.toLowerCase() ?? "";
|
|
9724
|
+
return (state.includes("available") ? 4 : 0) + (state.includes("wired") ? 2 : 0) + (state.includes("paired") ? 1 : 0);
|
|
9725
|
+
};
|
|
9726
|
+
var dedupeIosRunTargets = (targets) => {
|
|
9727
|
+
const byKey = new Map;
|
|
9728
|
+
const runnableTargets = targets.filter((target) => !target.state?.toLowerCase().includes("unavailable"));
|
|
9729
|
+
for (const target of runnableTargets) {
|
|
9730
|
+
const key = target.xcodebuildId ?? target.id;
|
|
9731
|
+
const current = byKey.get(key);
|
|
9732
|
+
if (!current || scoreIosDeviceTarget(target) > scoreIosDeviceTarget(current))
|
|
9733
|
+
byKey.set(key, target);
|
|
9734
|
+
}
|
|
9735
|
+
return [...byKey.values()];
|
|
9736
|
+
};
|
|
9737
|
+
function walkRecords(value, visit) {
|
|
9738
|
+
if (Array.isArray(value)) {
|
|
9739
|
+
for (const item of value)
|
|
9740
|
+
walkRecords(item, visit);
|
|
9741
|
+
return;
|
|
9742
|
+
}
|
|
9743
|
+
if (!isRecord(value))
|
|
9744
|
+
return;
|
|
9745
|
+
visit(value);
|
|
9746
|
+
for (const item of Object.values(value))
|
|
9747
|
+
walkRecords(item, visit);
|
|
9748
|
+
}
|
|
9749
|
+
function parseDevicectlDevices(output) {
|
|
9750
|
+
try {
|
|
9751
|
+
const json = JSON.parse(output);
|
|
9752
|
+
const targets = new Map;
|
|
9753
|
+
walkRecords(json, (record) => {
|
|
9754
|
+
const deviceProperties = isRecord(record.deviceProperties) ? record.deviceProperties : {};
|
|
9755
|
+
const hardwareProperties = isRecord(record.hardwareProperties) ? record.hardwareProperties : {};
|
|
9756
|
+
const connectionProperties = isRecord(record.connectionProperties) ? record.connectionProperties : {};
|
|
9757
|
+
const devicectlId = firstString(record.identifier, record.deviceIdentifier);
|
|
9758
|
+
const potentialHostnames = Array.isArray(connectionProperties.potentialHostnames) ? connectionProperties.potentialHostnames.filter((value) => typeof value === "string") : [];
|
|
9759
|
+
const hostnameUdid = potentialHostnames.map((hostname) => hostname.match(/([0-9A-Fa-f]{8}-[0-9A-Fa-f]{16})\.coredevice\.local/)?.[1]).find((value) => Boolean(value));
|
|
9760
|
+
const udid = firstString(hardwareProperties.udid, hostnameUdid, record.udid, record.UDID);
|
|
9761
|
+
const id = udid ?? devicectlId;
|
|
9762
|
+
const name = firstString(deviceProperties.name, record.name, record.deviceName, record.displayName);
|
|
9763
|
+
if (!id || !name)
|
|
9764
|
+
return;
|
|
9765
|
+
const state = [
|
|
9766
|
+
firstString(record.state, record.connectionState, record.availability, connectionProperties.tunnelState),
|
|
9767
|
+
firstString(connectionProperties.transportType),
|
|
9768
|
+
firstString(connectionProperties.pairingState)
|
|
9769
|
+
].filter(Boolean).join(" ");
|
|
9770
|
+
targets.set(id, { id, name, kind: "device", state, devicectlId, xcodebuildId: udid ?? id });
|
|
9771
|
+
});
|
|
9772
|
+
return dedupeIosRunTargets([...targets.values()]);
|
|
9773
|
+
} catch {
|
|
9774
|
+
const targets = [];
|
|
9775
|
+
for (const line of output.split(/\r?\n/)) {
|
|
9776
|
+
const id = line.match(/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{16}|[0-9A-Fa-f-]{25,}/)?.[0];
|
|
9777
|
+
if (!id)
|
|
9778
|
+
continue;
|
|
9779
|
+
const name = line.replace(id, "").replace(/[()]/g, " ").trim().replace(/\s+/g, " ") || id;
|
|
9780
|
+
targets.push({ id, name, kind: "device" });
|
|
9781
|
+
}
|
|
9782
|
+
return dedupeIosRunTargets(targets);
|
|
9783
|
+
}
|
|
9784
|
+
}
|
|
9785
|
+
function parseSimctlDevices(output) {
|
|
9786
|
+
try {
|
|
9787
|
+
const json = JSON.parse(output);
|
|
9788
|
+
const devices = json.devices ?? {};
|
|
9789
|
+
return Object.values(devices).flatMap((runtimeDevices) => runtimeDevices).filter(isRecord).flatMap((device) => {
|
|
9790
|
+
const id = firstString(device.udid, device.UDID, device.identifier);
|
|
9791
|
+
const name = firstString(device.name, device.displayName);
|
|
9792
|
+
const isAvailable = device.isAvailable !== false && device.availabilityError === undefined;
|
|
9793
|
+
if (!id || !name || !isAvailable)
|
|
9794
|
+
return [];
|
|
9795
|
+
return [{ id, name, kind: "simulator", state: asString(device.state) }];
|
|
9796
|
+
});
|
|
9797
|
+
} catch {
|
|
9798
|
+
const targets = [];
|
|
9799
|
+
for (const line of output.split(/\r?\n/)) {
|
|
9800
|
+
const match = line.match(/^\s*(.+?)\s+\(([0-9A-Fa-f-]{20,})\)\s+\(([^)]+)\)/);
|
|
9801
|
+
if (!match)
|
|
9802
|
+
continue;
|
|
9803
|
+
targets.push({ id: match[2], name: match[1].trim(), kind: "simulator", state: match[3] });
|
|
9804
|
+
}
|
|
9805
|
+
return targets;
|
|
9806
|
+
}
|
|
9807
|
+
}
|
|
9808
|
+
function buildIosNativeRunCommand({
|
|
9809
|
+
appRoot,
|
|
9810
|
+
device,
|
|
9811
|
+
scheme = "App",
|
|
9812
|
+
configuration = "Debug"
|
|
9813
|
+
}) {
|
|
9814
|
+
const derivedDataPath = path38.join(appRoot, "ios/DerivedData", device.id);
|
|
9815
|
+
const productPlatform = device.kind === "device" ? "iphoneos" : "iphonesimulator";
|
|
9816
|
+
const destination = device.kind === "device" ? `id=${device.xcodebuildId ?? device.id}` : `platform=iOS Simulator,id=${device.id}`;
|
|
9817
|
+
return {
|
|
9818
|
+
configuration,
|
|
9819
|
+
derivedDataPath,
|
|
9820
|
+
appPath: path38.join(derivedDataPath, "Build/Products", `${configuration}-${productPlatform}`, "App.app"),
|
|
9821
|
+
xcodebuildArgs: [
|
|
9822
|
+
"-project",
|
|
9823
|
+
"App.xcodeproj",
|
|
9824
|
+
"-scheme",
|
|
9825
|
+
scheme,
|
|
9826
|
+
"-configuration",
|
|
9827
|
+
configuration,
|
|
9828
|
+
"-destination",
|
|
9829
|
+
destination,
|
|
9830
|
+
"-derivedDataPath",
|
|
9831
|
+
derivedDataPath,
|
|
9832
|
+
"build"
|
|
9833
|
+
]
|
|
9834
|
+
};
|
|
9835
|
+
}
|
|
9836
|
+
function classifyIosRunFailure(log) {
|
|
9837
|
+
const lower = log.toLowerCase();
|
|
9838
|
+
if (lower.includes("unknown argument: '-index-store-path'") || lower.includes("compiler was not recognized")) {
|
|
9839
|
+
return {
|
|
9840
|
+
kind: "compiler-toolchain",
|
|
9841
|
+
title: "iOS build is using a non-Xcode compiler from the shell environment.",
|
|
9842
|
+
detail: "Akan removes common Conda/compiler environment variables for native iOS runs. If this persists, run outside the activated toolchain environment."
|
|
9843
|
+
};
|
|
9844
|
+
}
|
|
9845
|
+
if (lower.includes("developer mode") && lower.includes("disabled")) {
|
|
9846
|
+
return {
|
|
9847
|
+
kind: "device-state",
|
|
9848
|
+
title: "iOS device Developer Mode is disabled.",
|
|
9849
|
+
detail: "Enable Developer Mode on the iPhone, then reconnect and run the command again."
|
|
9850
|
+
};
|
|
9851
|
+
}
|
|
9852
|
+
if (lower.includes("untrusted") || lower.includes("not paired") || lower.includes("locked")) {
|
|
9853
|
+
return {
|
|
9854
|
+
kind: "device-state",
|
|
9855
|
+
title: "iOS device is not ready for installation.",
|
|
9856
|
+
detail: "Unlock the iPhone, trust this computer, and make sure the device is paired before retrying."
|
|
9857
|
+
};
|
|
9858
|
+
}
|
|
9859
|
+
if (lower.includes('unable to find utility "devicectl"') || lower.includes("devicectl") && lower.includes("not found")) {
|
|
9860
|
+
return {
|
|
9861
|
+
kind: "devicectl-unavailable",
|
|
9862
|
+
title: "Xcode devicectl is not available.",
|
|
9863
|
+
detail: "Install a recent Xcode version and verify xcode-select points to that Xcode installation."
|
|
9864
|
+
};
|
|
9865
|
+
}
|
|
9866
|
+
if (lower.includes("there are no accounts registered with xcode") || lower.includes("unable to log in with account")) {
|
|
9867
|
+
return {
|
|
9868
|
+
kind: "apple-account",
|
|
9869
|
+
title: "Xcode Apple ID is not available.",
|
|
9870
|
+
detail: "Sign in to an Apple ID in Xcode Settings > Accounts, then retry the Akan iOS command."
|
|
9871
|
+
};
|
|
9872
|
+
}
|
|
9873
|
+
if (lower.includes("failed registering bundle identifier") || lower.includes("cannot be registered to your development team")) {
|
|
9874
|
+
return {
|
|
9875
|
+
kind: "bundle-identifier",
|
|
9876
|
+
title: "iOS bundle identifier is not available for this Apple Developer Team.",
|
|
9877
|
+
detail: "Change mobile appId to a globally unique bundle identifier that your team can register, then rerun the iOS command."
|
|
9878
|
+
};
|
|
9879
|
+
}
|
|
9880
|
+
if (lower.includes("does not have permission") || lower.includes("your account") && lower.includes("permission")) {
|
|
9881
|
+
return {
|
|
9882
|
+
kind: "team-permission",
|
|
9883
|
+
title: "Apple Developer Team permission is missing.",
|
|
9884
|
+
detail: "Check that the signed-in Apple ID has permission for the selected DEVELOPMENT_TEAM."
|
|
9885
|
+
};
|
|
9886
|
+
}
|
|
9887
|
+
if (lower.includes("license agreement") || lower.includes("program license agreement")) {
|
|
9888
|
+
return {
|
|
9889
|
+
kind: "license-agreement",
|
|
9890
|
+
title: "Apple Developer Program license agreement is not accepted.",
|
|
9891
|
+
detail: "Accept the latest Apple Developer Program license agreement, then retry."
|
|
9892
|
+
};
|
|
9893
|
+
}
|
|
9894
|
+
if (lower.includes("no signing certificate") || lower.includes("doesn't include signing certificate")) {
|
|
9895
|
+
return {
|
|
9896
|
+
kind: "certificate",
|
|
9897
|
+
title: "iOS development signing certificate is missing.",
|
|
9898
|
+
detail: "Create or download an Apple Development certificate for the selected team."
|
|
9899
|
+
};
|
|
9900
|
+
}
|
|
9901
|
+
if (lower.includes("device") && lower.includes("not") && lower.includes("registered")) {
|
|
9902
|
+
return {
|
|
9903
|
+
kind: "device-registration",
|
|
9904
|
+
title: "iPhone is not registered in the provisioning profile.",
|
|
9905
|
+
detail: "Allow provisioning updates with a team that can register this device, or register the device manually."
|
|
9906
|
+
};
|
|
9907
|
+
}
|
|
9908
|
+
if (lower.includes("no profiles for") || lower.includes("requires a provisioning profile")) {
|
|
9909
|
+
return {
|
|
9910
|
+
kind: "provisioning-profile",
|
|
9911
|
+
title: "Matching iOS provisioning profile was not found.",
|
|
9912
|
+
detail: "Akan can request Xcode provisioning updates for physical devices, but the Apple account and team must be valid."
|
|
9913
|
+
};
|
|
9914
|
+
}
|
|
9915
|
+
return {
|
|
9916
|
+
kind: "unknown",
|
|
9917
|
+
title: "iOS native run failed.",
|
|
9918
|
+
detail: "Review the xcodebuild/devicectl output above. You can retry with --noAllowProvisioningUpdates to use the conservative path."
|
|
9919
|
+
};
|
|
9920
|
+
}
|
|
9921
|
+
function formatIosRunFailureMessage(input2) {
|
|
9922
|
+
return [
|
|
9923
|
+
input2.classification.title,
|
|
9924
|
+
input2.classification.detail,
|
|
9925
|
+
`Mobile target: ${input2.targetName}`,
|
|
9926
|
+
`Bundle ID: ${input2.appId}`,
|
|
9927
|
+
input2.teamId ? `Development Team: ${input2.teamId}` : null,
|
|
9928
|
+
"Capacitor is still used for native project generation and sync; Akan only runs the native build/install step directly."
|
|
9929
|
+
].filter((line) => Boolean(line)).join(`
|
|
9930
|
+
`);
|
|
9931
|
+
}
|
|
9932
|
+
function sanitizeIosNativeRunEnv(env) {
|
|
9933
|
+
return Object.fromEntries(Object.entries(env).filter(([key]) => !iosNativeBlockedEnvKeys.has(key)));
|
|
9934
|
+
}
|
|
9935
|
+
var androidReleaseSigningKeys = [
|
|
9936
|
+
"MYAPP_RELEASE_STORE_FILE",
|
|
9937
|
+
"MYAPP_RELEASE_STORE_PASSWORD",
|
|
9938
|
+
"MYAPP_RELEASE_KEY_ALIAS",
|
|
9939
|
+
"MYAPP_RELEASE_KEY_PASSWORD"
|
|
9940
|
+
];
|
|
9941
|
+
function getMissingAndroidReleaseSigningKeys({
|
|
9942
|
+
env = process.env,
|
|
9943
|
+
gradleProperties = ""
|
|
9944
|
+
} = {}) {
|
|
9945
|
+
return androidReleaseSigningKeys.filter((key) => {
|
|
9946
|
+
const gradleEnvKey = `ORG_GRADLE_PROJECT_${key}`;
|
|
9947
|
+
return env[key] === undefined && env[gradleEnvKey] === undefined && !new RegExp(`^\\s*${key}\\s*=`, "m").test(gradleProperties);
|
|
9948
|
+
});
|
|
9949
|
+
}
|
|
9950
|
+
function formatAndroidReleaseSigningError(missingKeys) {
|
|
9951
|
+
return [
|
|
9952
|
+
"Android release signing configuration is incomplete.",
|
|
9953
|
+
`Missing: ${missingKeys.join(", ")}`,
|
|
9954
|
+
"Set these values in android/gradle.properties or ORG_GRADLE_PROJECT_* environment variables before building a release artifact."
|
|
9955
|
+
].join(`
|
|
9956
|
+
`);
|
|
9957
|
+
}
|
|
9958
|
+
function getAdbDeviceStateIssues(output) {
|
|
9959
|
+
return output.split(/\r?\n/).map((line) => line.trim().split(/\s+/)).filter(([id, state]) => id && state && id !== "List").flatMap(([id, state]) => {
|
|
9960
|
+
if (state === "unauthorized")
|
|
9961
|
+
return [`Android device ${id} is unauthorized. Confirm USB debugging authorization on the device.`];
|
|
9962
|
+
if (state === "offline")
|
|
9963
|
+
return [`Android device ${id} is offline. Reconnect the device or restart adb.`];
|
|
9964
|
+
return [];
|
|
9965
|
+
});
|
|
9966
|
+
}
|
|
9967
|
+
var mergeAllowNavigation = (configured, localIp) => {
|
|
9968
|
+
const values = Array.isArray(configured) ? configured.filter((value) => typeof value === "string") : [];
|
|
9969
|
+
if (localIp)
|
|
9970
|
+
values.push(localIp);
|
|
9971
|
+
values.push("localhost");
|
|
9972
|
+
return [...new Set(values)];
|
|
9973
|
+
};
|
|
9974
|
+
function assertJsonSerializable(value, label = "capacitor.config", seen = new WeakSet) {
|
|
9975
|
+
if (value === null)
|
|
9976
|
+
return;
|
|
9977
|
+
const valueType = typeof value;
|
|
9978
|
+
if (valueType === "function" || valueType === "symbol" || valueType === "bigint" || valueType === "undefined") {
|
|
9979
|
+
throw new Error(`${label} must be JSON serializable. Found ${valueType}.`);
|
|
9980
|
+
}
|
|
9981
|
+
if (valueType === "number" && !Number.isFinite(value)) {
|
|
9982
|
+
throw new Error(`${label} must be JSON serializable. Found non-finite number.`);
|
|
9983
|
+
}
|
|
9984
|
+
if (valueType !== "object")
|
|
9985
|
+
return;
|
|
9986
|
+
const objectValue = value;
|
|
9987
|
+
if (seen.has(objectValue))
|
|
9988
|
+
throw new Error(`${label} must be JSON serializable. Found circular reference.`);
|
|
9989
|
+
seen.add(objectValue);
|
|
9990
|
+
if (Array.isArray(value)) {
|
|
9991
|
+
value.forEach((item, index) => {
|
|
9992
|
+
assertJsonSerializable(item, `${label}[${index}]`, seen);
|
|
9993
|
+
});
|
|
9994
|
+
return;
|
|
9995
|
+
}
|
|
9996
|
+
for (const [key, item] of Object.entries(value)) {
|
|
9997
|
+
assertJsonSerializable(item, `${label}.${key}`, seen);
|
|
9998
|
+
}
|
|
9999
|
+
}
|
|
10000
|
+
function materializeCapacitorConfig(target, { operation, localServerUrl, localIp }) {
|
|
10001
|
+
const {
|
|
10002
|
+
name,
|
|
10003
|
+
basePath: _basePath,
|
|
10004
|
+
version: _version,
|
|
10005
|
+
buildNum: _buildNum,
|
|
10006
|
+
assets: _assets,
|
|
10007
|
+
permissions: _permissions,
|
|
10008
|
+
links: _links,
|
|
10009
|
+
files: _files,
|
|
10010
|
+
appId,
|
|
10011
|
+
appName,
|
|
10012
|
+
webDir: _webDir,
|
|
10013
|
+
plugins,
|
|
10014
|
+
server,
|
|
10015
|
+
android,
|
|
10016
|
+
ios,
|
|
10017
|
+
cordova,
|
|
10018
|
+
experimental,
|
|
10019
|
+
...capacitorConfig
|
|
10020
|
+
} = target;
|
|
10021
|
+
const serverConfig = isRecord(server) ? server : undefined;
|
|
10022
|
+
const cordovaConfig = isRecord(cordova) ? cordova : undefined;
|
|
10023
|
+
const experimentalConfig = isRecord(experimental) ? experimental : undefined;
|
|
10024
|
+
const pluginsConfig = isRecord(plugins) ? plugins : {};
|
|
10025
|
+
const keyboardPluginConfig = isRecord(pluginsConfig.Keyboard) ? pluginsConfig.Keyboard : {};
|
|
10026
|
+
const config = {
|
|
10027
|
+
...capacitorConfig,
|
|
10028
|
+
appId,
|
|
10029
|
+
appName,
|
|
10030
|
+
webDir: path38.posix.join(".akan", "mobile", name, "www"),
|
|
10031
|
+
plugins: {
|
|
10032
|
+
CapacitorCookies: { enabled: true },
|
|
10033
|
+
...pluginsConfig,
|
|
10034
|
+
Keyboard: {
|
|
10035
|
+
resize: "none",
|
|
10036
|
+
...keyboardPluginConfig
|
|
10037
|
+
}
|
|
10038
|
+
},
|
|
10039
|
+
android: {
|
|
10040
|
+
...isRecord(android) ? android : {},
|
|
10041
|
+
path: "android"
|
|
10042
|
+
},
|
|
10043
|
+
ios: {
|
|
10044
|
+
...isRecord(ios) ? ios : {},
|
|
10045
|
+
path: "ios"
|
|
10046
|
+
}
|
|
10047
|
+
};
|
|
10048
|
+
if (operation === "local") {
|
|
10049
|
+
if (!localServerUrl)
|
|
10050
|
+
throw new Error(`Local server URL is required for mobile target '${name}'.`);
|
|
10051
|
+
config.server = {
|
|
10052
|
+
...serverConfig,
|
|
10053
|
+
androidScheme: "http",
|
|
10054
|
+
url: localServerUrl,
|
|
10055
|
+
cleartext: true,
|
|
10056
|
+
allowNavigation: mergeAllowNavigation(serverConfig?.allowNavigation, localIp)
|
|
10057
|
+
};
|
|
10058
|
+
} else if (serverConfig && Object.keys(serverConfig).length > 0) {
|
|
10059
|
+
config.server = serverConfig;
|
|
10060
|
+
}
|
|
10061
|
+
if (cordovaConfig && Object.keys(cordovaConfig).length > 0) {
|
|
10062
|
+
config.cordova = cordovaConfig;
|
|
10063
|
+
}
|
|
10064
|
+
if (experimentalConfig && Object.keys(experimentalConfig).length > 0) {
|
|
10065
|
+
config.experimental = experimentalConfig;
|
|
10066
|
+
}
|
|
10067
|
+
assertJsonSerializable(config);
|
|
10068
|
+
return config;
|
|
10069
|
+
}
|
|
10070
|
+
|
|
9664
10071
|
class CapacitorApp {
|
|
9665
10072
|
app;
|
|
9666
10073
|
target;
|
|
@@ -9693,7 +10100,6 @@ class CapacitorApp {
|
|
|
9693
10100
|
regenerate = false
|
|
9694
10101
|
} = {}) {
|
|
9695
10102
|
await mkdir11(this.targetRoot, { recursive: true });
|
|
9696
|
-
await this.#writeCapacitorConfig();
|
|
9697
10103
|
if (regenerate) {
|
|
9698
10104
|
if (!platform || platform === "ios")
|
|
9699
10105
|
await rm5(path38.join(this.app.cwdPath, this.iosRootPath), { recursive: true, force: true });
|
|
@@ -9741,12 +10147,122 @@ class CapacitorApp {
|
|
|
9741
10147
|
async openIos() {
|
|
9742
10148
|
await this.#spawnMobile("npx", ["cap", "open", "ios"], { operation: "local", env: "local" });
|
|
9743
10149
|
}
|
|
9744
|
-
async runIos({ operation, env, regenerate = false }) {
|
|
10150
|
+
async runIos({ operation, env, regenerate = false, noAllowProvisioningUpdates = false, iosDeviceId }) {
|
|
9745
10151
|
if (operation === "release")
|
|
9746
10152
|
await this.prepareWww();
|
|
9747
10153
|
await this.#prepareIos({ operation, env, regenerate });
|
|
9748
|
-
const
|
|
9749
|
-
|
|
10154
|
+
const runTarget = await this.#selectIosRunTarget(iosDeviceId);
|
|
10155
|
+
if (runTarget.kind === "simulator") {
|
|
10156
|
+
await this.#spawnMobile("npx", ["cap", "run", "ios", "--target", runTarget.id], { operation, env }, { stdio: "inherit" });
|
|
10157
|
+
return;
|
|
10158
|
+
}
|
|
10159
|
+
await this.#runIosPhysicalDevice({ operation, env, runTarget, noAllowProvisioningUpdates });
|
|
10160
|
+
}
|
|
10161
|
+
async#selectIosRunTarget(deviceId) {
|
|
10162
|
+
const targets = await this.#loadIosRunTargets();
|
|
10163
|
+
if (deviceId) {
|
|
10164
|
+
const found = targets.find((target) => target.id === deviceId);
|
|
10165
|
+
if (!found)
|
|
10166
|
+
throw new Error(`iOS run target '${deviceId}' was not found.`);
|
|
10167
|
+
return found;
|
|
10168
|
+
}
|
|
10169
|
+
if (targets.length === 0) {
|
|
10170
|
+
throw new Error("No iOS run targets found. Open Simulator or connect an iPhone, then retry.");
|
|
10171
|
+
}
|
|
10172
|
+
return await select2({
|
|
10173
|
+
message: "Select iOS run target",
|
|
10174
|
+
choices: targets.map((target) => ({
|
|
10175
|
+
name: `[${target.kind}] ${target.name}${target.state ? ` (${target.state})` : ""}`,
|
|
10176
|
+
value: target
|
|
10177
|
+
}))
|
|
10178
|
+
});
|
|
10179
|
+
}
|
|
10180
|
+
async#loadIosRunTargets() {
|
|
10181
|
+
const devices = await this.#loadPhysicalIosDevices();
|
|
10182
|
+
const simulators = await this.#loadIosSimulators();
|
|
10183
|
+
return [...devices, ...simulators];
|
|
10184
|
+
}
|
|
10185
|
+
async#loadPhysicalIosDevices() {
|
|
10186
|
+
try {
|
|
10187
|
+
return parseDevicectlDevices(await this.#spawn("xcrun", ["devicectl", "list", "devices", "--json-output", "-"]));
|
|
10188
|
+
} catch (jsonError) {
|
|
10189
|
+
try {
|
|
10190
|
+
return parseDevicectlDevices(await this.#spawn("xcrun", ["devicectl", "list", "devices"]));
|
|
10191
|
+
} catch (textError) {
|
|
10192
|
+
const classification = classifyIosRunFailure(`${jsonError instanceof Error ? jsonError.message : ""}
|
|
10193
|
+
${textError instanceof Error ? textError.message : ""}`);
|
|
10194
|
+
if (classification.kind === "devicectl-unavailable")
|
|
10195
|
+
this.app.logger.warn(classification.detail);
|
|
10196
|
+
return [];
|
|
10197
|
+
}
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
async#loadIosSimulators() {
|
|
10201
|
+
try {
|
|
10202
|
+
return parseSimctlDevices(await this.#spawn("xcrun", ["simctl", "list", "devices", "available", "--json"]));
|
|
10203
|
+
} catch {
|
|
10204
|
+
try {
|
|
10205
|
+
return parseSimctlDevices(await this.#spawn("xcrun", ["simctl", "list", "devices", "available"]));
|
|
10206
|
+
} catch {
|
|
10207
|
+
return [];
|
|
10208
|
+
}
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
async#runIosPhysicalDevice({
|
|
10212
|
+
operation,
|
|
10213
|
+
env,
|
|
10214
|
+
runTarget,
|
|
10215
|
+
noAllowProvisioningUpdates
|
|
10216
|
+
}) {
|
|
10217
|
+
const mobileEnv = sanitizeIosNativeRunEnv(await this.#commandEnv(operation, env));
|
|
10218
|
+
const configContent = await this.#writeCapacitorConfig({ operation }, mobileEnv);
|
|
10219
|
+
await this.#writeRootCapacitorConfig(configContent);
|
|
10220
|
+
const scheme = this.#iosScheme();
|
|
10221
|
+
const command = buildIosNativeRunCommand({
|
|
10222
|
+
appRoot: this.app.cwdPath,
|
|
10223
|
+
device: runTarget,
|
|
10224
|
+
scheme,
|
|
10225
|
+
configuration: operation === "release" ? "Release" : "Debug"
|
|
10226
|
+
});
|
|
10227
|
+
const xcodebuildArgs = noAllowProvisioningUpdates ? command.xcodebuildArgs : [...command.xcodebuildArgs.slice(0, -1), "-allowProvisioningUpdates", ...command.xcodebuildArgs.slice(-1)];
|
|
10228
|
+
try {
|
|
10229
|
+
await this.#spawn("xcodebuild", xcodebuildArgs, {
|
|
10230
|
+
cwd: path38.join(this.app.cwdPath, this.iosProjectPath),
|
|
10231
|
+
env: mobileEnv
|
|
10232
|
+
});
|
|
10233
|
+
const devicectlId = runTarget.devicectlId ?? runTarget.id;
|
|
10234
|
+
await this.#spawn("xcrun", ["devicectl", "device", "install", "app", "--device", devicectlId, command.appPath], {
|
|
10235
|
+
env: mobileEnv
|
|
10236
|
+
});
|
|
10237
|
+
await this.#spawn("xcrun", ["devicectl", "device", "process", "launch", "--device", devicectlId, this.target.appId], {
|
|
10238
|
+
env: mobileEnv
|
|
10239
|
+
});
|
|
10240
|
+
} catch (error) {
|
|
10241
|
+
throw new Error(formatIosRunFailureMessage({
|
|
10242
|
+
classification: classifyIosRunFailure(this.#errorOutput(error)),
|
|
10243
|
+
appId: this.target.appId,
|
|
10244
|
+
targetName: this.target.name,
|
|
10245
|
+
teamId: await this.#getIosDevelopmentTeam()
|
|
10246
|
+
}));
|
|
10247
|
+
} finally {
|
|
10248
|
+
await this.#clearRootCapacitorConfigs();
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
#iosScheme() {
|
|
10252
|
+
return isRecord(this.target.ios) && typeof this.target.ios.scheme === "string" ? this.target.ios.scheme : "App";
|
|
10253
|
+
}
|
|
10254
|
+
async#getIosDevelopmentTeam() {
|
|
10255
|
+
const pbxprojPath = path38.join(this.app.cwdPath, this.iosProjectPath, "App.xcodeproj/project.pbxproj");
|
|
10256
|
+
if (!await Bun.file(pbxprojPath).exists())
|
|
10257
|
+
return;
|
|
10258
|
+
return (await Bun.file(pbxprojPath).text()).match(/DEVELOPMENT_TEAM = ([^;]+);/)?.[1]?.trim();
|
|
10259
|
+
}
|
|
10260
|
+
#errorOutput(error) {
|
|
10261
|
+
if (error instanceof CommandExecutionError)
|
|
10262
|
+
return `${error.stdout}
|
|
10263
|
+
${error.stderr}
|
|
10264
|
+
${error.message}`;
|
|
10265
|
+
return error instanceof Error ? error.message : String(error);
|
|
9750
10266
|
}
|
|
9751
10267
|
async#prepareAndroid({ operation, env, regenerate = false }) {
|
|
9752
10268
|
await this.init({ platform: "android", operation, env, regenerate });
|
|
@@ -9800,6 +10316,7 @@ class CapacitorApp {
|
|
|
9800
10316
|
async buildAndroid(assembleType, { env = "debug", regenerate = false } = {}) {
|
|
9801
10317
|
await this.prepareWww();
|
|
9802
10318
|
await this.#prepareAndroid({ operation: "release", env, regenerate });
|
|
10319
|
+
await this.#assertAndroidReleaseSigningConfig();
|
|
9803
10320
|
await this.#updateAndroidBuildTypes();
|
|
9804
10321
|
const isWindows = process.platform === "win32";
|
|
9805
10322
|
const gradleCommand = isWindows ? "gradlew.bat" : "./gradlew";
|
|
@@ -9849,10 +10366,30 @@ class CapacitorApp {
|
|
|
9849
10366
|
if (operation === "release")
|
|
9850
10367
|
await this.prepareWww();
|
|
9851
10368
|
await this.#prepareAndroid({ operation, env, regenerate });
|
|
10369
|
+
await this.#assertAndroidAdbReady();
|
|
9852
10370
|
this.app.logger.info(`Running Android in ${operation} mode on ${env} env`);
|
|
9853
10371
|
const args = ["cap", "run", "android"];
|
|
9854
10372
|
await this.#spawnMobile("npx", args, { operation, env }, { stdio: "inherit" });
|
|
9855
10373
|
}
|
|
10374
|
+
async#assertAndroidReleaseSigningConfig() {
|
|
10375
|
+
const gradlePropertiesPath = path38.join(this.app.cwdPath, this.androidRootPath, "gradle.properties");
|
|
10376
|
+
const gradleProperties = await Bun.file(gradlePropertiesPath).exists() ? await Bun.file(gradlePropertiesPath).text() : "";
|
|
10377
|
+
const missingKeys = getMissingAndroidReleaseSigningKeys({ gradleProperties });
|
|
10378
|
+
if (missingKeys.length > 0)
|
|
10379
|
+
throw new Error(formatAndroidReleaseSigningError(missingKeys));
|
|
10380
|
+
}
|
|
10381
|
+
async#assertAndroidAdbReady() {
|
|
10382
|
+
try {
|
|
10383
|
+
const issues = getAdbDeviceStateIssues(await this.#spawn("adb", ["devices"]));
|
|
10384
|
+
if (issues.length > 0)
|
|
10385
|
+
throw new Error(issues.join(`
|
|
10386
|
+
`));
|
|
10387
|
+
} catch (error) {
|
|
10388
|
+
if (error instanceof CommandExecutionError)
|
|
10389
|
+
return;
|
|
10390
|
+
throw error;
|
|
10391
|
+
}
|
|
10392
|
+
}
|
|
9856
10393
|
async releaseIos() {
|
|
9857
10394
|
await this.prepareWww();
|
|
9858
10395
|
await this.#prepareIos({ operation: "release", env: "main" });
|
|
@@ -9877,30 +10414,18 @@ class CapacitorApp {
|
|
|
9877
10414
|
return html.replace(/<\/head\s*>/i, `${script}
|
|
9878
10415
|
</head>`);
|
|
9879
10416
|
}
|
|
9880
|
-
async#writeCapacitorConfig() {
|
|
10417
|
+
async#writeCapacitorConfig({ operation }, commandEnv) {
|
|
9881
10418
|
await mkdir11(this.targetRoot, { recursive: true });
|
|
9882
|
-
const
|
|
9883
|
-
const
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
...config,
|
|
9890
|
-
webDir: \`.akan/mobile/\${target.name}/www\`,
|
|
9891
|
-
android: {
|
|
9892
|
-
...config.android,
|
|
9893
|
-
path: "android",
|
|
9894
|
-
},
|
|
9895
|
-
ios: {
|
|
9896
|
-
...config.ios,
|
|
9897
|
-
path: "ios",
|
|
9898
|
-
},
|
|
9899
|
-
}),
|
|
9900
|
-
appInfo as AppScanResult,
|
|
9901
|
-
);
|
|
10419
|
+
const localIp = operation === "local" ? getLocalIP() : undefined;
|
|
10420
|
+
const config = materializeCapacitorConfig(this.target, {
|
|
10421
|
+
operation,
|
|
10422
|
+
localIp,
|
|
10423
|
+
localServerUrl: localIp ? this.#localCsrUrl(localIp, commandEnv) : undefined
|
|
10424
|
+
});
|
|
10425
|
+
const content = `${JSON.stringify(config, null, 2)}
|
|
9902
10426
|
`;
|
|
9903
|
-
await Bun.write(path38.join(this.
|
|
10427
|
+
await Bun.write(path38.join(this.targetRoot, "capacitor.config.json"), content);
|
|
10428
|
+
return content;
|
|
9904
10429
|
}
|
|
9905
10430
|
async#prepareTargetAssets() {
|
|
9906
10431
|
if (!this.target.assets)
|
|
@@ -9997,14 +10522,37 @@ export default withBase(
|
|
|
9997
10522
|
...devPort ? { PORT: devPort, AKAN_PUBLIC_CLIENT_PORT: devPort, AKAN_PUBLIC_SERVER_PORT: devPort } : {}
|
|
9998
10523
|
});
|
|
9999
10524
|
}
|
|
10525
|
+
#localCsrUrl(ip, commandEnv) {
|
|
10526
|
+
const basePath2 = this.target.basePath?.replace(/^\/+|\/+$/g, "");
|
|
10527
|
+
const locale = commandEnv.AKAN_PUBLIC_DEFAULT_LOCALE ?? "en";
|
|
10528
|
+
const pathname = basePath2 ? `${locale}/${basePath2}` : `${locale}/`;
|
|
10529
|
+
const port = commandEnv.AKAN_PUBLIC_CLIENT_PORT ?? commandEnv.PORT ?? "8282";
|
|
10530
|
+
const params = new URLSearchParams({ csr: "true", akanMobileTarget: this.target.name });
|
|
10531
|
+
if (basePath2)
|
|
10532
|
+
params.set("akanMobileBasePath", basePath2);
|
|
10533
|
+
return `http://${ip}:${port}/${pathname}?${params}`;
|
|
10534
|
+
}
|
|
10535
|
+
async#clearRootCapacitorConfigs() {
|
|
10536
|
+
await clearRootCapacitorConfigs(this.app.cwdPath);
|
|
10537
|
+
}
|
|
10538
|
+
async#writeRootCapacitorConfig(content) {
|
|
10539
|
+
await writeRootCapacitorConfig(this.app.cwdPath, content);
|
|
10540
|
+
}
|
|
10000
10541
|
async#spawn(command, args = [], options = {}) {
|
|
10001
10542
|
return await this.app.spawn(command, args, { cwd: this.app.cwdPath, ...options });
|
|
10002
10543
|
}
|
|
10003
10544
|
async#spawnMobile(command, args = [], { operation, env }, options = {}) {
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10545
|
+
const mobileEnv = { ...await this.#commandEnv(operation, env), ...options.env };
|
|
10546
|
+
const configContent = await this.#writeCapacitorConfig({ operation }, mobileEnv);
|
|
10547
|
+
await this.#writeRootCapacitorConfig(configContent);
|
|
10548
|
+
try {
|
|
10549
|
+
return await this.#spawn(command, args, {
|
|
10550
|
+
...options,
|
|
10551
|
+
env: mobileEnv
|
|
10552
|
+
});
|
|
10553
|
+
} finally {
|
|
10554
|
+
await this.#clearRootCapacitorConfigs();
|
|
10555
|
+
}
|
|
10008
10556
|
}
|
|
10009
10557
|
async addCamera() {
|
|
10010
10558
|
await this.#setPermissionInIos({
|
|
@@ -10121,7 +10669,7 @@ var Module = createInternalArgToken("Module");
|
|
|
10121
10669
|
var Workspace = createInternalArgToken("Workspace");
|
|
10122
10670
|
// pkgs/@akanjs/devkit/commandDecorators/command.ts
|
|
10123
10671
|
import path39 from "path";
|
|
10124
|
-
import { confirm, input as input2, select as
|
|
10672
|
+
import { confirm, input as input2, select as select3 } from "@inquirer/prompts";
|
|
10125
10673
|
import { Logger as Logger10 } from "akanjs/common";
|
|
10126
10674
|
import chalk6 from "chalk";
|
|
10127
10675
|
import { program } from "commander";
|
|
@@ -10457,7 +11005,7 @@ var getOptionValue = async (argMeta, opt, context) => {
|
|
|
10457
11005
|
return defaultValue;
|
|
10458
11006
|
if (enumChoices) {
|
|
10459
11007
|
const choices = normalizeEnumChoices(await resolveEnumChoices(argMeta, context) ?? []);
|
|
10460
|
-
const choice = await
|
|
11008
|
+
const choice = await select3({ message: ask ?? desc ?? `Select the ${name} value`, choices });
|
|
10461
11009
|
return choice;
|
|
10462
11010
|
} else if (nullable)
|
|
10463
11011
|
return null;
|
|
@@ -10529,7 +11077,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
10529
11077
|
else if (value && libNames.includes(value))
|
|
10530
11078
|
return LibExecutor.from(workspace, value);
|
|
10531
11079
|
else {
|
|
10532
|
-
const sysName = await
|
|
11080
|
+
const sysName = await select3({
|
|
10533
11081
|
message: `Select the App or Lib name`,
|
|
10534
11082
|
choices: [...appNames, ...libNames]
|
|
10535
11083
|
});
|
|
@@ -10548,7 +11096,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
10548
11096
|
else if (value && pkgNames.includes(value))
|
|
10549
11097
|
return PkgExecutor.from(workspace, value);
|
|
10550
11098
|
else {
|
|
10551
|
-
const execName = await
|
|
11099
|
+
const execName = await select3({
|
|
10552
11100
|
message: `Select the App or Lib or Pkg name`,
|
|
10553
11101
|
choices: [...appNames, ...libNames, ...pkgNames]
|
|
10554
11102
|
});
|
|
@@ -10564,18 +11112,18 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
10564
11112
|
} else if (sysType === "app") {
|
|
10565
11113
|
if (value && appNames.includes(value))
|
|
10566
11114
|
return AppExecutor.from(workspace, value);
|
|
10567
|
-
const appName = await
|
|
11115
|
+
const appName = await select3({ message: `Select the ${sysType} name`, choices: appNames });
|
|
10568
11116
|
return AppExecutor.from(workspace, appName);
|
|
10569
11117
|
} else if (sysType === "lib") {
|
|
10570
11118
|
if (value && libNames.includes(value))
|
|
10571
11119
|
return LibExecutor.from(workspace, value);
|
|
10572
|
-
const libName = await
|
|
11120
|
+
const libName = await select3({ message: `Select the ${sysType} name`, choices: libNames });
|
|
10573
11121
|
return LibExecutor.from(workspace, libName);
|
|
10574
11122
|
} else if (sysType === "pkg") {
|
|
10575
11123
|
const pkgs = await workspace.getPkgs();
|
|
10576
11124
|
if (value && pkgs.includes(value))
|
|
10577
11125
|
return PkgExecutor.from(workspace, value);
|
|
10578
|
-
const pkgName = await
|
|
11126
|
+
const pkgName = await select3({ message: `Select the ${sysType} name`, choices: pkgs });
|
|
10579
11127
|
return PkgExecutor.from(workspace, pkgName);
|
|
10580
11128
|
} else if (sysType === "module") {
|
|
10581
11129
|
if (value) {
|
|
@@ -10597,7 +11145,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
10597
11145
|
} else
|
|
10598
11146
|
throw new Error(`Invalid system name: ${sysName}`);
|
|
10599
11147
|
}
|
|
10600
|
-
const { type, name } = await
|
|
11148
|
+
const { type, name } = await select3({
|
|
10601
11149
|
message: `select the App or Lib name`,
|
|
10602
11150
|
choices: [
|
|
10603
11151
|
...appNames.map((name2) => ({ name: name2, value: { type: "app", name: name2 } })),
|
|
@@ -10606,7 +11154,7 @@ var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
|
10606
11154
|
});
|
|
10607
11155
|
const executor = type === "app" ? AppExecutor.from(workspace, name) : LibExecutor.from(workspace, name);
|
|
10608
11156
|
const modules = await executor.getModules();
|
|
10609
|
-
const moduleName = await
|
|
11157
|
+
const moduleName = await select3({
|
|
10610
11158
|
message: `Select the module name`,
|
|
10611
11159
|
choices: modules.map((name2) => ({ name: `${executor.name}:${name2}`, value: name2 }))
|
|
10612
11160
|
});
|
|
@@ -11044,7 +11592,7 @@ var getRelatedCnsts = (constantFilePath) => {
|
|
|
11044
11592
|
};
|
|
11045
11593
|
// pkgs/@akanjs/devkit/prompter.ts
|
|
11046
11594
|
import fsPromise from "fs/promises";
|
|
11047
|
-
import { input as input3, select as
|
|
11595
|
+
import { input as input3, select as select4 } from "@inquirer/prompts";
|
|
11048
11596
|
class Prompter {
|
|
11049
11597
|
static async#getGuidelineRoot() {
|
|
11050
11598
|
const dirname2 = getDirname(import.meta.url);
|
|
@@ -11060,7 +11608,7 @@ class Prompter {
|
|
|
11060
11608
|
static async selectGuideline() {
|
|
11061
11609
|
const guidelineRoot = await Prompter.#getGuidelineRoot();
|
|
11062
11610
|
const guideNames = await Prompter.listGuidelines();
|
|
11063
|
-
return await
|
|
11611
|
+
return await select4({
|
|
11064
11612
|
message: "Select a guideline",
|
|
11065
11613
|
choices: guideNames.map((name) => ({ name, value: name }))
|
|
11066
11614
|
});
|
|
@@ -11116,7 +11664,7 @@ ${document}
|
|
|
11116
11664
|
}
|
|
11117
11665
|
}
|
|
11118
11666
|
// pkgs/@akanjs/devkit/selectModel.ts
|
|
11119
|
-
import { select as
|
|
11667
|
+
import { select as select5 } from "@inquirer/prompts";
|
|
11120
11668
|
// pkgs/@akanjs/devkit/streamAi.ts
|
|
11121
11669
|
import { PromptTemplate } from "@langchain/core/prompts";
|
|
11122
11670
|
import { RunnableSequence } from "@langchain/core/runnables";
|
|
@@ -11234,7 +11782,7 @@ class AgentCommand extends command("agent", [AgentScript], ({ public: target })
|
|
|
11234
11782
|
}
|
|
11235
11783
|
|
|
11236
11784
|
// pkgs/@akanjs/cli/application/application.command.ts
|
|
11237
|
-
import { select as
|
|
11785
|
+
import { select as select7 } from "@inquirer/prompts";
|
|
11238
11786
|
|
|
11239
11787
|
// pkgs/@akanjs/cli/application/application.script.ts
|
|
11240
11788
|
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
@@ -11351,7 +11899,7 @@ class LibraryScript extends script("library", [LibraryRunner]) {
|
|
|
11351
11899
|
}
|
|
11352
11900
|
|
|
11353
11901
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
11354
|
-
import { confirm as confirm2, input as input4, select as
|
|
11902
|
+
import { confirm as confirm2, input as input4, select as select6 } from "@inquirer/prompts";
|
|
11355
11903
|
import { StringOutputParser } from "@langchain/core/output_parsers";
|
|
11356
11904
|
import { PromptTemplate as PromptTemplate2 } from "@langchain/core/prompts";
|
|
11357
11905
|
import { RunnableSequence as RunnableSequence2 } from "@langchain/core/runnables";
|
|
@@ -11392,7 +11940,7 @@ class ApplicationRunner extends runner("application") {
|
|
|
11392
11940
|
throw new Error(`No script files found. make a script file in apps/${app.name}/script folder`);
|
|
11393
11941
|
}
|
|
11394
11942
|
const scriptFiles = (await app.readdir("script")).filter((file) => file.endsWith(".ts"));
|
|
11395
|
-
const scriptFile = await
|
|
11943
|
+
const scriptFile = await select6({
|
|
11396
11944
|
message: "Select script to run",
|
|
11397
11945
|
choices: scriptFiles.map((file) => ({ name: file, value: file.replace(".ts", "") }))
|
|
11398
11946
|
});
|
|
@@ -11487,14 +12035,15 @@ try {
|
|
|
11487
12035
|
operation = "local",
|
|
11488
12036
|
env = "local",
|
|
11489
12037
|
target,
|
|
11490
|
-
regenerate = false
|
|
12038
|
+
regenerate = false,
|
|
12039
|
+
noAllowProvisioningUpdates = false
|
|
11491
12040
|
} = {}) {
|
|
11492
12041
|
const targets = await resolveMobileTargets(app, target);
|
|
11493
12042
|
if (operation === "release")
|
|
11494
12043
|
await this.#buildMobileCsr(app, env);
|
|
11495
12044
|
await this.#runMobileTargets(targets, async (mobileTarget2) => {
|
|
11496
12045
|
const capacitorApp2 = new CapacitorApp(app, mobileTarget2.config);
|
|
11497
|
-
await capacitorApp2.runIos({ operation, env, regenerate });
|
|
12046
|
+
await capacitorApp2.runIos({ operation, env, regenerate, noAllowProvisioningUpdates });
|
|
11498
12047
|
if (open)
|
|
11499
12048
|
await capacitorApp2.openIos();
|
|
11500
12049
|
});
|
|
@@ -11580,7 +12129,7 @@ try {
|
|
|
11580
12129
|
}
|
|
11581
12130
|
throw new Error(`${failures.length}/${results.length} mobile targets failed`);
|
|
11582
12131
|
}
|
|
11583
|
-
async codepush(app,
|
|
12132
|
+
async codepush(app, os2) {
|
|
11584
12133
|
const [target] = await resolveMobileTargets(app, undefined);
|
|
11585
12134
|
if (!target)
|
|
11586
12135
|
throw new Error(`No mobile target configured for ${app.name}`);
|
|
@@ -11855,7 +12404,8 @@ class ApplicationScript extends script("application", [
|
|
|
11855
12404
|
env = "local",
|
|
11856
12405
|
write = true,
|
|
11857
12406
|
target,
|
|
11858
|
-
regenerate = false
|
|
12407
|
+
regenerate = false,
|
|
12408
|
+
noAllowProvisioningUpdates = false
|
|
11859
12409
|
} = {}) {
|
|
11860
12410
|
await app.scanSync({ write });
|
|
11861
12411
|
await this.applicationRunner.startIos(app, {
|
|
@@ -11863,7 +12413,8 @@ class ApplicationScript extends script("application", [
|
|
|
11863
12413
|
operation,
|
|
11864
12414
|
env,
|
|
11865
12415
|
target,
|
|
11866
|
-
regenerate
|
|
12416
|
+
regenerate,
|
|
12417
|
+
noAllowProvisioningUpdates
|
|
11867
12418
|
});
|
|
11868
12419
|
}
|
|
11869
12420
|
async releaseIos(app, {
|
|
@@ -11926,8 +12477,8 @@ class ApplicationScript extends script("application", [
|
|
|
11926
12477
|
async releaseSource(app, options) {
|
|
11927
12478
|
await this.applicationRunner.releaseSource(app, options);
|
|
11928
12479
|
}
|
|
11929
|
-
async codepush(app,
|
|
11930
|
-
await this.applicationRunner.codepush(app,
|
|
12480
|
+
async codepush(app, os2) {
|
|
12481
|
+
await this.applicationRunner.codepush(app, os2);
|
|
11931
12482
|
}
|
|
11932
12483
|
async dbup(workspace, mode = "multiple") {
|
|
11933
12484
|
const spinner2 = workspace.spinning(`Starting local database (${mode})...`);
|
|
@@ -12013,14 +12564,18 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
12013
12564
|
enum: ["local", "debug", "develop", "main"],
|
|
12014
12565
|
desc: "backend environment",
|
|
12015
12566
|
default: "local"
|
|
12016
|
-
}).option("open", Boolean, { desc: "open ios simulator", default: false }).option("release", Boolean, { desc: "release mode", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).
|
|
12567
|
+
}).option("open", Boolean, { desc: "open ios simulator", default: false }).option("release", Boolean, { desc: "release mode", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("regenerate", Boolean, { flag: "g", desc: "delete and regenerate native project", default: false }).option("noAllowProvisioningUpdates", Boolean, {
|
|
12568
|
+
desc: "disable automatic iOS provisioning updates for physical devices",
|
|
12569
|
+
default: false
|
|
12570
|
+
}).exec(async function(app, target2, env, open, release, write, regenerate, noAllowProvisioningUpdates) {
|
|
12017
12571
|
await this.applicationScript.startIos(app, {
|
|
12018
12572
|
target: target2,
|
|
12019
12573
|
env: asMobileEnv(env),
|
|
12020
12574
|
open,
|
|
12021
12575
|
operation: release ? "release" : "local",
|
|
12022
12576
|
write,
|
|
12023
|
-
regenerate
|
|
12577
|
+
regenerate,
|
|
12578
|
+
noAllowProvisioningUpdates
|
|
12024
12579
|
});
|
|
12025
12580
|
}),
|
|
12026
12581
|
startAndroid: target({ short: true, desc: "Start Android app in emulator or device" }).with(App).option("target", String, { desc: "mobile target name or all" }).option("env", String, {
|
|
@@ -12067,14 +12622,14 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
|
|
|
12067
12622
|
await this.applicationScript.releaseSource(app, { rebuild, buildNum, environment, local });
|
|
12068
12623
|
}),
|
|
12069
12624
|
codepush: target({ desc: "Deploy over-the-air (OTA) update for mobile app" }).with(App).exec(async function(app) {
|
|
12070
|
-
const
|
|
12625
|
+
const os2 = await select7({
|
|
12071
12626
|
message: "Select os",
|
|
12072
12627
|
choices: [
|
|
12073
12628
|
{ value: "ios", name: "ios", description: "ios" },
|
|
12074
12629
|
{ value: "android", name: "android", description: "android" }
|
|
12075
12630
|
]
|
|
12076
12631
|
});
|
|
12077
|
-
await this.applicationScript.codepush(app,
|
|
12632
|
+
await this.applicationScript.codepush(app, os2);
|
|
12078
12633
|
}),
|
|
12079
12634
|
dbup: target({ desc: "Start local database services for a database mode" }).with(Workspace).option("mode", String, {
|
|
12080
12635
|
desc: "database mode",
|
|
@@ -12305,7 +12860,7 @@ class PackageScript extends script("package", [PackageRunner]) {
|
|
|
12305
12860
|
|
|
12306
12861
|
// pkgs/@akanjs/cli/cloud/cloud.runner.ts
|
|
12307
12862
|
import path41 from "path";
|
|
12308
|
-
import { confirm as confirm4, input as input5, select as
|
|
12863
|
+
import { confirm as confirm4, input as input5, select as select8 } from "@inquirer/prompts";
|
|
12309
12864
|
import { Logger as Logger15, sleep } from "akanjs/common";
|
|
12310
12865
|
import chalk7 from "chalk";
|
|
12311
12866
|
import * as QRcode from "qrcode";
|
|
@@ -12384,7 +12939,7 @@ class CloudRunner extends runner("cloud") {
|
|
|
12384
12939
|
Logger15.info("No remote env servers configured. Add the first remote server for SCP mode.");
|
|
12385
12940
|
return await this.#addRemoteEnvServer();
|
|
12386
12941
|
}
|
|
12387
|
-
const selectedName = await
|
|
12942
|
+
const selectedName = await select8({
|
|
12388
12943
|
message: "Select the remote env server",
|
|
12389
12944
|
choices: [
|
|
12390
12945
|
...serverEntries.map(([name, config2]) => ({
|
|
@@ -12407,7 +12962,7 @@ class CloudRunner extends runner("cloud") {
|
|
|
12407
12962
|
return { name: selectedName, config };
|
|
12408
12963
|
}
|
|
12409
12964
|
async#removeRemoteEnvServer(serverEntries) {
|
|
12410
|
-
const selectedName = await
|
|
12965
|
+
const selectedName = await select8({
|
|
12411
12966
|
message: "Select the remote env server to remove",
|
|
12412
12967
|
choices: serverEntries.map(([name, config]) => ({
|
|
12413
12968
|
name: `${name} (${config.username ? `${config.username}@` : ""}${config.host}${config.port ? `:${config.port}` : ""})`,
|