@capacitor/cli 4.2.0 → 4.2.1-dev-20220921T210130.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.
Binary file
Binary file
package/dist/cordova.js CHANGED
@@ -263,7 +263,11 @@ async function logCordovaManualSteps(cordovaPlugins, config, platform) {
263
263
  }
264
264
  exports.logCordovaManualSteps = logCordovaManualSteps;
265
265
  async function logiOSPlist(configElement, config, plugin) {
266
+ var _a, _b;
266
267
  let plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Info.plist');
268
+ if ((_a = config.app.extConfig.ios) === null || _a === void 0 ? void 0 : _a.scheme) {
269
+ plistPath = path_1.resolve(config.ios.nativeProjectDirAbs, `${(_b = config.app.extConfig.ios) === null || _b === void 0 ? void 0 : _b.scheme}-Info.plist`);
270
+ }
267
271
  if (!(await utils_fs_1.pathExists(plistPath))) {
268
272
  plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Base.lproj', 'Info.plist');
269
273
  }
@@ -196,6 +196,10 @@ export interface CapacitorConfig {
196
196
  *
197
197
  * The minimum supported cannot be lower than version `55`, which is required for Capacitor.
198
198
  *
199
+ * If the device uses a lower WebView version, an error message will be shown on Logcat.
200
+ * If `server.errorPath` is configured, the WebView will redirect to that file, so can be
201
+ * used to show a custom error.
202
+ *
199
203
  * @since 4.0.0
200
204
  * @default 60
201
205
  */
@@ -361,6 +365,7 @@ export interface CapacitorConfig {
361
365
  /**
362
366
  * Configure the local scheme on iOS.
363
367
  *
368
+ * [Can't be set to schemes that the WKWebView already handles, such as http or https](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/2875766-seturlschemehandler)
364
369
  * This can be useful when migrating from
365
370
  * [`cordova-plugin-ionic-webview`](https://github.com/ionic-team/cordova-plugin-ionic-webview),
366
371
  * where the default scheme on iOS is `ionic`.
@@ -414,6 +419,7 @@ export interface CapacitorConfig {
414
419
  allowNavigation?: string[];
415
420
  /**
416
421
  * Specify path to a local html page to display in case of errors.
422
+ * On Android the html file won't have access to Capacitor plugins.
417
423
  *
418
424
  * @since 4.0.0
419
425
  * @default null
@@ -503,4 +509,30 @@ export interface PluginsConfig {
503
509
  * @since 4.2.0
504
510
  */
505
511
  LiveUpdates?: LiveUpdateConfig;
512
+ /**
513
+ * Capacitor Cookies plugin configuration
514
+ *
515
+ * @since 4.3.0
516
+ */
517
+ CapacitorCookies?: {
518
+ /**
519
+ * Enable CapacitorCookies to override the global `document.cookie` on native.
520
+ *
521
+ * @default false
522
+ */
523
+ enabled?: boolean;
524
+ };
525
+ /**
526
+ * Capacitor Http plugin configuration
527
+ *
528
+ * @since 4.3.0
529
+ */
530
+ CapacitorHttp?: {
531
+ /**
532
+ * Enable CapacitorHttp to override the global `fetch` and `XMLHttpRequest` on native.
533
+ *
534
+ * @default false
535
+ */
536
+ enabled?: boolean;
537
+ };
506
538
  }
@@ -85,7 +85,7 @@ async function generatePodFile(config, plugins) {
85
85
  if (!p.ios) {
86
86
  return '';
87
87
  }
88
- return ` pod '${p.ios.name}', :path => '${path_1.relative(podfilePath, await utils_fs_1.realpath(p.rootPath))}'\n`;
88
+ return ` pod '${p.ios.name}', :path => '${fs_1.convertToUnixPath(path_1.relative(podfilePath, await utils_fs_1.realpath(p.rootPath)))}'\n`;
89
89
  }));
90
90
  const cordovaPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 1 /* Cordova */);
91
91
  cordovaPlugins.map(async (p) => {
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const utils_fs_1 = require("@ionic/utils-fs");
6
6
  const path_1 = require("path");
7
7
  const rimraf_1 = tslib_1.__importDefault(require("rimraf"));
8
+ const colors_1 = tslib_1.__importDefault(require("../colors"));
8
9
  const common_1 = require("../common");
9
10
  const errors_1 = require("../errors");
10
11
  const log_1 = require("../log");
@@ -48,6 +49,7 @@ const plugins = [
48
49
  ];
49
50
  const coreVersion = '^4.0.0';
50
51
  const pluginVersion = '^4.0.0';
52
+ const gradleVersion = '7.4.2';
51
53
  async function migrateCommand(config) {
52
54
  if (config === null) {
53
55
  errors_1.fatal('Config data missing');
@@ -80,12 +82,22 @@ async function migrateCommand(config) {
80
82
  });
81
83
  const runNpmInstall = typeof npmInstallConfirm === 'string' &&
82
84
  npmInstallConfirm.toLowerCase() === 'y';
83
- await common_1.runTask(`Installing Latest NPM Modules.`, () => {
84
- return installLatestNPMLibs(runNpmInstall, config);
85
- });
86
- await common_1.runTask(`Migrating @capacitor/storage to @capacitor/preferences.`, () => {
87
- return migrateStoragePluginToPreferences(runNpmInstall);
88
- });
85
+ try {
86
+ await common_1.runTask(`Installing Latest NPM Modules.`, () => {
87
+ return installLatestNPMLibs(runNpmInstall, config);
88
+ });
89
+ }
90
+ catch (ex) {
91
+ log_1.logger.error(`npm install failed. Try deleting node_modules folder and running ${colors_1.default.input('npm install --force')} manually.`);
92
+ }
93
+ try {
94
+ await common_1.runTask(`Migrating @capacitor/storage to @capacitor/preferences.`, () => {
95
+ return migrateStoragePluginToPreferences(runNpmInstall);
96
+ });
97
+ }
98
+ catch (ex) {
99
+ log_1.logger.error(`@capacitor/preferences failed to install. Try deleting node_modules folder and running ${colors_1.default.input('npm install @capacitor/preferences --force')} manually.`);
100
+ }
89
101
  if (allDependencies['@capacitor/ios'] &&
90
102
  utils_fs_1.existsSync(config.ios.platformDirAbs)) {
91
103
  // Set deployment target to 13.0
@@ -138,7 +150,7 @@ async function migrateCommand(config) {
138
150
  return updateAppBuildGradle(path_1.join(config.android.appDirAbs, 'build.gradle'));
139
151
  });
140
152
  // Update gradle-wrapper.properties
141
- await common_1.runTask(`Migrating gradle-wrapper.properties by updating gradle version from 7.0 to 7.4.2.`, () => {
153
+ await common_1.runTask(`Migrating gradle-wrapper.properties by updating gradle version from 7.0 to ${gradleVersion}.`, () => {
142
154
  return updateGradleWrapper(path_1.join(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
143
155
  });
144
156
  // Variables gradle
@@ -189,6 +201,19 @@ async function migrateCommand(config) {
189
201
  await common_1.runTask(`Running cap sync.`, () => {
190
202
  return subprocess_1.getCommandOutput('npx', ['cap', 'sync']);
191
203
  });
204
+ try {
205
+ await common_1.runTask(`Upgrading gradle wrapper files`, () => {
206
+ return updateGradleWrapperFiles(config.android.platformDirAbs);
207
+ });
208
+ }
209
+ catch (e) {
210
+ if (e.includes('EACCES')) {
211
+ 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`);
212
+ }
213
+ else {
214
+ log_1.logger.error(`gradle wrapper files were not updated`);
215
+ }
216
+ }
192
217
  // Write all breaking changes
193
218
  await common_1.runTask(`Writing breaking changes.`, () => {
194
219
  return writeBreakingChanges();
@@ -232,9 +257,8 @@ async function installLatestNPMLibs(runInstall, config) {
232
257
  encoding: 'utf-8',
233
258
  });
234
259
  if (runInstall) {
235
- rimraf_1.default.sync(path_1.join(config.app.rootDir, 'package-lock.json'));
236
260
  rimraf_1.default.sync(path_1.join(config.app.rootDir, 'node_modules/@capacitor/!(cli)'));
237
- await subprocess_1.getCommandOutput('npm', ['i']);
261
+ await subprocess_1.runCommand('npm', ['i']);
238
262
  }
239
263
  else {
240
264
  log_1.logger.info(`Please run an install command with your package manager of choice. (ex: yarn install)`);
@@ -245,10 +269,7 @@ async function migrateStoragePluginToPreferences(runInstall) {
245
269
  log_1.logger.info('NOTE: @capacitor/storage was renamed to @capacitor/preferences, please be sure to replace occurances in your code.');
246
270
  if (runInstall) {
247
271
  await subprocess_1.getCommandOutput('npm', ['uninstall', '@capacitor/storage']);
248
- await subprocess_1.getCommandOutput('npm', [
249
- 'i',
250
- `@capacitor/preferences@${pluginVersion}`,
251
- ]);
272
+ await subprocess_1.runCommand('npm', ['i', `@capacitor/preferences@${pluginVersion}`]);
252
273
  }
253
274
  else {
254
275
  log_1.logger.info(`Please manually uninstall @capacitor/storage and replace it with @capacitor/preferences@${pluginVersion}`);
@@ -423,9 +444,22 @@ async function updateGradleWrapper(filename) {
423
444
  }
424
445
  const replaced = setAllStringIn(txt, 'distributionUrl=', '\n',
425
446
  // eslint-disable-next-line no-useless-escape
426
- `https\\://services.gradle.org/distributions/gradle-7.4.2-all.zip`);
447
+ `https\\://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip`);
427
448
  utils_fs_1.writeFileSync(filename, replaced, 'utf-8');
428
449
  }
450
+ async function updateGradleWrapperFiles(platformDir) {
451
+ await subprocess_1.runCommand(`./gradlew`, [
452
+ 'wrapper',
453
+ '--distribution-type',
454
+ 'all',
455
+ '--gradle-version',
456
+ gradleVersion,
457
+ '--warning-mode',
458
+ 'all',
459
+ ], {
460
+ cwd: platformDir,
461
+ });
462
+ }
429
463
  async function updateFile(config, filename, textStart, textEnd, replacement, skipIfNotFound) {
430
464
  if (config === null) {
431
465
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "4.2.0",
3
+ "version": "4.2.1-dev-20220921T210130.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)",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "101a5681ab37147de8c702b2048ae3185b28a5b2"
86
+ "gitHead": "2320dc7d8abed7185bf42642d7f634e8f3faa3f1"
87
87
  }