@capacitor/cli 5.0.0-beta.2 → 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.
Binary file
Binary file
@@ -146,8 +146,8 @@ project(':${getGradlePackageName(p.id)}').projectDir = new File('${relativePlugi
146
146
 
147
147
  android {
148
148
  compileOptions {
149
- sourceCompatibility JavaVersion.VERSION_11
150
- targetCompatibility JavaVersion.VERSION_11
149
+ sourceCompatibility JavaVersion.VERSION_17
150
+ targetCompatibility JavaVersion.VERSION_17
151
151
  }
152
152
  }
153
153
 
package/dist/config.js CHANGED
@@ -353,13 +353,6 @@ const config: CapacitorConfig = ${(0, js_1.formatJSObject)(extConfig)};
353
353
  export default config;\n`;
354
354
  }
355
355
  function checkExternalConfig(config) {
356
- var _a, _b;
357
- if (typeof config.extConfig.hideLogs !== 'undefined' ||
358
- typeof ((_a = config.extConfig.android) === null || _a === void 0 ? void 0 : _a.hideLogs) !== 'undefined' ||
359
- typeof ((_b = config.extConfig.ios) === null || _b === void 0 ? void 0 : _b.hideLogs) !== 'undefined') {
360
- log_1.logger.warn(`The ${colors_1.default.strong('hideLogs')} configuration option has been deprecated. ` +
361
- `Please update to use ${colors_1.default.strong('loggingBehavior')} instead.`);
362
- }
363
356
  if (typeof config.extConfig.bundledWebRuntime !== 'undefined') {
364
357
  let actionMessage = `Can be safely deleted.`;
365
358
  if (config.extConfig.bundledWebRuntime === true) {
@@ -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
  *
@@ -574,7 +546,7 @@ export interface PluginsConfig {
574
546
  * @since 5.0.0
575
547
  */
576
548
  FederatedCapacitor?: {
577
- shell: FederatedApp;
549
+ shell: Omit<FederatedApp, 'webDir'>;
578
550
  apps: FederatedApp[];
579
551
  liveUpdatesKey?: string;
580
552
  };
@@ -154,16 +154,22 @@ async function copyFederatedWebDirs(config, nativeAbsDir) {
154
154
  }
155
155
  const federatedConfig = config.app.extConfig.plugins.FederatedCapacitor;
156
156
  if (federatedConfig) {
157
- if (!isFederatedApp(federatedConfig.shell)) {
157
+ if (federatedConfig.shell.name === undefined) {
158
158
  throw `FederatedCapacitor plugin is present but no valid Shell application is defined in the config.`;
159
159
  }
160
160
  if (!federatedConfig.apps.every(isFederatedApp)) {
161
161
  throw `FederatedCapacitor plugin is present but there is a problem with the apps defined in the config.`;
162
162
  }
163
- await Promise.all([...federatedConfig.apps, federatedConfig.shell].map(app => {
164
- const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
165
- return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
166
- }));
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()]);
167
173
  }
168
174
  }
169
175
  function isFederatedApp(config) {
@@ -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 = '7.5';
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:7.4.1'
413
- // classpath 'com.google.gms:google-services:4.3.13'
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "5.0.0-beta.2",
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": ">=12.4.0"
30
+ "node": ">=16.0.0"
31
31
  },
32
32
  "main": "dist/index.js",
33
33
  "types": "dist/declarations.d.ts",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "80b59984c0bf07e0c2d2a6310f7a7ff2679606ab"
88
+ "gitHead": "60ffcc36bc4948876b94f1f7a0470c68b6a7e50f"
89
89
  }