@capacitor/cli 8.0.0-alpha.2 → 8.0.0-beta.0
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-pods-template.tar.gz +0 -0
- package/assets/ios-spm-template.tar.gz +0 -0
- package/dist/android/common.js +1 -1
- package/dist/android/run.js +2 -2
- package/dist/android/update.js +1 -3
- package/dist/common.js +26 -3
- package/dist/config.js +14 -3
- package/dist/declarations.d.ts +36 -10
- package/dist/index.js +7 -3
- package/dist/ios/run.js +2 -2
- package/dist/ios/update.js +1 -1
- package/dist/tasks/copy.js +1 -1
- package/dist/tasks/migrate.js +93 -121
- package/dist/util/native-run.js +6 -1
- package/dist/util/spm.js +1 -1
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/common.js
CHANGED
|
@@ -82,7 +82,7 @@ async function editProjectSettingsAndroid(config) {
|
|
|
82
82
|
let gradleContent = await (0, fs_extra_1.readFile)(buildGradlePath, { encoding: 'utf-8' });
|
|
83
83
|
gradleContent = gradleContent.replace(/applicationId "[^"]+"/, `applicationId "${appId}"`);
|
|
84
84
|
// Update the namespace in build.gradle
|
|
85
|
-
gradleContent = gradleContent.replace(/namespace "[^"]+"/, `namespace "${appId}"`);
|
|
85
|
+
gradleContent = gradleContent.replace(/namespace = "[^"]+"/, `namespace = "${appId}"`);
|
|
86
86
|
await (0, fs_extra_1.writeFile)(buildGradlePath, gradleContent, { encoding: 'utf-8' });
|
|
87
87
|
// Update the settings in res/values/strings.xml
|
|
88
88
|
const stringsPath = (0, path_1.resolve)(config.android.resDirAbs, 'values/strings.xml');
|
package/dist/android/run.js
CHANGED
|
@@ -9,9 +9,9 @@ const common_1 = require("../common");
|
|
|
9
9
|
const native_run_1 = require("../util/native-run");
|
|
10
10
|
const subprocess_1 = require("../util/subprocess");
|
|
11
11
|
const debug = (0, debug_1.default)('capacitor:android:run');
|
|
12
|
-
async function runAndroid(config, { target: selectedTarget, flavor: selectedFlavor, forwardPorts: selectedPorts }) {
|
|
12
|
+
async function runAndroid(config, { target: selectedTarget, targetName: selectedTargetName, targetNameSdkVersion: selectedTargetSdkVersion, flavor: selectedFlavor, forwardPorts: selectedPorts, }) {
|
|
13
13
|
var _a;
|
|
14
|
-
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('android'), selectedTarget);
|
|
14
|
+
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('android'), selectedTarget !== null && selectedTarget !== void 0 ? selectedTarget : selectedTargetName, selectedTargetSdkVersion, selectedTargetName !== undefined);
|
|
15
15
|
const runFlavor = selectedFlavor || ((_a = config.android) === null || _a === void 0 ? void 0 : _a.flavor) || '';
|
|
16
16
|
const arg = `assemble${runFlavor}Debug`;
|
|
17
17
|
const gradleArgs = [arg];
|
package/dist/android/update.js
CHANGED
|
@@ -11,7 +11,6 @@ const cordova_1 = require("../cordova");
|
|
|
11
11
|
const errors_1 = require("../errors");
|
|
12
12
|
const plugin_1 = require("../plugin");
|
|
13
13
|
const copy_1 = require("../tasks/copy");
|
|
14
|
-
const migrate_1 = require("../tasks/migrate");
|
|
15
14
|
const fs_1 = require("../util/fs");
|
|
16
15
|
const node_1 = require("../util/node");
|
|
17
16
|
const template_1 = require("../util/template");
|
|
@@ -26,7 +25,6 @@ async function updateAndroid(config) {
|
|
|
26
25
|
await writePluginsJson(config, capacitorPlugins);
|
|
27
26
|
await removePluginsNativeFiles(config);
|
|
28
27
|
const cordovaPlugins = plugins.filter((p) => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
29
|
-
await (0, migrate_1.patchOldCapacitorPlugins)(config);
|
|
30
28
|
if (cordovaPlugins.length > 0) {
|
|
31
29
|
await copyPluginsNativeFiles(config, cordovaPlugins);
|
|
32
30
|
}
|
|
@@ -175,7 +173,7 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
175
173
|
var _a, _b, _c;
|
|
176
174
|
const pluginsGradlePath = (0, path_1.join)(config.android.cordovaPluginsDirAbs, 'build.gradle');
|
|
177
175
|
const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
|
|
178
|
-
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 : '
|
|
176
|
+
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 : '2.2.20';
|
|
179
177
|
const frameworksArray = [];
|
|
180
178
|
let prefsArray = [];
|
|
181
179
|
const applyArray = [];
|
package/dist/common.js
CHANGED
|
@@ -300,7 +300,7 @@ async function promptForPlatform(platforms, promptMessage, selectedPlatformName)
|
|
|
300
300
|
return platformName;
|
|
301
301
|
}
|
|
302
302
|
exports.promptForPlatform = promptForPlatform;
|
|
303
|
-
async function promptForPlatformTarget(targets, selectedTarget) {
|
|
303
|
+
async function promptForPlatformTarget(targets, selectedTarget, selectedTargetSdkVersion, selectByName) {
|
|
304
304
|
const { prompt } = await Promise.resolve().then(() => tslib_1.__importStar(require('prompts')));
|
|
305
305
|
const validTargets = targets.filter((t) => t.id !== undefined);
|
|
306
306
|
if (!selectedTarget) {
|
|
@@ -323,9 +323,32 @@ async function promptForPlatformTarget(targets, selectedTarget) {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
const targetID = selectedTarget.trim();
|
|
326
|
-
const target = targets.find((t) =>
|
|
326
|
+
const target = targets.find((t) => {
|
|
327
|
+
var _a;
|
|
328
|
+
if (selectByName === true) {
|
|
329
|
+
let name = (_a = t.name) !== null && _a !== void 0 ? _a : t.model;
|
|
330
|
+
if (name) {
|
|
331
|
+
// Apple device names may have "smart quotes" in the name,
|
|
332
|
+
// strip them and replace them with the "straight" versions
|
|
333
|
+
name = name.replace(/[\u2018\u2019]/g, "'").replace(/[\u201C\u201D]/g, '"');
|
|
334
|
+
}
|
|
335
|
+
if (selectedTargetSdkVersion) {
|
|
336
|
+
return name === targetID && t.sdkVersion === selectedTargetSdkVersion;
|
|
337
|
+
}
|
|
338
|
+
return name === targetID;
|
|
339
|
+
}
|
|
340
|
+
return t.id === targetID;
|
|
341
|
+
});
|
|
327
342
|
if (!target) {
|
|
328
|
-
|
|
343
|
+
if (selectByName) {
|
|
344
|
+
let invalidTargetName = targetID;
|
|
345
|
+
if (selectedTargetSdkVersion) {
|
|
346
|
+
invalidTargetName += ` [${selectedTargetSdkVersion}]`;
|
|
347
|
+
}
|
|
348
|
+
(0, errors_1.fatal)(`Invalid target name: ${colors_1.default.input(invalidTargetName)}.\n` +
|
|
349
|
+
`Valid targets are:\n ${targets.map((t) => { var _a; return `${(_a = t.name) !== null && _a !== void 0 ? _a : t.model} [${t.sdkVersion}]`; }).join('\n')}`);
|
|
350
|
+
}
|
|
351
|
+
(0, errors_1.fatal)(`Invalid target ID: ${colors_1.default.input(targetID)}.\n` + `Valid targets are:\n ${targets.map((t) => t.id).join('\n')}`);
|
|
329
352
|
}
|
|
330
353
|
return target;
|
|
331
354
|
}
|
package/dist/config.js
CHANGED
|
@@ -138,7 +138,7 @@ async function loadExtConfig(rootDir) {
|
|
|
138
138
|
async function loadCLIConfig(rootDir) {
|
|
139
139
|
const assetsDir = 'assets';
|
|
140
140
|
const assetsDirAbs = (0, path_1.join)(rootDir, assetsDir);
|
|
141
|
-
const iosPlatformTemplateArchive = 'ios-
|
|
141
|
+
const iosPlatformTemplateArchive = 'ios-spm-template.tar.gz';
|
|
142
142
|
const iosCordovaPluginsTemplateArchive = 'capacitor-cordova-ios-plugins.tar.gz';
|
|
143
143
|
const androidPlatformTemplateArchive = 'android-template.tar.gz';
|
|
144
144
|
const androidCordovaPluginsTemplateArchive = 'capacitor-cordova-android-plugins.tar.gz';
|
|
@@ -334,8 +334,19 @@ async function determineAndroidStudioPath(os) {
|
|
|
334
334
|
}
|
|
335
335
|
return p;
|
|
336
336
|
}
|
|
337
|
-
case "linux" /* OS.Linux */:
|
|
338
|
-
|
|
337
|
+
case "linux" /* OS.Linux */: {
|
|
338
|
+
const studioExecPath = '/usr/local/android-studio/bin/studio';
|
|
339
|
+
const studioShPath = '/usr/local/android-studio/bin/studio.sh';
|
|
340
|
+
try {
|
|
341
|
+
if (await (0, fs_extra_1.pathExists)(studioExecPath)) {
|
|
342
|
+
return studioExecPath;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
debug(`Error checking for studio executable: %O`, e);
|
|
347
|
+
}
|
|
348
|
+
return studioShPath;
|
|
349
|
+
}
|
|
339
350
|
}
|
|
340
351
|
return '';
|
|
341
352
|
}
|
package/dist/declarations.d.ts
CHANGED
|
@@ -267,16 +267,6 @@ export interface CapacitorConfig {
|
|
|
267
267
|
* @default true
|
|
268
268
|
*/
|
|
269
269
|
resolveServiceWorkerRequests?: boolean;
|
|
270
|
-
/**
|
|
271
|
-
* If set to "force", margins will be adjusted for edge to edge regardless of any other settings.
|
|
272
|
-
* If set to "auto", or is missing, will check for Android 15 and the setting of [windowOptOutEdgeToEdgeEnforcement](https://developer.android.com/reference/android/R.attr#windowOptOutEdgeToEdgeEnforcement) and will adjust margins if on Android 15 and windowOptOutEdgeToEdgeEnforcement is false/missing.
|
|
273
|
-
* If set to "disable", will not adjust margins at all.
|
|
274
|
-
* In Capacitor 8, this default will be changed to 'auto'
|
|
275
|
-
*
|
|
276
|
-
* @since 7.1.0
|
|
277
|
-
* @default disable
|
|
278
|
-
*/
|
|
279
|
-
adjustMarginsForEdgeToEdge?: 'auto' | 'force' | 'disable';
|
|
280
270
|
};
|
|
281
271
|
ios?: {
|
|
282
272
|
/**
|
|
@@ -645,4 +635,40 @@ export interface PluginsConfig {
|
|
|
645
635
|
*/
|
|
646
636
|
enabled?: boolean;
|
|
647
637
|
};
|
|
638
|
+
/**
|
|
639
|
+
* System Bars plugin configuration
|
|
640
|
+
*
|
|
641
|
+
* @since 8.0.0
|
|
642
|
+
*/
|
|
643
|
+
SystemBars?: {
|
|
644
|
+
/**
|
|
645
|
+
* Disables the injection of device css insets into the web view.
|
|
646
|
+
*
|
|
647
|
+
* @default false
|
|
648
|
+
*/
|
|
649
|
+
disableInsets?: boolean;
|
|
650
|
+
/**
|
|
651
|
+
* The style of the text and icons of the system bars.
|
|
652
|
+
*
|
|
653
|
+
* This option is only supported on Android.
|
|
654
|
+
*
|
|
655
|
+
* @default `DEFAULT`
|
|
656
|
+
*/
|
|
657
|
+
style?: string;
|
|
658
|
+
/**
|
|
659
|
+
* Hide the system bars on start.
|
|
660
|
+
*
|
|
661
|
+
* @default false
|
|
662
|
+
*/
|
|
663
|
+
hidden?: boolean;
|
|
664
|
+
/**
|
|
665
|
+
* The type of status bar animation used when showing or hiding.
|
|
666
|
+
*
|
|
667
|
+
* This option is only supported on iOS.
|
|
668
|
+
*
|
|
669
|
+
* @default 'FADE'
|
|
670
|
+
*
|
|
671
|
+
*/
|
|
672
|
+
animation?: 'FADE' | 'NONE';
|
|
673
|
+
};
|
|
648
674
|
}
|
package/dist/index.js
CHANGED
|
@@ -143,13 +143,15 @@ function runProgram(config) {
|
|
|
143
143
|
.option('--list', 'list targets, then quit')
|
|
144
144
|
.addOption(new commander_1.Option('--json').hideHelp())
|
|
145
145
|
.option('--target <id>', 'use a specific target')
|
|
146
|
+
.option('--target-name <name>', 'use a specific target by name')
|
|
147
|
+
.option('--target-name-sdk-version <version>', 'use a specific sdk version when using --target-name, ex: 26.0 (for iOS 26) or 35 (for Android API 35)')
|
|
146
148
|
.option('--no-sync', `do not run ${colors_1.default.input('sync')}`)
|
|
147
149
|
.option('--forwardPorts <port:port>', 'Automatically run "adb reverse" for better live-reloading support')
|
|
148
150
|
.option('-l, --live-reload', 'Enable Live Reload')
|
|
149
151
|
.option('--host <host>', 'Host used for live reload')
|
|
150
152
|
.option('--port <port>', 'Port used for live reload')
|
|
151
153
|
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
152
|
-
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, json, target, sync, forwardPorts, liveReload, host, port, configuration }) => {
|
|
154
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, json, target, targetName, targetNameSdkVersion, sync, forwardPorts, liveReload, host, port, configuration, }) => {
|
|
153
155
|
const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
|
|
154
156
|
await runCommand(config, platform, {
|
|
155
157
|
scheme,
|
|
@@ -157,6 +159,8 @@ function runProgram(config) {
|
|
|
157
159
|
list,
|
|
158
160
|
json,
|
|
159
161
|
target,
|
|
162
|
+
targetName,
|
|
163
|
+
targetNameSdkVersion,
|
|
160
164
|
sync,
|
|
161
165
|
forwardPorts,
|
|
162
166
|
liveReload,
|
|
@@ -179,8 +183,8 @@ function runProgram(config) {
|
|
|
179
183
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { packagemanager }) => {
|
|
180
184
|
const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
|
|
181
185
|
const configWritable = config;
|
|
182
|
-
if (packagemanager === '
|
|
183
|
-
configWritable.cli.assets.ios.platformTemplateArchive = 'ios-
|
|
186
|
+
if ((packagemanager === null || packagemanager === void 0 ? void 0 : packagemanager.toLowerCase()) === 'CocoaPods'.toLowerCase()) {
|
|
187
|
+
configWritable.cli.assets.ios.platformTemplateArchive = 'ios-pods-template.tar.gz';
|
|
184
188
|
configWritable.cli.assets.ios.platformTemplateArchiveAbs = (0, path_1.resolve)(configWritable.cli.assetsDirAbs, configWritable.cli.assets.ios.platformTemplateArchive);
|
|
185
189
|
}
|
|
186
190
|
await addCommand(configWritable, platform);
|
package/dist/ios/run.js
CHANGED
|
@@ -10,8 +10,8 @@ const native_run_1 = require("../util/native-run");
|
|
|
10
10
|
const spm_1 = require("../util/spm");
|
|
11
11
|
const subprocess_1 = require("../util/subprocess");
|
|
12
12
|
const debug = (0, debug_1.default)('capacitor:ios:run');
|
|
13
|
-
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme, configuration: selectedConfiguration }) {
|
|
14
|
-
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('ios'), selectedTarget);
|
|
13
|
+
async function runIOS(config, { target: selectedTarget, targetName: selectedTargetName, targetNameSdkVersion: selectedTargetSdkVersion, scheme: selectedScheme, configuration: selectedConfiguration, }) {
|
|
14
|
+
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('ios'), selectedTarget !== null && selectedTarget !== void 0 ? selectedTarget : selectedTargetName, selectedTargetSdkVersion, selectedTargetName !== undefined);
|
|
15
15
|
const runScheme = selectedScheme || config.ios.scheme;
|
|
16
16
|
const configuration = selectedConfiguration || 'Debug';
|
|
17
17
|
const derivedDataPath = (0, path_1.resolve)(config.ios.platformDirAbs, 'DerivedData', target.id);
|
package/dist/ios/update.js
CHANGED
|
@@ -43,7 +43,7 @@ async function updatePluginFiles(config, plugins, deployment) {
|
|
|
43
43
|
if ((await (0, spm_1.checkPackageManager)(config)) === 'SPM') {
|
|
44
44
|
await generateCordovaPackageFiles(cordovaPlugins, config);
|
|
45
45
|
const validSPMPackages = await (0, spm_1.checkPluginsForPackageSwift)(config, plugins);
|
|
46
|
-
await (0, spm_1.generatePackageFile)(config, validSPMPackages);
|
|
46
|
+
await (0, spm_1.generatePackageFile)(config, validSPMPackages.concat(cordovaPlugins));
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
49
|
await generateCordovaPodspecs(cordovaPlugins, config);
|
package/dist/tasks/copy.js
CHANGED
|
@@ -57,7 +57,7 @@ async function copy(config, platformName, inline = false) {
|
|
|
57
57
|
usesLiveUpdates = true;
|
|
58
58
|
}
|
|
59
59
|
let usesSSLPinning = false;
|
|
60
|
-
if (allPlugins.filter((plugin) => plugin.id === '@ionic-enterprise/ssl-pinning').length > 0) {
|
|
60
|
+
if (allPlugins.filter((plugin) => plugin.id === '@ionic-enterprise/ssl-pinning' || plugin.id === '@capacitor/ssl-pinning').length > 0) {
|
|
61
61
|
usesSSLPinning = true;
|
|
62
62
|
}
|
|
63
63
|
if (platformName === config.ios.name) {
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.migrateCommand = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const rimraf_1 = require("rimraf");
|
|
8
8
|
const semver_1 = require("semver");
|
|
9
|
-
const common_1 = require("../android/common");
|
|
10
9
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
11
|
-
const
|
|
10
|
+
const common_1 = require("../common");
|
|
12
11
|
const errors_1 = require("../errors");
|
|
13
|
-
const
|
|
12
|
+
const common_2 = require("../ios/common");
|
|
14
13
|
const log_1 = require("../log");
|
|
15
|
-
const plugin_1 = require("../plugin");
|
|
16
14
|
const fs_1 = require("../util/fs");
|
|
17
|
-
const node_1 = require("../util/node");
|
|
18
15
|
const spm_1 = require("../util/spm");
|
|
19
16
|
const subprocess_1 = require("../util/subprocess");
|
|
20
17
|
const template_1 = require("../util/template");
|
|
@@ -47,22 +44,23 @@ const plugins = [
|
|
|
47
44
|
'@capacitor/text-zoom',
|
|
48
45
|
'@capacitor/toast',
|
|
49
46
|
];
|
|
50
|
-
const coreVersion = '
|
|
51
|
-
const pluginVersion = '
|
|
52
|
-
const gradleVersion = '8.
|
|
53
|
-
const iOSVersion = '
|
|
47
|
+
const coreVersion = 'next';
|
|
48
|
+
const pluginVersion = 'next';
|
|
49
|
+
const gradleVersion = '8.14.3';
|
|
50
|
+
const iOSVersion = '15';
|
|
51
|
+
const kotlinVersion = '2.2.20';
|
|
54
52
|
let installFailed = false;
|
|
55
53
|
async function migrateCommand(config, noprompt, packagemanager) {
|
|
56
54
|
if (config === null) {
|
|
57
55
|
(0, errors_1.fatal)('Config data missing');
|
|
58
56
|
}
|
|
59
57
|
const capMajor = await checkCapacitorMajorVersion(config);
|
|
60
|
-
if (capMajor <
|
|
61
|
-
(0, errors_1.fatal)('Migrate can only be used on Capacitor
|
|
58
|
+
if (capMajor < 7) {
|
|
59
|
+
(0, errors_1.fatal)('Migrate can only be used on Capacitor 7, please use the CLI in Capacitor 7 to upgrade to 7 first');
|
|
62
60
|
}
|
|
63
|
-
const jdkMajor = await (0,
|
|
61
|
+
const jdkMajor = await (0, common_1.checkJDKMajorVersion)();
|
|
64
62
|
if (jdkMajor < 21) {
|
|
65
|
-
log_1.logger.warn('Capacitor
|
|
63
|
+
log_1.logger.warn('Capacitor 8 requires JDK 21 or higher. Some steps may fail.');
|
|
66
64
|
}
|
|
67
65
|
const variablesAndClasspaths = await getAndroidVariablesAndClasspaths(config);
|
|
68
66
|
if (!variablesAndClasspaths) {
|
|
@@ -72,11 +70,11 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
72
70
|
...config.app.package.dependencies,
|
|
73
71
|
...config.app.package.devDependencies,
|
|
74
72
|
};
|
|
75
|
-
const monorepoWarning = 'Please note this tool is not intended for use in a mono-repo environment,
|
|
73
|
+
const monorepoWarning = 'Please note this tool is not intended for use in a mono-repo environment, you should migrate manually instead. Refer to https://capacitorjs.com/docs/next/updating/8-0';
|
|
76
74
|
log_1.logger.info(monorepoWarning);
|
|
77
75
|
const { migrateconfirm } = noprompt
|
|
78
76
|
? { migrateconfirm: 'y' }
|
|
79
|
-
: await (0, log_1.logPrompt)(`Capacitor
|
|
77
|
+
: await (0, log_1.logPrompt)(`Capacitor 8 sets a deployment target of iOS ${iOSVersion} and Android 16 (SDK 36). \n`, {
|
|
80
78
|
type: 'text',
|
|
81
79
|
name: 'migrateconfirm',
|
|
82
80
|
message: `Are you sure you want to migrate? (Y/n)`,
|
|
@@ -112,7 +110,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
112
110
|
installerType = manager;
|
|
113
111
|
}
|
|
114
112
|
try {
|
|
115
|
-
await (0,
|
|
113
|
+
await (0, common_1.runTask)(`Installing Latest Modules using ${installerType}.`, () => {
|
|
116
114
|
return installLatestLibs(installerType, runNpmInstall, config);
|
|
117
115
|
});
|
|
118
116
|
}
|
|
@@ -122,15 +120,15 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
122
120
|
}
|
|
123
121
|
// Update iOS Projects
|
|
124
122
|
if (allDependencies['@capacitor/ios'] && (0, fs_extra_1.existsSync)(config.ios.platformDirAbs)) {
|
|
125
|
-
const currentiOSVersion = (0,
|
|
123
|
+
const currentiOSVersion = (0, common_2.getMajoriOSVersion)(config);
|
|
126
124
|
if (parseInt(currentiOSVersion) < parseInt(iOSVersion)) {
|
|
127
125
|
// ios template changes
|
|
128
|
-
await (0,
|
|
126
|
+
await (0, common_1.runTask)(`Migrating deployment target to ${iOSVersion}.0.`, () => {
|
|
129
127
|
return updateFile(config, (0, path_1.join)(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'IPHONEOS_DEPLOYMENT_TARGET = ', ';', `${iOSVersion}.0`);
|
|
130
128
|
});
|
|
131
129
|
if ((await (0, spm_1.checkPackageManager)(config)) === 'Cocoapods') {
|
|
132
130
|
// Update Podfile
|
|
133
|
-
await (0,
|
|
131
|
+
await (0, common_1.runTask)(`Migrating Podfile to ${iOSVersion}.0.`, () => {
|
|
134
132
|
return updateFile(config, (0, path_1.join)(config.ios.nativeProjectDirAbs, 'Podfile'), `platform :ios, '`, `'`, `${iOSVersion}.0`);
|
|
135
133
|
});
|
|
136
134
|
}
|
|
@@ -140,7 +138,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
if (!installFailed) {
|
|
143
|
-
await (0,
|
|
141
|
+
await (0, common_1.runTask)(`Running cap sync.`, () => {
|
|
144
142
|
return (0, subprocess_1.runCommand)('npx', ['cap', 'sync']);
|
|
145
143
|
});
|
|
146
144
|
}
|
|
@@ -148,18 +146,18 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
148
146
|
log_1.logger.warn('Skipped Running cap sync.');
|
|
149
147
|
}
|
|
150
148
|
if (allDependencies['@capacitor/android'] && (0, fs_extra_1.existsSync)(config.android.platformDirAbs)) {
|
|
151
|
-
// AndroidManifest.xml add
|
|
152
|
-
await (0,
|
|
149
|
+
// AndroidManifest.xml add "density"
|
|
150
|
+
await (0, common_1.runTask)(`Migrating AndroidManifest.xml by adding density to Activity configChanges.`, () => {
|
|
153
151
|
return updateAndroidManifest((0, path_1.join)(config.android.srcMainDirAbs, 'AndroidManifest.xml'));
|
|
154
152
|
});
|
|
155
153
|
const gradleWrapperVersion = getGradleWrapperVersion((0, path_1.join)(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
|
156
154
|
if (!installFailed && (0, semver_1.gte)(gradleVersion, gradleWrapperVersion)) {
|
|
157
155
|
try {
|
|
158
|
-
await (0,
|
|
156
|
+
await (0, common_1.runTask)(`Upgrading gradle wrapper`, () => {
|
|
159
157
|
return updateGradleWrapperFiles(config.android.platformDirAbs);
|
|
160
158
|
});
|
|
161
159
|
// Run twice as first time it only updates the wrapper properties file
|
|
162
|
-
await (0,
|
|
160
|
+
await (0, common_1.runTask)(`Upgrading gradle wrapper files`, () => {
|
|
163
161
|
return updateGradleWrapperFiles(config.android.platformDirAbs);
|
|
164
162
|
});
|
|
165
163
|
}
|
|
@@ -175,11 +173,14 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
175
173
|
else {
|
|
176
174
|
log_1.logger.warn('Skipped upgrading gradle wrapper files');
|
|
177
175
|
}
|
|
178
|
-
await (0,
|
|
176
|
+
await (0, common_1.runTask)(`Migrating root build.gradle file.`, () => {
|
|
179
177
|
return updateBuildGradle((0, path_1.join)(config.android.platformDirAbs, 'build.gradle'), variablesAndClasspaths);
|
|
180
178
|
});
|
|
179
|
+
await (0, common_1.runTask)(`Migrating app build.gradle file.`, () => {
|
|
180
|
+
return updateAppBuildGradle((0, path_1.join)(config.android.appDirAbs, 'build.gradle'));
|
|
181
|
+
});
|
|
181
182
|
// Variables gradle
|
|
182
|
-
await (0,
|
|
183
|
+
await (0, common_1.runTask)(`Migrating variables.gradle file.`, () => {
|
|
183
184
|
return (async () => {
|
|
184
185
|
const variablesPath = (0, path_1.join)(config.android.platformDirAbs, 'variables.gradle');
|
|
185
186
|
let txt = readFile(variablesPath);
|
|
@@ -214,18 +215,18 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
const pluginVariables = {
|
|
217
|
-
firebaseMessagingVersion: '
|
|
218
|
+
firebaseMessagingVersion: '25.0.1',
|
|
218
219
|
playServicesLocationVersion: '21.3.0',
|
|
219
|
-
androidxBrowserVersion: '1.
|
|
220
|
-
androidxMaterialVersion: '1.
|
|
221
|
-
androidxExifInterfaceVersion: '1.
|
|
222
|
-
androidxCoreKTXVersion: '1.
|
|
223
|
-
googleMapsPlayServicesVersion: '
|
|
224
|
-
googleMapsUtilsVersion: '3.
|
|
225
|
-
googleMapsKtxVersion: '5.
|
|
226
|
-
googleMapsUtilsKtxVersion: '5.
|
|
227
|
-
kotlinxCoroutinesVersion: '1.
|
|
228
|
-
coreSplashScreenVersion: '1.0
|
|
220
|
+
androidxBrowserVersion: '1.9.0',
|
|
221
|
+
androidxMaterialVersion: '1.13.0',
|
|
222
|
+
androidxExifInterfaceVersion: '1.4.1',
|
|
223
|
+
androidxCoreKTXVersion: '1.17.0',
|
|
224
|
+
googleMapsPlayServicesVersion: '19.2.0',
|
|
225
|
+
googleMapsUtilsVersion: '3.19.1',
|
|
226
|
+
googleMapsKtxVersion: '5.2.1',
|
|
227
|
+
googleMapsUtilsKtxVersion: '5.2.1',
|
|
228
|
+
kotlinxCoroutinesVersion: '1.10.2',
|
|
229
|
+
coreSplashScreenVersion: '1.2.0',
|
|
229
230
|
};
|
|
230
231
|
for (const variable of Object.keys(pluginVariables)) {
|
|
231
232
|
await updateFile(config, variablesPath, `${variable} = '`, `'`, pluginVariables[variable], true);
|
|
@@ -233,17 +234,9 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
233
234
|
})();
|
|
234
235
|
});
|
|
235
236
|
rimraf_1.rimraf.sync((0, path_1.join)(config.android.appDirAbs, 'build'));
|
|
236
|
-
if (!installFailed) {
|
|
237
|
-
await (0, common_2.runTask)('Migrating package from Manifest to build.gradle in Capacitor plugins', () => {
|
|
238
|
-
return patchOldCapacitorPlugins(config);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
log_1.logger.warn('Skipped migrating package from Manifest to build.gradle in Capacitor plugins');
|
|
243
|
-
}
|
|
244
237
|
}
|
|
245
238
|
// Write all breaking changes
|
|
246
|
-
await (0,
|
|
239
|
+
await (0, common_1.runTask)(`Writing breaking changes.`, () => {
|
|
247
240
|
return writeBreakingChanges();
|
|
248
241
|
});
|
|
249
242
|
if (!installFailed) {
|
|
@@ -264,7 +257,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
264
257
|
exports.migrateCommand = migrateCommand;
|
|
265
258
|
async function checkCapacitorMajorVersion(config) {
|
|
266
259
|
var _a;
|
|
267
|
-
const capacitorVersion = await (0,
|
|
260
|
+
const capacitorVersion = await (0, common_1.getCoreVersion)(config);
|
|
268
261
|
const versionArray = (_a = capacitorVersion.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/)) !== null && _a !== void 0 ? _a : [];
|
|
269
262
|
const majorVersion = parseInt(versionArray[1]);
|
|
270
263
|
return majorVersion;
|
|
@@ -311,11 +304,15 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
|
|
|
311
304
|
}
|
|
312
305
|
async function writeBreakingChanges() {
|
|
313
306
|
const breaking = [
|
|
314
|
-
'@capacitor/
|
|
315
|
-
'@capacitor/
|
|
316
|
-
'@capacitor/
|
|
307
|
+
'@capacitor/action-sheet',
|
|
308
|
+
'@capacitor/barcode-scanner',
|
|
309
|
+
'@capacitor/browser',
|
|
310
|
+
'@capacitor/camera',
|
|
311
|
+
'@capacitor/google-maps',
|
|
312
|
+
'@capacitor/push-notifications',
|
|
313
|
+
'@capacitor/screen-orientation',
|
|
317
314
|
'@capacitor/splash-screen',
|
|
318
|
-
'@capacitor/
|
|
315
|
+
'@capacitor/status-bar',
|
|
319
316
|
];
|
|
320
317
|
const broken = [];
|
|
321
318
|
for (const lib of breaking) {
|
|
@@ -324,7 +321,7 @@ async function writeBreakingChanges() {
|
|
|
324
321
|
}
|
|
325
322
|
}
|
|
326
323
|
if (broken.length > 0) {
|
|
327
|
-
log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/
|
|
324
|
+
log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/8-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
|
|
328
325
|
}
|
|
329
326
|
}
|
|
330
327
|
async function getAndroidVariablesAndClasspaths(config) {
|
|
@@ -384,47 +381,6 @@ async function updateGradleWrapperFiles(platformDir) {
|
|
|
384
381
|
cwd: platformDir,
|
|
385
382
|
});
|
|
386
383
|
}
|
|
387
|
-
async function movePackageFromManifestToBuildGradle(manifestFilename, buildGradleFilename) {
|
|
388
|
-
const manifestText = readFile(manifestFilename);
|
|
389
|
-
const buildGradleText = readFile(buildGradleFilename);
|
|
390
|
-
if (!manifestText) {
|
|
391
|
-
log_1.logger.error(`Could not read ${manifestFilename}. Check its permissions and if it exists.`);
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
if (!buildGradleText) {
|
|
395
|
-
log_1.logger.error(`Could not read ${buildGradleFilename}. Check its permissions and if it exists.`);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
const namespaceExists = new RegExp(/\s+namespace\s+/).test(buildGradleText);
|
|
399
|
-
if (namespaceExists) {
|
|
400
|
-
log_1.logger.error('Found namespace in build.gradle already, skipping migration');
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
let packageName;
|
|
404
|
-
const manifestRegEx = new RegExp(/package="([^"]+)"/);
|
|
405
|
-
const manifestResults = manifestRegEx.exec(manifestText);
|
|
406
|
-
if (manifestResults === null) {
|
|
407
|
-
log_1.logger.error(`Unable to update Android Manifest. Package not found.`);
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
packageName = manifestResults[1];
|
|
412
|
-
}
|
|
413
|
-
let manifestReplaced = manifestText;
|
|
414
|
-
manifestReplaced = manifestReplaced.replace(manifestRegEx, '');
|
|
415
|
-
if (manifestText == manifestReplaced) {
|
|
416
|
-
log_1.logger.error(`Unable to update Android Manifest: no changes were detected in Android Manifest file`);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
let buildGradleReplaced = buildGradleText;
|
|
420
|
-
buildGradleReplaced = setAllStringIn(buildGradleText, 'android {', '\n', `\n namespace "${packageName}"`);
|
|
421
|
-
if (buildGradleText == buildGradleReplaced) {
|
|
422
|
-
log_1.logger.error(`Unable to update buildGradleText: no changes were detected in Android Manifest file`);
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
(0, fs_extra_1.writeFileSync)(manifestFilename, manifestReplaced, 'utf-8');
|
|
426
|
-
(0, fs_extra_1.writeFileSync)(buildGradleFilename, buildGradleReplaced, 'utf-8');
|
|
427
|
-
}
|
|
428
384
|
async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
429
385
|
const txt = readFile(filename);
|
|
430
386
|
if (!txt) {
|
|
@@ -445,6 +401,38 @@ async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
|
445
401
|
}
|
|
446
402
|
}
|
|
447
403
|
}
|
|
404
|
+
const beforeKotlinVersionUpdate = replaced;
|
|
405
|
+
replaced = replaceVersion(replaced, /(ext\.kotlin_version\s*=\s*['"])([^'"]+)(['"])/, kotlinVersion);
|
|
406
|
+
replaced = replaceVersion(replaced, /(org\.jetbrains\.kotlin:kotlin[^:]*:)([\d.]+)(['"])/, kotlinVersion);
|
|
407
|
+
if (beforeKotlinVersionUpdate !== replaced) {
|
|
408
|
+
log_1.logger.info(`Set Kotlin version to ${kotlinVersion}`);
|
|
409
|
+
}
|
|
410
|
+
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
411
|
+
}
|
|
412
|
+
function replaceVersion(text, regex, newVersion) {
|
|
413
|
+
return text.replace(regex, (match, prefix, currentVersion, suffix) => {
|
|
414
|
+
var _a;
|
|
415
|
+
const semVer = (_a = (0, semver_1.coerce)(currentVersion)) === null || _a === void 0 ? void 0 : _a.version;
|
|
416
|
+
if ((0, semver_1.gte)(newVersion, semVer ? semVer : '0.0.0')) {
|
|
417
|
+
return `${prefix || ''}${newVersion}${suffix || ''}`;
|
|
418
|
+
}
|
|
419
|
+
return match;
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
async function updateAppBuildGradle(filename) {
|
|
423
|
+
const txt = readFile(filename);
|
|
424
|
+
if (!txt) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
let replaced = txt;
|
|
428
|
+
const gradlePproperties = ['compileSdk', 'namespace', 'ignoreAssetsPattern'];
|
|
429
|
+
for (const prop of gradlePproperties) {
|
|
430
|
+
// Use updated Groovy DSL syntax with " = " assignment
|
|
431
|
+
const regex = new RegExp(`(^\\s*${prop})\\s+(?!=)(.+)$`, 'gm');
|
|
432
|
+
replaced = replaced.replace(regex, (_match, key, value) => {
|
|
433
|
+
return `${key} = ${value.trim()}`;
|
|
434
|
+
});
|
|
435
|
+
}
|
|
448
436
|
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
449
437
|
}
|
|
450
438
|
async function updateFile(config, filename, textStart, textEnd, replacement, skipIfNotFound) {
|
|
@@ -513,33 +501,17 @@ async function updateAndroidManifest(filename) {
|
|
|
513
501
|
if (!txt) {
|
|
514
502
|
return;
|
|
515
503
|
}
|
|
516
|
-
if (txt.includes('
|
|
504
|
+
if (txt.includes('|density') || txt.includes('density|')) {
|
|
517
505
|
return; // Probably already updated
|
|
518
506
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
const manifestPath = (0, node_1.resolveNode)(config.app.rootDir, p.id, p.manifest.android.src, 'src', 'main', 'AndroidManifest.xml');
|
|
530
|
-
if (buildGradlePath && manifestPath) {
|
|
531
|
-
const gradleContent = readFile(buildGradlePath);
|
|
532
|
-
if (!(gradleContent === null || gradleContent === void 0 ? void 0 : gradleContent.includes('namespace'))) {
|
|
533
|
-
if (plugins.includes(p.id)) {
|
|
534
|
-
log_1.logger.warn(`You are using an outdated version of ${p.id}, update the plugin to version ${pluginVersion}`);
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
log_1.logger.warn(`${p.id}@${p.version} doesn't officially support Capacitor ${coreVersion} yet, doing our best moving it's package to build.gradle so it builds`);
|
|
538
|
-
}
|
|
539
|
-
movePackageFromManifestToBuildGradle(manifestPath, buildGradlePath);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}));
|
|
507
|
+
// Since navigation was an optional change in Capacitor 7, attempting to add density and/or navigation
|
|
508
|
+
const replaced = txt
|
|
509
|
+
.replace('android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"', 'android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"')
|
|
510
|
+
.replace('android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"', 'android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"');
|
|
511
|
+
if (!replaced.includes('|density')) {
|
|
512
|
+
log_1.logger.error(`Unable to add 'density' to 'android:configChanges' in ${filename}. Try adding it manually`);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
516
|
+
}
|
|
544
517
|
}
|
|
545
|
-
exports.patchOldCapacitorPlugins = patchOldCapacitorPlugins;
|
package/dist/util/native-run.js
CHANGED
|
@@ -13,7 +13,12 @@ async function runNativeRun(args, options = {}) {
|
|
|
13
13
|
if (!p) {
|
|
14
14
|
(0, errors_1.fatal)(`${colors_1.default.input('native-run')} not found.`);
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if (process.versions.pnp) {
|
|
17
|
+
return await (0, subprocess_1.runCommand)('yarn', ['node', p, ...args], options);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return await (0, subprocess_1.runCommand)(p, args, options);
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
exports.runNativeRun = runNativeRun;
|
|
19
24
|
async function getPlatformTargets(platformName) {
|
package/dist/util/spm.js
CHANGED
|
@@ -45,7 +45,7 @@ async function checkPluginsForPackageSwift(config, plugins) {
|
|
|
45
45
|
log_1.logger.info('All plugins have a Package.swift file and will be included in Package.swift');
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
log_1.logger.warn('Some installed packages
|
|
48
|
+
log_1.logger.warn('Some installed packages are not compatable with SPM');
|
|
49
49
|
}
|
|
50
50
|
return packageSwiftPluginList;
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "8.0.0-
|
|
3
|
+
"version": "8.0.0-beta.0",
|
|
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": ">=22.0.0"
|
|
31
31
|
},
|
|
32
32
|
"main": "dist/index.js",
|
|
33
33
|
"types": "dist/declarations.d.ts",
|