@capacitor/cli 5.5.2-nightly-20231108T150443.0 → 6.0.0-alpha.2
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/tasks/migrate.js +31 -100
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -50,21 +50,21 @@ const plugins = [
|
|
|
50
50
|
'@capacitor/text-zoom',
|
|
51
51
|
'@capacitor/toast',
|
|
52
52
|
];
|
|
53
|
-
const coreVersion = '
|
|
54
|
-
const pluginVersion = '
|
|
55
|
-
const gradleVersion = '8.
|
|
53
|
+
const coreVersion = 'next';
|
|
54
|
+
const pluginVersion = 'next';
|
|
55
|
+
const gradleVersion = '8.2.1';
|
|
56
56
|
let installFailed = false;
|
|
57
57
|
async function migrateCommand(config, noprompt, packagemanager) {
|
|
58
58
|
if (config === null) {
|
|
59
59
|
(0, errors_1.fatal)('Config data missing');
|
|
60
60
|
}
|
|
61
61
|
const capMajor = await checkCapacitorMajorVersion(config);
|
|
62
|
-
if (capMajor <
|
|
63
|
-
(0, errors_1.fatal)('Migrate can only be used on capacitor
|
|
62
|
+
if (capMajor < 5) {
|
|
63
|
+
(0, errors_1.fatal)('Migrate can only be used on capacitor 5 and above, please use the CLI in Capacitor 5 to upgrade to 5 first');
|
|
64
64
|
}
|
|
65
65
|
const jdkMajor = await (0, common_2.checkJDKMajorVersion)();
|
|
66
66
|
if (jdkMajor < 17) {
|
|
67
|
-
log_1.logger.warn('Capacitor
|
|
67
|
+
log_1.logger.warn('Capacitor 6 requires JDK 17 or higher. Some steps may fail.');
|
|
68
68
|
}
|
|
69
69
|
const variablesAndClasspaths = await getAndroidVariablesAndClasspaths(config);
|
|
70
70
|
if (!variablesAndClasspaths) {
|
|
@@ -78,7 +78,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
78
78
|
log_1.logger.info(monorepoWarning);
|
|
79
79
|
const { migrateconfirm } = noprompt
|
|
80
80
|
? { migrateconfirm: 'y' }
|
|
81
|
-
: await (0, log_1.logPrompt)(`Capacitor
|
|
81
|
+
: await (0, log_1.logPrompt)(`Capacitor 6 sets a deployment target of iOS 13 and Android 14 (SDK 34). \n`, {
|
|
82
82
|
type: 'text',
|
|
83
83
|
name: 'migrateconfirm',
|
|
84
84
|
message: `Are you sure you want to migrate? (Y/n)`,
|
|
@@ -126,27 +126,28 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
126
126
|
// Update iOS Projects
|
|
127
127
|
if (allDependencies['@capacitor/ios'] &&
|
|
128
128
|
(0, utils_fs_1.existsSync)(config.ios.platformDirAbs)) {
|
|
129
|
-
//
|
|
130
|
-
await (0, common_2.runTask)('Update App Icon to only 1024 x 1024', () => {
|
|
131
|
-
return updateAppIcons(config);
|
|
132
|
-
});
|
|
133
|
-
//Remove Podfile.lock from .gitignore
|
|
134
|
-
await (0, common_2.runTask)('Remove Podfile.lock from iOS .gitignore', () => {
|
|
135
|
-
return updateIosGitIgnore((0, path_1.join)(config.ios.platformDirAbs, '.gitignore'));
|
|
136
|
-
});
|
|
129
|
+
// ios template changes
|
|
137
130
|
}
|
|
138
131
|
if (allDependencies['@capacitor/android'] &&
|
|
139
132
|
(0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
|
|
140
133
|
await (0, common_2.runTask)(`Migrating build.gradle file.`, () => {
|
|
141
134
|
return updateBuildGradle((0, path_1.join)(config.android.platformDirAbs, 'build.gradle'), variablesAndClasspaths);
|
|
142
135
|
});
|
|
143
|
-
//
|
|
144
|
-
await (0, common_2.runTask)('
|
|
145
|
-
return
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
136
|
+
// Replace deprecated compileSdkVersion
|
|
137
|
+
await (0, common_2.runTask)('Replacing deprecated compileSdkVersion from build.gradle', () => {
|
|
138
|
+
return (async () => {
|
|
139
|
+
const buildGradleFilename = (0, path_1.join)(config.android.platformDirAbs, 'app', 'build.gradle');
|
|
140
|
+
const buildGradleText = readFile(buildGradleFilename);
|
|
141
|
+
if (!buildGradleText) {
|
|
142
|
+
log_1.logger.error(`Could not read ${buildGradleFilename}. Check its permissions and if it exists.`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const compileSdk = `compileSdkVersion rootProject.ext.compileSdkVersion`;
|
|
146
|
+
if (buildGradleText.includes(compileSdk)) {
|
|
147
|
+
const buildGradleReplaced = buildGradleText.replace(compileSdk, `compileSdk rootProject.ext.compileSdkVersion`);
|
|
148
|
+
(0, utils_fs_1.writeFileSync)(buildGradleFilename, buildGradleReplaced, 'utf-8');
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
150
151
|
});
|
|
151
152
|
// Update gradle-wrapper.properties
|
|
152
153
|
await (0, common_2.runTask)(`Migrating gradle-wrapper.properties by updating gradle version to ${gradleVersion}.`, () => {
|
|
@@ -175,17 +176,18 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
const pluginVariables = {
|
|
178
|
-
firebaseMessagingVersion: '23.1
|
|
179
|
+
firebaseMessagingVersion: '23.2.1',
|
|
179
180
|
playServicesLocationVersion: '21.0.1',
|
|
180
181
|
androidxBrowserVersion: '1.5.0',
|
|
181
|
-
androidxMaterialVersion: '1.
|
|
182
|
+
androidxMaterialVersion: '1.10.0',
|
|
182
183
|
androidxExifInterfaceVersion: '1.3.6',
|
|
183
|
-
androidxCoreKTXVersion: '1.
|
|
184
|
+
androidxCoreKTXVersion: '1.12.0',
|
|
184
185
|
googleMapsPlayServicesVersion: '18.1.0',
|
|
185
|
-
googleMapsUtilsVersion: '3.
|
|
186
|
+
googleMapsUtilsVersion: '3.5.3',
|
|
186
187
|
googleMapsKtxVersion: '3.4.0',
|
|
187
188
|
googleMapsUtilsKtxVersion: '3.4.0',
|
|
188
|
-
kotlinxCoroutinesVersion: '1.
|
|
189
|
+
kotlinxCoroutinesVersion: '1.7.3',
|
|
190
|
+
coreSplashScreenVersion: '1.0.1',
|
|
189
191
|
};
|
|
190
192
|
for (const variable of Object.keys(pluginVariables)) {
|
|
191
193
|
await updateFile(config, variablesPath, `${variable} = '`, `'`, pluginVariables[variable], true);
|
|
@@ -383,77 +385,6 @@ async function updateGradleWrapperFiles(platformDir) {
|
|
|
383
385
|
cwd: platformDir,
|
|
384
386
|
});
|
|
385
387
|
}
|
|
386
|
-
async function updateIosGitIgnore(filename) {
|
|
387
|
-
const txt = readFile(filename);
|
|
388
|
-
if (!txt) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
const lines = txt.split('\n');
|
|
392
|
-
let linesToKeep = '';
|
|
393
|
-
for (const line of lines) {
|
|
394
|
-
// check for enableJetifier
|
|
395
|
-
const podfileMatch = line.match(/.+Podfile\.lock/) || [];
|
|
396
|
-
if (podfileMatch.length == 0) {
|
|
397
|
-
linesToKeep += line + '\n';
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
(0, utils_fs_1.writeFileSync)(filename, linesToKeep, { encoding: 'utf-8' });
|
|
401
|
-
}
|
|
402
|
-
async function updateAppIcons(config) {
|
|
403
|
-
const iconToKeep = 'AppIcon-512@2x.png';
|
|
404
|
-
const contentsFile = 'Contents.json';
|
|
405
|
-
const newContentsFileContents = `{
|
|
406
|
-
"images" : [
|
|
407
|
-
{
|
|
408
|
-
"filename" : "${iconToKeep}",
|
|
409
|
-
"idiom" : "universal",
|
|
410
|
-
"platform" : "ios",
|
|
411
|
-
"size" : "1024x1024"
|
|
412
|
-
}
|
|
413
|
-
],
|
|
414
|
-
"info" : {
|
|
415
|
-
"author" : "xcode",
|
|
416
|
-
"version" : 1
|
|
417
|
-
}
|
|
418
|
-
}`;
|
|
419
|
-
const path = (0, path_1.join)(config.ios.platformDirAbs, 'App', 'App', 'Assets.xcassets', 'AppIcon.appiconset');
|
|
420
|
-
if (!(0, utils_fs_1.existsSync)(path)) {
|
|
421
|
-
log_1.logger.error(`Unable to find ${path}. Try updating it manually`);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
if (!(0, utils_fs_1.existsSync)((0, path_1.join)(path, iconToKeep))) {
|
|
425
|
-
log_1.logger.error(`Unable to find ${iconToKeep}. Try updating it manually`);
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
if (!(0, utils_fs_1.existsSync)((0, path_1.join)(path, contentsFile))) {
|
|
429
|
-
log_1.logger.error(`Unable to find ${path}. Try updating it manually`);
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
const filenames = (0, utils_fs_1.readdirSync)(path);
|
|
433
|
-
for (const filename of filenames) {
|
|
434
|
-
if (filename != iconToKeep && filename != contentsFile) {
|
|
435
|
-
(0, utils_fs_1.removeSync)((0, path_1.join)(path, filename));
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
(0, utils_fs_1.writeFileSync)((0, path_1.join)(path, contentsFile), newContentsFileContents);
|
|
439
|
-
}
|
|
440
|
-
async function updateGradleProperties(filename) {
|
|
441
|
-
const txt = readFile(filename);
|
|
442
|
-
if (!txt) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
const lines = txt.split('\n');
|
|
446
|
-
let linesToKeep = '';
|
|
447
|
-
for (const line of lines) {
|
|
448
|
-
// check for enableJetifier
|
|
449
|
-
const jetifierMatch = line.match(/android\.enableJetifier\s*=\s*true/) || [];
|
|
450
|
-
const commentMatch = line.match(/# Automatically convert third-party libraries to use AndroidX/) || [];
|
|
451
|
-
if (jetifierMatch.length == 0 && commentMatch.length == 0) {
|
|
452
|
-
linesToKeep += line + '\n';
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
(0, utils_fs_1.writeFileSync)(filename, linesToKeep, { encoding: 'utf-8' });
|
|
456
|
-
}
|
|
457
388
|
async function movePackageFromManifestToBuildGradle(manifestFilename, buildGradleFilename) {
|
|
458
389
|
const manifestText = readFile(manifestFilename);
|
|
459
390
|
const buildGradleText = readFile(buildGradleFilename);
|
|
@@ -497,8 +428,8 @@ async function movePackageFromManifestToBuildGradle(manifestFilename, buildGradl
|
|
|
497
428
|
}
|
|
498
429
|
async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
499
430
|
// In build.gradle add dependencies:
|
|
500
|
-
// classpath 'com.android.tools.build:gradle:8.
|
|
501
|
-
// classpath 'com.google.gms:google-services:4.
|
|
431
|
+
// classpath 'com.android.tools.build:gradle:8.2.0-rc02'
|
|
432
|
+
// classpath 'com.google.gms:google-services:4.4.0'
|
|
502
433
|
const txt = readFile(filename);
|
|
503
434
|
if (!txt) {
|
|
504
435
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.2",
|
|
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)",
|