@capacitor/cli 5.0.0-rc.0 → 5.0.0-rc.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-template.tar.gz +0 -0
- package/dist/common.js +24 -1
- package/dist/tasks/migrate.js +31 -13
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolvePlatform = exports.checkPlatformVersions = exports.getAddedPlatforms = exports.getPlatformTargetName = exports.promptForPlatformTarget = exports.promptForPlatform = exports.isValidEnterprisePlatform = exports.getKnownEnterprisePlatforms = exports.isValidCommunityPlatform = exports.getKnownCommunityPlatforms = exports.isValidPlatform = exports.getKnownPlatforms = exports.selectPlatforms = exports.getProjectPlatformDirectory = exports.getCLIVersion = exports.getCoreVersion = exports.getCapacitorPackageVersion = exports.requireCapacitorPackage = exports.getCapacitorPackage = exports.runTask = exports.runPlatformHook = exports.wait = exports.checkAppName = exports.checkAppId = exports.checkAppDir = exports.checkAppConfig = exports.checkCapacitorPlatform = exports.checkPackage = exports.checkWebDir = exports.check = void 0;
|
|
3
|
+
exports.checkJDKMajorVersion = exports.resolvePlatform = exports.checkPlatformVersions = exports.getAddedPlatforms = exports.getPlatformTargetName = exports.promptForPlatformTarget = exports.promptForPlatform = exports.isValidEnterprisePlatform = exports.getKnownEnterprisePlatforms = exports.isValidCommunityPlatform = exports.getKnownCommunityPlatforms = exports.isValidPlatform = exports.getKnownPlatforms = exports.selectPlatforms = exports.getProjectPlatformDirectory = exports.getCLIVersion = exports.getCoreVersion = exports.getCapacitorPackageVersion = exports.requireCapacitorPackage = exports.getCapacitorPackage = exports.runTask = exports.runPlatformHook = exports.wait = exports.checkAppName = exports.checkAppId = exports.checkAppDir = exports.checkAppConfig = exports.checkCapacitorPlatform = exports.checkPackage = exports.checkWebDir = exports.check = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const utils_terminal_1 = require("@ionic/utils-terminal");
|
|
@@ -9,6 +9,7 @@ const colors_1 = tslib_1.__importDefault(require("./colors"));
|
|
|
9
9
|
const errors_1 = require("./errors");
|
|
10
10
|
const log_1 = require("./log");
|
|
11
11
|
const node_1 = require("./util/node");
|
|
12
|
+
const subprocess_1 = require("./util/subprocess");
|
|
12
13
|
async function check(checks) {
|
|
13
14
|
const results = await Promise.all(checks.map(f => f()));
|
|
14
15
|
const errors = results.filter(r => r != null);
|
|
@@ -351,3 +352,25 @@ function resolvePlatform(config, platform) {
|
|
|
351
352
|
return null;
|
|
352
353
|
}
|
|
353
354
|
exports.resolvePlatform = resolvePlatform;
|
|
355
|
+
async function checkJDKMajorVersion() {
|
|
356
|
+
const string = await (0, subprocess_1.runCommand)('java', ['--version']);
|
|
357
|
+
const versionRegex = RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/);
|
|
358
|
+
const versionMatch = versionRegex.exec(string);
|
|
359
|
+
if (versionMatch === null) {
|
|
360
|
+
return -1;
|
|
361
|
+
}
|
|
362
|
+
const firstVersionNumber = parseInt(versionMatch[1]);
|
|
363
|
+
const secondVersionNumber = parseInt(versionMatch[2]);
|
|
364
|
+
if (typeof firstVersionNumber === 'number' && firstVersionNumber != 1) {
|
|
365
|
+
return firstVersionNumber;
|
|
366
|
+
}
|
|
367
|
+
else if (typeof secondVersionNumber === 'number' &&
|
|
368
|
+
firstVersionNumber == 1 &&
|
|
369
|
+
secondVersionNumber < 9) {
|
|
370
|
+
return secondVersionNumber;
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
return -1;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
exports.checkJDKMajorVersion = checkJDKMajorVersion;
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -58,6 +58,10 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
58
58
|
if (capMajor < 4) {
|
|
59
59
|
(0, errors_1.fatal)('Migrate can only be used on capacitor 4 and above, please use the CLI in Capacitor 4 to upgrade to 4 first');
|
|
60
60
|
}
|
|
61
|
+
const jdkMajor = await (0, common_1.checkJDKMajorVersion)();
|
|
62
|
+
if (jdkMajor < 17) {
|
|
63
|
+
log_1.logger.warn('Capacitor 5 requires JDK 17 or higher. Some steps may fail.');
|
|
64
|
+
}
|
|
61
65
|
const variablesAndClasspaths = await getAndroidVariablesAndClasspaths(config);
|
|
62
66
|
if (!variablesAndClasspaths) {
|
|
63
67
|
(0, errors_1.fatal)('Variable and Classpath info could not be read.');
|
|
@@ -174,6 +178,11 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
174
178
|
androidxMaterialVersion: '1.8.0',
|
|
175
179
|
androidxExifInterfaceVersion: '1.3.6',
|
|
176
180
|
androidxCoreKTXVersion: '1.10.0',
|
|
181
|
+
googleMapsPlayServicesVersion: '18.1.0',
|
|
182
|
+
googleMapsUtilsVersion: '3.4.0',
|
|
183
|
+
googleMapsKtxVersion: '3.4.0',
|
|
184
|
+
googleMapsUtilsKtxVersion: '3.4.0',
|
|
185
|
+
kotlinxCoroutinesVersion: '1.6.4',
|
|
177
186
|
};
|
|
178
187
|
for (const variable of Object.keys(pluginVariables)) {
|
|
179
188
|
await updateFile(config, variablesPath, `${variable} = '`, `'`, pluginVariables[variable], true);
|
|
@@ -186,17 +195,20 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
186
195
|
await (0, common_1.runTask)(`Running cap sync.`, () => {
|
|
187
196
|
return (0, subprocess_1.getCommandOutput)('npx', ['cap', 'sync']);
|
|
188
197
|
});
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (e.includes('EACCES')) {
|
|
196
|
-
log_1.logger.error(`gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${colors_1.default.input(`chmod +x ./${config.android.platformDir}/gradlew`)} and ${colors_1.default.input(`cd ${config.android.platformDir} && ./gradlew wrapper --distribution-type all --gradle-version ${gradleVersion} --warning-mode all`)} to update the files manually`);
|
|
198
|
+
if (allDependencies['@capacitor/android'] &&
|
|
199
|
+
(0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
|
|
200
|
+
try {
|
|
201
|
+
await (0, common_1.runTask)(`Upgrading gradle wrapper files`, () => {
|
|
202
|
+
return updateGradleWrapperFiles(config.android.platformDirAbs);
|
|
203
|
+
});
|
|
197
204
|
}
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
catch (e) {
|
|
206
|
+
if (e.includes('EACCES')) {
|
|
207
|
+
log_1.logger.error(`gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${colors_1.default.input(`chmod +x ./${config.android.platformDir}/gradlew`)} and ${colors_1.default.input(`cd ${config.android.platformDir} && ./gradlew wrapper --distribution-type all --gradle-version ${gradleVersion} --warning-mode all`)} to update the files manually`);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
log_1.logger.error(`gradle wrapper files were not updated`);
|
|
211
|
+
}
|
|
200
212
|
}
|
|
201
213
|
}
|
|
202
214
|
// Write all breaking changes
|
|
@@ -263,15 +275,21 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
|
|
|
263
275
|
}
|
|
264
276
|
}
|
|
265
277
|
async function writeBreakingChanges() {
|
|
266
|
-
const breaking = [
|
|
278
|
+
const breaking = [
|
|
279
|
+
'@capacitor/camera',
|
|
280
|
+
'@capacitor/device',
|
|
281
|
+
'@capacitor/local-notifications',
|
|
282
|
+
'@capacitor/push-notifications',
|
|
283
|
+
];
|
|
267
284
|
const broken = [];
|
|
268
285
|
for (const lib of breaking) {
|
|
269
286
|
if (allDependencies[lib]) {
|
|
270
287
|
broken.push(lib);
|
|
271
288
|
}
|
|
272
289
|
}
|
|
290
|
+
// TODO - remove "next" from the url once capacitor 5 is final
|
|
273
291
|
if (broken.length > 0) {
|
|
274
|
-
log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/updating/5-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
|
|
292
|
+
log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/5-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
|
|
275
293
|
}
|
|
276
294
|
}
|
|
277
295
|
async function getAndroidVariablesAndClasspaths(config) {
|
|
@@ -445,7 +463,7 @@ async function movePackageFromManifestToBuildGradle(manifestFilename, buildGradl
|
|
|
445
463
|
return;
|
|
446
464
|
}
|
|
447
465
|
let buildGradleReplaced = buildGradleText;
|
|
448
|
-
buildGradleReplaced = setAllStringIn(buildGradleText, 'android {', '
|
|
466
|
+
buildGradleReplaced = setAllStringIn(buildGradleText, 'android {', '\n', `\n namespace "${packageName}"`);
|
|
449
467
|
if (buildGradleText == buildGradleReplaced) {
|
|
450
468
|
log_1.logger.error(`Unable to update buildGradleText: no changes were detected in Android Manifest file`);
|
|
451
469
|
return;
|
package/package.json
CHANGED