@capacitor/cli 5.0.0-beta.1 → 5.0.0-beta.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/assets/android-template.tar.gz +0 -0
- package/assets/capacitor-cordova-android-plugins.tar.gz +0 -0
- package/assets/capacitor-cordova-ios-plugins.tar.gz +0 -0
- package/assets/ios-template.tar.gz +0 -0
- package/dist/android/update.js +3 -3
- package/dist/common.js +1 -1
- package/dist/config.js +26 -10
- package/dist/declarations.d.ts +15 -34
- package/dist/ios/common.js +31 -2
- package/dist/ios/doctor.js +1 -1
- package/dist/ios/update.js +10 -3
- package/dist/tasks/add.js +4 -1
- package/dist/tasks/copy.js +33 -25
- package/dist/tasks/migrate.js +50 -3
- package/dist/tasks/update.js +1 -1
- package/package.json +4 -4
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/update.js
CHANGED
|
@@ -146,8 +146,8 @@ project(':${getGradlePackageName(p.id)}').projectDir = new File('${relativePlugi
|
|
|
146
146
|
|
|
147
147
|
android {
|
|
148
148
|
compileOptions {
|
|
149
|
-
sourceCompatibility JavaVersion.
|
|
150
|
-
targetCompatibility JavaVersion.
|
|
149
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
150
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -174,7 +174,7 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
174
174
|
var _a, _b, _c;
|
|
175
175
|
const pluginsGradlePath = (0, path_1.join)(config.android.cordovaPluginsDirAbs, 'build.gradle');
|
|
176
176
|
const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
|
|
177
|
-
const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.
|
|
177
|
+
const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.8.20';
|
|
178
178
|
const frameworksArray = [];
|
|
179
179
|
let prefsArray = [];
|
|
180
180
|
const applyArray = [];
|
package/dist/common.js
CHANGED
|
@@ -95,7 +95,7 @@ async function checkAppId(config, id) {
|
|
|
95
95
|
exports.checkAppId = checkAppId;
|
|
96
96
|
async function checkAppName(config, name) {
|
|
97
97
|
// We allow pretty much anything right now, have fun
|
|
98
|
-
if (!name ||
|
|
98
|
+
if (!(name === null || name === void 0 ? void 0 : name.length)) {
|
|
99
99
|
return `Must provide an app name. For example: 'Spacebook'`;
|
|
100
100
|
}
|
|
101
101
|
return null;
|
package/dist/config.js
CHANGED
|
@@ -12,6 +12,7 @@ const fn_1 = require("./util/fn");
|
|
|
12
12
|
const js_1 = require("./util/js");
|
|
13
13
|
const node_1 = require("./util/node");
|
|
14
14
|
const promise_1 = require("./util/promise");
|
|
15
|
+
const subprocess_1 = require("./util/subprocess");
|
|
15
16
|
const debug = (0, debug_1.default)('capacitor:config');
|
|
16
17
|
exports.CONFIG_FILE_NAME_TS = 'capacitor.config.ts';
|
|
17
18
|
exports.CONFIG_FILE_NAME_JS = 'capacitor.config.js';
|
|
@@ -205,7 +206,6 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
|
205
206
|
async function loadIOSConfig(rootDir, extConfig) {
|
|
206
207
|
var _a, _b, _c, _d;
|
|
207
208
|
const name = 'ios';
|
|
208
|
-
const podPath = determineCocoapodPath();
|
|
209
209
|
const platformDir = (_b = (_a = extConfig.ios) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : 'ios';
|
|
210
210
|
const platformDirAbs = (0, path_1.resolve)(rootDir, platformDir);
|
|
211
211
|
const scheme = (_d = (_c = extConfig.ios) === null || _c === void 0 ? void 0 : _c.scheme) !== null && _d !== void 0 ? _d : 'App';
|
|
@@ -216,6 +216,7 @@ async function loadIOSConfig(rootDir, extConfig) {
|
|
|
216
216
|
const nativeXcodeProjDir = `${nativeProjectDir}/App.xcodeproj`;
|
|
217
217
|
const nativeXcodeProjDirAbs = (0, path_1.resolve)(platformDirAbs, nativeXcodeProjDir);
|
|
218
218
|
const nativeXcodeWorkspaceDirAbs = (0, promise_1.lazy)(() => determineXcodeWorkspaceDirAbs(nativeProjectDirAbs));
|
|
219
|
+
const podPath = (0, promise_1.lazy)(() => determineGemfileOrCocoapodPath(rootDir, platformDirAbs, nativeProjectDirAbs));
|
|
219
220
|
const webDirAbs = (0, promise_1.lazy)(() => determineIOSWebDirAbs(nativeProjectDirAbs, nativeTargetDirAbs, nativeXcodeProjDirAbs));
|
|
220
221
|
const cordovaPluginsDir = 'capacitor-cordova-ios-plugins';
|
|
221
222
|
return {
|
|
@@ -315,11 +316,33 @@ async function determineAndroidStudioPath(os) {
|
|
|
315
316
|
}
|
|
316
317
|
return '';
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
async function determineGemfileOrCocoapodPath(rootDir, platformDir, nativeProjectDirAbs) {
|
|
319
320
|
if (process.env.CAPACITOR_COCOAPODS_PATH) {
|
|
320
321
|
return process.env.CAPACITOR_COCOAPODS_PATH;
|
|
321
322
|
}
|
|
322
|
-
|
|
323
|
+
// Look for 'Gemfile' in app directories
|
|
324
|
+
const appSpecificGemfileExists = (await (0, utils_fs_1.pathExists)((0, path_1.resolve)(rootDir, 'Gemfile'))) ||
|
|
325
|
+
(await (0, utils_fs_1.pathExists)((0, path_1.resolve)(platformDir, 'Gemfile'))) ||
|
|
326
|
+
(await (0, utils_fs_1.pathExists)((0, path_1.resolve)(nativeProjectDirAbs, 'Gemfile')));
|
|
327
|
+
// Multi-app projects might share a single global 'Gemfile' at the Git repository root directory.
|
|
328
|
+
let globalGemfileExists = false;
|
|
329
|
+
if (!appSpecificGemfileExists) {
|
|
330
|
+
try {
|
|
331
|
+
const output = await (0, subprocess_1.getCommandOutput)('git', ['rev-parse', '--show-toplevel'], { cwd: rootDir });
|
|
332
|
+
if (output != null) {
|
|
333
|
+
globalGemfileExists = await (0, utils_fs_1.pathExists)((0, path_1.resolve)(output, 'Gemfile'));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
catch (e) {
|
|
337
|
+
// Nothing
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (appSpecificGemfileExists || globalGemfileExists) {
|
|
341
|
+
return 'bundle exec pod';
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
return 'pod';
|
|
345
|
+
}
|
|
323
346
|
}
|
|
324
347
|
function formatConfigTS(extConfig) {
|
|
325
348
|
// TODO: <reference> tags
|
|
@@ -330,13 +353,6 @@ const config: CapacitorConfig = ${(0, js_1.formatJSObject)(extConfig)};
|
|
|
330
353
|
export default config;\n`;
|
|
331
354
|
}
|
|
332
355
|
function checkExternalConfig(config) {
|
|
333
|
-
var _a, _b;
|
|
334
|
-
if (typeof config.extConfig.hideLogs !== 'undefined' ||
|
|
335
|
-
typeof ((_a = config.extConfig.android) === null || _a === void 0 ? void 0 : _a.hideLogs) !== 'undefined' ||
|
|
336
|
-
typeof ((_b = config.extConfig.ios) === null || _b === void 0 ? void 0 : _b.hideLogs) !== 'undefined') {
|
|
337
|
-
log_1.logger.warn(`The ${colors_1.default.strong('hideLogs')} configuration option has been deprecated. ` +
|
|
338
|
-
`Please update to use ${colors_1.default.strong('loggingBehavior')} instead.`);
|
|
339
|
-
}
|
|
340
356
|
if (typeof config.extConfig.bundledWebRuntime !== 'undefined') {
|
|
341
357
|
let actionMessage = `Can be safely deleted.`;
|
|
342
358
|
if (config.extConfig.bundledWebRuntime === true) {
|
package/dist/declarations.d.ts
CHANGED
|
@@ -40,14 +40,6 @@ export interface CapacitorConfig {
|
|
|
40
40
|
* @default false
|
|
41
41
|
*/
|
|
42
42
|
bundledWebRuntime?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Hide or show the native logs for iOS and Android.
|
|
45
|
-
*
|
|
46
|
-
* @since 2.1.0
|
|
47
|
-
* @deprecated 3.0.0
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
hideLogs?: boolean;
|
|
51
43
|
/**
|
|
52
44
|
* The build configuration (as defined by the native app) under which Capacitor
|
|
53
45
|
* will send statements to the log system. This applies to log statements in
|
|
@@ -151,16 +143,6 @@ export interface CapacitorConfig {
|
|
|
151
143
|
* @default false
|
|
152
144
|
*/
|
|
153
145
|
webContentsDebuggingEnabled?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Hide or show the native logs for Android.
|
|
156
|
-
*
|
|
157
|
-
* Overrides global `hideLogs` option.
|
|
158
|
-
*
|
|
159
|
-
* @since 2.1.0
|
|
160
|
-
* @deprecated 3.0.0
|
|
161
|
-
* @default false
|
|
162
|
-
*/
|
|
163
|
-
hideLogs?: boolean;
|
|
164
146
|
/**
|
|
165
147
|
* The build configuration under which Capacitor will generate logs on Android.
|
|
166
148
|
*
|
|
@@ -350,16 +332,6 @@ export interface CapacitorConfig {
|
|
|
350
332
|
* @since 2.0.0
|
|
351
333
|
*/
|
|
352
334
|
allowsLinkPreview?: boolean;
|
|
353
|
-
/**
|
|
354
|
-
* Hide or show the native logs for iOS.
|
|
355
|
-
*
|
|
356
|
-
* Overrides global `hideLogs` option.
|
|
357
|
-
*
|
|
358
|
-
* @since 1.1.0
|
|
359
|
-
* @deprecated 3.0.0
|
|
360
|
-
* @default false
|
|
361
|
-
*/
|
|
362
|
-
hideLogs?: boolean;
|
|
363
335
|
/**
|
|
364
336
|
* The build configuration under which Capacitor will generate logs on iOS.
|
|
365
337
|
*
|
|
@@ -410,6 +382,15 @@ export interface CapacitorConfig {
|
|
|
410
382
|
* @default true
|
|
411
383
|
*/
|
|
412
384
|
handleApplicationNotifications?: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* Using Xcode 14.3, on iOS 16.4 and greater, enable debuggable web content for release builds.
|
|
387
|
+
*
|
|
388
|
+
* If not set, it's `true` for development builds.
|
|
389
|
+
*
|
|
390
|
+
* @since 4.8.0
|
|
391
|
+
* @default false
|
|
392
|
+
*/
|
|
393
|
+
webContentsDebuggingEnabled?: boolean;
|
|
413
394
|
};
|
|
414
395
|
server?: {
|
|
415
396
|
/**
|
|
@@ -537,7 +518,7 @@ export interface CapacitorConfig {
|
|
|
537
518
|
*/
|
|
538
519
|
includePlugins?: string[];
|
|
539
520
|
}
|
|
540
|
-
export interface
|
|
521
|
+
export interface FederatedApp {
|
|
541
522
|
name: string;
|
|
542
523
|
webDir: string;
|
|
543
524
|
liveUpdateConfig?: LiveUpdateConfig;
|
|
@@ -560,13 +541,13 @@ export interface PluginsConfig {
|
|
|
560
541
|
[key: string]: any;
|
|
561
542
|
} | undefined;
|
|
562
543
|
/**
|
|
563
|
-
*
|
|
544
|
+
* FederatedCapacitor plugin configuration
|
|
564
545
|
*
|
|
565
|
-
* @since
|
|
546
|
+
* @since 5.0.0
|
|
566
547
|
*/
|
|
567
|
-
|
|
568
|
-
shell:
|
|
569
|
-
apps:
|
|
548
|
+
FederatedCapacitor?: {
|
|
549
|
+
shell: Omit<FederatedApp, 'webDir'>;
|
|
550
|
+
apps: FederatedApp[];
|
|
570
551
|
liveUpdatesKey?: string;
|
|
571
552
|
};
|
|
572
553
|
/**
|
package/dist/ios/common.js
CHANGED
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.editProjectSettingsIOS = exports.resolvePlugin = exports.getIOSPlugins = exports.checkCocoaPods = exports.checkIOSPackage = void 0;
|
|
3
|
+
exports.editProjectSettingsIOS = exports.resolvePlugin = exports.getIOSPlugins = exports.checkCocoaPods = exports.checkBundler = exports.checkIOSPackage = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
8
9
|
const common_1 = require("../common");
|
|
9
10
|
const cordova_1 = require("../cordova");
|
|
11
|
+
const log_1 = require("../log");
|
|
10
12
|
const plugin_1 = require("../plugin");
|
|
11
13
|
const subprocess_1 = require("../util/subprocess");
|
|
12
14
|
async function checkIOSPackage(config) {
|
|
13
15
|
return (0, common_1.checkCapacitorPlatform)(config, 'ios');
|
|
14
16
|
}
|
|
15
17
|
exports.checkIOSPackage = checkIOSPackage;
|
|
18
|
+
function execBundler() {
|
|
19
|
+
try {
|
|
20
|
+
const bundleOutput = (0, child_process_1.execSync)('bundle &> /dev/null ; echo $?');
|
|
21
|
+
return parseInt(bundleOutput.toString());
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return -1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function checkBundler(config) {
|
|
28
|
+
if (config.cli.os === "mac" /* OS.Mac */) {
|
|
29
|
+
let bundlerResult = execBundler();
|
|
30
|
+
if (bundlerResult === 1) {
|
|
31
|
+
// Bundler version is outdated
|
|
32
|
+
log_1.logger.info(`Using ${colors_1.default.strong('Gemfile')}: Bundler update needed...`);
|
|
33
|
+
await (0, subprocess_1.runCommand)('gem', ['install', 'bundler']);
|
|
34
|
+
bundlerResult = execBundler();
|
|
35
|
+
}
|
|
36
|
+
if (bundlerResult === 0) {
|
|
37
|
+
// Bundler in use, all gems current
|
|
38
|
+
log_1.logger.info(`Using ${colors_1.default.strong('Gemfile')}: RubyGems bundle installed`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
exports.checkBundler = checkBundler;
|
|
16
44
|
async function checkCocoaPods(config) {
|
|
17
|
-
if (!(await (0, subprocess_1.isInstalled)(config.ios.podPath)) &&
|
|
45
|
+
if (!(await (0, subprocess_1.isInstalled)(await config.ios.podPath)) &&
|
|
46
|
+
config.cli.os === "mac" /* OS.Mac */) {
|
|
18
47
|
return (`CocoaPods is not installed.\n` +
|
|
19
48
|
`See this install guide: ${colors_1.default.strong('https://capacitorjs.com/docs/getting-started/environment-setup#homebrew')}`);
|
|
20
49
|
}
|
package/dist/ios/doctor.js
CHANGED
|
@@ -21,7 +21,7 @@ async function doctorIOS(config) {
|
|
|
21
21
|
// check if www folder is empty (index.html does not exist)
|
|
22
22
|
try {
|
|
23
23
|
await (0, common_1.check)([
|
|
24
|
-
() => (0, common_2.checkCocoaPods)(config),
|
|
24
|
+
() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config),
|
|
25
25
|
() => (0, common_1.checkWebDir)(config),
|
|
26
26
|
checkXcode,
|
|
27
27
|
]);
|
package/dist/ios/update.js
CHANGED
|
@@ -40,7 +40,7 @@ async function updateIOS(config, deployment) {
|
|
|
40
40
|
}
|
|
41
41
|
exports.updateIOS = updateIOS;
|
|
42
42
|
async function installCocoaPodsPlugins(config, plugins, deployment) {
|
|
43
|
-
await (0, common_1.runTask)(`Updating iOS native dependencies with ${colors_1.default.input(`${config.ios.podPath} install`)}`, () => {
|
|
43
|
+
await (0, common_1.runTask)(`Updating iOS native dependencies with ${colors_1.default.input(`${await config.ios.podPath} install`)}`, () => {
|
|
44
44
|
return updatePodfile(config, plugins, deployment);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -51,9 +51,16 @@ async function updatePodfile(config, plugins, deployment) {
|
|
|
51
51
|
let podfileContent = await (0, utils_fs_1.readFile)(podfilePath, { encoding: 'utf-8' });
|
|
52
52
|
podfileContent = podfileContent.replace(/(def capacitor_pods)[\s\S]+?(\nend)/, `$1${dependenciesContent}$2`);
|
|
53
53
|
await (0, utils_fs_1.writeFile)(podfilePath, podfileContent, { encoding: 'utf-8' });
|
|
54
|
+
const podPath = await config.ios.podPath;
|
|
55
|
+
const useBundler = podPath.startsWith('bundle');
|
|
54
56
|
const podCommandExists = await (0, subprocess_1.isInstalled)('pod');
|
|
55
|
-
if (podCommandExists) {
|
|
56
|
-
|
|
57
|
+
if (useBundler || podCommandExists) {
|
|
58
|
+
if (useBundler) {
|
|
59
|
+
await (0, subprocess_1.runCommand)('bundle', ['exec', 'pod', 'install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
await (0, subprocess_1.runCommand)(podPath, ['install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
else {
|
|
59
66
|
log_1.logger.warn('Skipping pod install because CocoaPods is not installed');
|
package/dist/tasks/add.js
CHANGED
|
@@ -82,7 +82,10 @@ function printNextSteps(platformName) {
|
|
|
82
82
|
}
|
|
83
83
|
function addChecks(config, platformName) {
|
|
84
84
|
if (platformName === config.ios.name) {
|
|
85
|
-
return [
|
|
85
|
+
return [
|
|
86
|
+
() => (0, common_3.checkIOSPackage)(config),
|
|
87
|
+
() => (0, common_3.checkBundler)(config) || (0, common_3.checkCocoaPods)(config),
|
|
88
|
+
];
|
|
86
89
|
}
|
|
87
90
|
else if (platformName === config.android.name) {
|
|
88
91
|
return [() => (0, common_1.checkAndroidPackage)(config)];
|
package/dist/tasks/copy.js
CHANGED
|
@@ -47,9 +47,9 @@ async function copy(config, platformName, inline = false) {
|
|
|
47
47
|
}
|
|
48
48
|
await (0, common_1.runPlatformHook)(config, platformName, config.app.rootDir, 'capacitor:copy:before');
|
|
49
49
|
const allPlugins = await (0, plugin_1.getPlugins)(config, platformName);
|
|
50
|
-
let
|
|
51
|
-
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/capacitor
|
|
52
|
-
|
|
50
|
+
let usesFederatedCapacitor = false;
|
|
51
|
+
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/federated-capacitor').length > 0) {
|
|
52
|
+
usesFederatedCapacitor = true;
|
|
53
53
|
}
|
|
54
54
|
let usesLiveUpdates = false;
|
|
55
55
|
if (allPlugins.filter(plugin => plugin.id === '@capacitor/live-updates')
|
|
@@ -62,10 +62,10 @@ async function copy(config, platformName, inline = false) {
|
|
|
62
62
|
usesSSLPinning = true;
|
|
63
63
|
}
|
|
64
64
|
if (platformName === config.ios.name) {
|
|
65
|
-
if (
|
|
65
|
+
if (usesFederatedCapacitor) {
|
|
66
66
|
await copyFederatedWebDirs(config, await config.ios.webDirAbs);
|
|
67
|
-
if ((_c = (_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.
|
|
68
|
-
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.
|
|
67
|
+
if ((_c = (_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.FederatedCapacitor) === null || _c === void 0 ? void 0 : _c.liveUpdatesKey) {
|
|
68
|
+
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.FederatedCapacitor.liveUpdatesKey, config.app.rootDir, config.ios.nativeTargetDirAbs);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
@@ -82,10 +82,10 @@ async function copy(config, platformName, inline = false) {
|
|
|
82
82
|
await (0, cordova_1.handleCordovaPluginsJS)(cordovaPlugins, config, platformName);
|
|
83
83
|
}
|
|
84
84
|
else if (platformName === config.android.name) {
|
|
85
|
-
if (
|
|
85
|
+
if (usesFederatedCapacitor) {
|
|
86
86
|
await copyFederatedWebDirs(config, config.android.webDirAbs);
|
|
87
|
-
if ((_o = (_m = (_l = config.app.extConfig) === null || _l === void 0 ? void 0 : _l.plugins) === null || _m === void 0 ? void 0 : _m.
|
|
88
|
-
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.
|
|
87
|
+
if ((_o = (_m = (_l = config.app.extConfig) === null || _l === void 0 ? void 0 : _l.plugins) === null || _m === void 0 ? void 0 : _m.FederatedCapacitor) === null || _o === void 0 ? void 0 : _o.liveUpdatesKey) {
|
|
88
|
+
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.FederatedCapacitor.liveUpdatesKey, config.app.rootDir, config.android.assetsDirAbs);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
@@ -103,8 +103,8 @@ async function copy(config, platformName, inline = false) {
|
|
|
103
103
|
await (0, cordova_1.writeCordovaAndroidManifest)(cordovaPlugins, config, platformName);
|
|
104
104
|
}
|
|
105
105
|
else if (platformName === config.web.name) {
|
|
106
|
-
if (
|
|
107
|
-
log_1.logger.info('
|
|
106
|
+
if (usesFederatedCapacitor) {
|
|
107
|
+
log_1.logger.info('FederatedCapacitor Plugin installed, skipping web bundling...');
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
await (0, copy_1.copyWeb)(config);
|
|
@@ -148,23 +148,31 @@ async function copyWebDir(config, nativeAbsDir, webAbsDir) {
|
|
|
148
148
|
}
|
|
149
149
|
async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|
150
150
|
var _a, _b;
|
|
151
|
-
log_1.logger.info('
|
|
152
|
-
if (!((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.
|
|
153
|
-
throw `
|
|
151
|
+
log_1.logger.info('FederatedCapacitor Plugin Loaded - Copying Web Assets');
|
|
152
|
+
if (!((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.FederatedCapacitor)) {
|
|
153
|
+
throw `FederatedCapacitor plugin is present but no valid config is defined.`;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
|
|
155
|
+
const federatedConfig = config.app.extConfig.plugins.FederatedCapacitor;
|
|
156
|
+
if (federatedConfig) {
|
|
157
|
+
if (federatedConfig.shell.name === undefined) {
|
|
158
|
+
throw `FederatedCapacitor plugin is present but no valid Shell application is defined in the config.`;
|
|
159
|
+
}
|
|
160
|
+
if (!federatedConfig.apps.every(isFederatedApp)) {
|
|
161
|
+
throw `FederatedCapacitor plugin is present but there is a problem with the apps defined in the config.`;
|
|
162
|
+
}
|
|
163
|
+
const copyApps = () => {
|
|
164
|
+
return federatedConfig.apps.map(app => {
|
|
165
|
+
const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
|
|
166
|
+
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
const copyShell = () => {
|
|
170
|
+
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, federatedConfig.shell.name), config.app.webDirAbs);
|
|
171
|
+
};
|
|
172
|
+
await Promise.all([...copyApps(), copyShell()]);
|
|
158
173
|
}
|
|
159
|
-
if (!portalsConfig.apps.every(isPortal)) {
|
|
160
|
-
throw `Capacitor Portals plugin is present but there is a problem with the apps defined in the config.`;
|
|
161
|
-
}
|
|
162
|
-
await Promise.all([...portalsConfig.apps, portalsConfig.shell].map(app => {
|
|
163
|
-
const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
|
|
164
|
-
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
|
|
165
|
-
}));
|
|
166
174
|
}
|
|
167
|
-
function
|
|
175
|
+
function isFederatedApp(config) {
|
|
168
176
|
return (config.webDir !== undefined &&
|
|
169
177
|
config.name !== undefined);
|
|
170
178
|
}
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -49,7 +49,7 @@ const plugins = [
|
|
|
49
49
|
];
|
|
50
50
|
const coreVersion = 'next'; // TODO: Update when Capacitor 5 releases
|
|
51
51
|
const pluginVersion = 'next'; // TODO: Update when Capacitor 5 releases
|
|
52
|
-
const gradleVersion = '
|
|
52
|
+
const gradleVersion = '8.0.2';
|
|
53
53
|
async function migrateCommand(config, noprompt, packagemanager) {
|
|
54
54
|
if (config === null) {
|
|
55
55
|
(0, errors_1.fatal)('Config data missing');
|
|
@@ -137,6 +137,10 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
137
137
|
await (0, common_1.runTask)('Remove android.enableJetifier=true from gradle.properties', () => {
|
|
138
138
|
return updateGradleProperties((0, path_1.join)(config.android.platformDirAbs, 'gradle.properties'));
|
|
139
139
|
});
|
|
140
|
+
// Move package from android manifest
|
|
141
|
+
await (0, common_1.runTask)('Migrating package from Manifest to build.gradle', () => {
|
|
142
|
+
return movePackageFromManifestToBuildGradle((0, path_1.join)(config.android.platformDirAbs, 'app', 'src', 'main', 'AndroidManifest.xml'), (0, path_1.join)(config.android.platformDirAbs, 'app', 'build.gradle'));
|
|
143
|
+
});
|
|
140
144
|
// Update gradle-wrapper.properties
|
|
141
145
|
await (0, common_1.runTask)(`Migrating gradle-wrapper.properties by updating gradle version to ${gradleVersion}.`, () => {
|
|
142
146
|
return updateGradleWrapper((0, path_1.join)(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
|
@@ -169,6 +173,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
169
173
|
androidxBrowserVersion: '1.5.0',
|
|
170
174
|
androidxMaterialVersion: '1.8.0',
|
|
171
175
|
androidxExifInterfaceVersion: '1.3.6',
|
|
176
|
+
androidxCoreKTXVersion: '1.10.0',
|
|
172
177
|
};
|
|
173
178
|
for (const variable of Object.keys(pluginVariables)) {
|
|
174
179
|
await updateFile(config, variablesPath, `${variable} = '`, `'`, pluginVariables[variable], true);
|
|
@@ -407,10 +412,51 @@ async function updateGradleProperties(filename) {
|
|
|
407
412
|
}
|
|
408
413
|
(0, utils_fs_1.writeFileSync)(filename, linesToKeep, { encoding: 'utf-8' });
|
|
409
414
|
}
|
|
415
|
+
async function movePackageFromManifestToBuildGradle(manifestFilename, buildGradleFilename) {
|
|
416
|
+
const manifestText = readFile(manifestFilename);
|
|
417
|
+
const buildGradleText = readFile(buildGradleFilename);
|
|
418
|
+
if (!manifestText) {
|
|
419
|
+
log_1.logger.error(`Could not read ${manifestFilename}. Check its permissions and if it exists.`);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (!buildGradleText) {
|
|
423
|
+
log_1.logger.error(`Could not read ${buildGradleFilename}. Check its permissions and if it exists.`);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const namespaceExists = new RegExp(/\s+namespace\s+/).test(buildGradleText);
|
|
427
|
+
if (namespaceExists) {
|
|
428
|
+
log_1.logger.error('Found namespace in build.gradle already, skipping migration');
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
let packageName;
|
|
432
|
+
const manifestRegEx = new RegExp(/<manifest ([^>]*package="(.+)"[^>]*)>/);
|
|
433
|
+
const manifestResults = manifestRegEx.exec(manifestText);
|
|
434
|
+
if (manifestResults === null) {
|
|
435
|
+
log_1.logger.error(`Unable to update Android Manifest. Missing <activity> tag`);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
packageName = manifestResults[2];
|
|
440
|
+
}
|
|
441
|
+
let manifestReplaced = manifestText;
|
|
442
|
+
manifestReplaced = setAllStringIn(manifestText, '<manifest xmlns:android="http://schemas.android.com/apk/res/android"', '>', ``);
|
|
443
|
+
if (manifestText == manifestReplaced) {
|
|
444
|
+
log_1.logger.error(`Unable to update Android Manifest: no changes were detected in Android Manifest file`);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
let buildGradleReplaced = buildGradleText;
|
|
448
|
+
buildGradleReplaced = setAllStringIn(buildGradleText, 'android {', ' \n', `namespace "${packageName}"\n`);
|
|
449
|
+
if (buildGradleText == buildGradleReplaced) {
|
|
450
|
+
log_1.logger.error(`Unable to update buildGradleText: no changes were detected in Android Manifest file`);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
(0, utils_fs_1.writeFileSync)(manifestFilename, manifestReplaced, 'utf-8');
|
|
454
|
+
(0, utils_fs_1.writeFileSync)(buildGradleFilename, buildGradleReplaced, 'utf-8');
|
|
455
|
+
}
|
|
410
456
|
async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
411
457
|
// In build.gradle add dependencies:
|
|
412
|
-
// classpath 'com.android.tools.build:gradle:
|
|
413
|
-
// classpath 'com.google.gms:google-services:4.3.
|
|
458
|
+
// classpath 'com.android.tools.build:gradle:8.0.0'
|
|
459
|
+
// classpath 'com.google.gms:google-services:4.3.15'
|
|
414
460
|
const txt = readFile(filename);
|
|
415
461
|
if (!txt) {
|
|
416
462
|
return;
|
|
@@ -431,6 +477,7 @@ async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
|
431
477
|
}
|
|
432
478
|
}
|
|
433
479
|
}
|
|
480
|
+
(0, utils_fs_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
434
481
|
}
|
|
435
482
|
async function updateFile(config, filename, textStart, textEnd, replacement, skipIfNotFound) {
|
|
436
483
|
if (config === null) {
|
package/dist/tasks/update.js
CHANGED
|
@@ -44,7 +44,7 @@ function updateChecks(config, platforms) {
|
|
|
44
44
|
const checks = [];
|
|
45
45
|
for (const platformName of platforms) {
|
|
46
46
|
if (platformName === config.ios.name) {
|
|
47
|
-
checks.push(() => (0, common_2.checkCocoaPods)(config));
|
|
47
|
+
checks.push(() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config));
|
|
48
48
|
}
|
|
49
49
|
else if (platformName === config.android.name) {
|
|
50
50
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.3",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"cross platform"
|
|
28
28
|
],
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=16.0.0"
|
|
31
31
|
},
|
|
32
32
|
"main": "dist/index.js",
|
|
33
33
|
"types": "dist/declarations.d.ts",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"semver": "^7.3.7",
|
|
61
61
|
"tar": "^6.1.11",
|
|
62
62
|
"tslib": "^2.4.0",
|
|
63
|
-
"xml2js": "^0.
|
|
63
|
+
"xml2js": "^0.5.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/debug": "^4.1.7",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "60ffcc36bc4948876b94f1f7a0470c68b6a7e50f"
|
|
89
89
|
}
|